GAMySQLDriver#execute: raises exception when int field is NULL

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

GAMySQLDriver#execute: raises exception when int field is NULL


I report this problem at the issue tracker, https://github.com/guillep/DBXTalk/issues/8, but I realized there are only 3 issues reported there that are open over the last year, so I wasn't sure it was active. So I'm reposting here, thinking maybe this is the correct place (?).

Here's the problem statement. Am I doing something wrong, or is there a bug?

Using Pharo 5.0 and latest DBXTalk/Garage as of 6/1/2016.
Running on Windows 10 and connecting to a MySQL database on a Linux server.

Setup the following table:

mysql> select * from test_table;
| id | foo  |
|  1 |    1 |
|  2 | NULL |
mysql> describe test_table;
| Field | Type    | Null | Key | Default | Extra          |
| id    | int(11) | NO   | PRI | NULL    | auto_increment |
| foo   | int(11) | YES  |     | NULL    |                |
2 rows in set (0.01 sec)

Execute the following:

c := GADriver fromConnectionString: 'MySQL://'.
c connect.
q := c execute: 'select * from test_table'.

This results in the following error from GAMysqlDriver down in the NumberParser:

Reading a number failed: a digit between 0 and 9 expected

If the query is modified to avoid the NULL entries, then it works with no error:

q := c execute: 'select * from test_table where not (foo is null)'.

So it appears that the driver does not expect a NULL value for an integer.

You received this message because you are subscribed to the Google Groups "DBXTalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.