dotancohen / squeal

Database explorer with a focus on breadth, not depth.
2 stars 0 forks source link

Crash on some tables #13

Closed dotancohen closed 10 years ago

dotancohen commented 10 years ago
   Showing table phpfox_ad
   -----------------------

   Describe table
   --------------
+---------------------+------------------+------+-----+---------+----------------+
| Field               | Type             | Null | Key | Default | Extra          |
+---------------------+------------------+------+-----+---------+----------------+
| ad_id               | int(10) unsigned | NO   | PRI | None    | auto_increment |
| is_custom           | tinyint(1)       | NO   | MUL | 0       |                |
| user_id             | int(10) unsigned | NO   |     | 0       |                |
| type_id             | tinyint(1)       | NO   |     | None    |                |
| name                | varchar(150)     | NO   |     | None    |                |
| url_link            | mediumtext       | YES  |     | None    |                |
| start_date          | int(11) unsigned | NO   |     | 0       |                |
| end_date            | int(11) unsigned | NO   |     | 0       |                |
| total_view          | int(10) unsigned | NO   |     | 0       |                |
| total_click         | int(10) unsigned | NO   |     | 0       |                |
| is_cpm              | tinyint(1)       | NO   |     | 1       |                |
| is_active           | tinyint(1)       | NO   | MUL | 1       |                |
| module_access       | varchar(75)      | YES  |     | None    |                |
| location            | varchar(50)      | NO   |     | None    |                |
| country_iso         | char(2)          | YES  |     | None    |                |
| gender              | tinyint(1)       | NO   |     | 0       |                |
| age_from            | tinyint(2)       | NO   |     | 0       |                |
| age_to              | tinyint(2)       | NO   |     | 0       |                |
| user_group          | varchar(255)     | YES  |     | None    |                |
| html_code           | mediumtext       | YES  |     | None    |                |
| count_view          | int(10) unsigned | NO   |     | 0       |                |
| count_click         | int(10) unsigned | NO   |     | 0       |                |
| image_path          | varchar(75)      | YES  |     | None    |                |
| server_id           | tinyint(1)       | NO   |     | 0       |                |
| gmt_offset          | varchar(15)      | YES  |     | None    |                |
| disallow_controller | mediumtext       | YES  |     | None    |                |
| postal_code         | text             | YES  |     | None    |                |
| city_location       | text             | YES  |     | None    |                |
+---------------------+------------------+------+-----+---------+----------------+
Time: 0.0028

   Some random records
   -------------------
+-------+-----------+---------+---------+------+----------+------------+----------+------------+-------------+-----
| ad_id | is_custom | user_id | type_id | name | url_link | start_date | end_date | total_view | total_click | is_c
+-------+-----------+---------+---------+------+----------+------------+----------+------------+-------------+-----
+-------+-----------+---------+---------+------+----------+------------+----------+------------+-------------+-----
Time: 0.0009

   Last record
   -----------
Traceback (most recent call last):
  File "./squeal.py", line 337, in <module>
    main()
  File "./squeal.py", line 120, in main
    show_table_details(conn, cursor, prompt, menu_tables[operation-1])
  File "./squeal.py", line 283, in show_table_details
    output_table_from_sql(conn, cursor, sql, vertical_format=True)
  File "./squeal.py", line 303, in output_table_from_sql
    print("%s:\n        %s\n" % (cursor.description[i][0], results[0][i],))
IndexError: tuple index out of range
dotancohen commented 10 years ago

Another, this time from Panther:

   Showing table dist_queue_config
   -------------------------------

   Describe table
   --------------
+-------------+-------------+------+-----+---------+----------------+
| Field       | Type        | Null | Key | Default | Extra          |
+-------------+-------------+------+-----+---------+----------------+
| name        | varchar(30) | NO   |     | None    |                |
| value       | varchar(50) | YES  |     | None    |                |
| id          | int(11)     | NO   | PRI | None    | auto_increment |
| explanation | text        | YES  |     | None    |                |
| display     | tinyint(4)  | NO   |     | 1       |                |
+-------------+-------------+------+-----+---------+----------------+
Time: 0.0008

   Some random records
   -------------------
+------+-------+----+-------------+---------+
| name | value | id | explanation | display |
+------+-------+----+-------------+---------+
+------+-------+----+-------------+---------+
Time: 0.0003

   Last record
   -----------
Traceback (most recent call last):
  File "./squeal.py", line 338, in <module>
    main()
  File "./squeal.py", line 121, in main
    show_table_details(conn, cursor, prompt, menu_tables[operation-1])
  File "./squeal.py", line 284, in show_table_details
    output_table_from_sql(conn, cursor, sql, vertical_format=True)
  File "./squeal.py", line 304, in output_table_from_sql
    print("%s:\n        %s\n" % (cursor.description[i][0], results[0][i],))
IndexError: tuple index out of range

Note that the table in question is empty:

mysql> select count(*) from dist_queue_config;
+----------+
| count(*) |
+----------+
|        0 |
+----------+