[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-glpk] SQL error not correctly reported in db_iodbc_open()
From: |
Xypron |
Subject: |
[Bug-glpk] SQL error not correctly reported in db_iodbc_open() |
Date: |
Wed, 11 Jun 2008 20:35:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 |
Hello Andrew,
GLPK 4.28 does not correctly report SQL errors when failing to select
data via a table IN statement.
Example:
Wrong error reporting:
db_iodbc_open: Query "SELECT job, operation, machine, duration FROM dsp
WHERE problem = FT10" failed.
The driver reported the following diagnostics whilst running
SQLDriverConnect
Corrected reporting:
db_iodbc_open: Query "SELECT job, operation, machine, duration FROM dsp
WHERE problem = FT10" failed.
The driver reported the following diagnostics whilst running SQLExecDirect
42S21:1:1054:[MySQL][ODBC 3.51
Driver][mysqld-5.0.45-Debian_1ubuntu3.3-log]Unknown column 'FT10' in
'where clause'
Here the information returned from function SQLGetDiagRec() is added,
the colons separate the following fields:
SQLState - five-character SQLSTATE code pertaining to the diagnostic
record RecNumber. The first two characters indicate the class; the next
three indicate the subclass. In the example 42S21 signifies 'Column
already exists'.
RecNumber - Indicates the status record from which the application seeks
information. Status records are numbered from 1.
NativeError - Native error code, specific to the data source. In the
example MySQL error 1054 signifies 'Unknown column'.
MessageText - Error message text.
Please, patch the file glpsql.c as follows:
--- glpk/glpk/branches/glpk-4.28-bugfix_iodbc_open/src/glpsql.c 2008/06/11
17:49:26 239
+++ glpk/glpk/branches/glpk-4.28-bugfix_iodbc_open/src/glpsql.c 2008/06/11
17:50:25 240
@@ -663,7 +663,7 @@
SQL_SUCCESS)
{
xprintf("db_iodbc_open: Query\n\"%s\"\nfailed.\n", sql->query);
- extract_error("SQLDriverConnect", sql->hdbc, SQL_HANDLE_STMT);
+ extract_error("SQLExecDirect", sql->hstmt, SQL_HANDLE_STMT);
dl_SQLFreeHandle(SQL_HANDLE_STMT, sql->hstmt);
dl_SQLDisconnect(sql->hdbc);
dl_SQLFreeHandle(SQL_HANDLE_DBC, sql->hdbc);
The complete code is available at
http://glpk.dyndns.org/viewvc/svn/glpk/glpk/branches/glpk-4.28-bugfix_iodbc_open/src/glpsql.c
Revision 240 is the corrected code.
Revision 239 is the old code.
Best regards
Xypron
- [Bug-glpk] SQL error not correctly reported in db_iodbc_open(),
Xypron <=