From: <ale...@us...> - 2013-11-05 11:54:10
|
Revision: 58750 http://sourceforge.net/p/firebird/code/58750 Author: alexpeshkoff Date: 2013-11-05 11:54:06 +0000 (Tue, 05 Nov 2013) Log Message: ----------- Enhanced diags for unprepared statement Modified Paths: -------------- firebird/trunk/lang_helpers/gds_codes.ftn firebird/trunk/lang_helpers/gds_codes.pas firebird/trunk/src/include/gen/codetext.h firebird/trunk/src/include/gen/iberror.h firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/include/gen/sql_code.h firebird/trunk/src/include/gen/sql_state.h firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/msgs/system_errors2.sql firebird/trunk/src/remote/remote.h firebird/trunk/src/remote/server/server.cpp firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/lang_helpers/gds_codes.ftn =================================================================== --- firebird/trunk/lang_helpers/gds_codes.ftn 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/lang_helpers/gds_codes.ftn 2013-11-05 11:54:06 UTC (rev 58750) @@ -1552,6 +1552,8 @@ PARAMETER (GDS__auth_data = 335545069) INTEGER*4 GDS__auth_datalength PARAMETER (GDS__auth_datalength = 335545070) + INTEGER*4 GDS__info_unprepared_stmt + PARAMETER (GDS__info_unprepared_stmt = 335545071) INTEGER*4 GDS__gfix_db_name PARAMETER (GDS__gfix_db_name = 335740929) INTEGER*4 GDS__gfix_invalid_sw Modified: firebird/trunk/lang_helpers/gds_codes.pas =================================================================== --- firebird/trunk/lang_helpers/gds_codes.pas 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/lang_helpers/gds_codes.pas 2013-11-05 11:54:06 UTC (rev 58750) @@ -783,6 +783,7 @@ gds_secdb_name = 335545068; gds_auth_data = 335545069; gds_auth_datalength = 335545070; + gds_info_unprepared_stmt = 335545071; gds_gfix_db_name = 335740929; gds_gfix_invalid_sw = 335740930; gds_gfix_incmp_sw = 335740932; Modified: firebird/trunk/src/include/gen/codetext.h =================================================================== --- firebird/trunk/src/include/gen/codetext.h 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/include/gen/codetext.h 2013-11-05 11:54:06 UTC (rev 58750) @@ -772,6 +772,7 @@ {"secdb_name", 335545068}, {"auth_data", 335545069}, {"auth_datalength", 335545070}, + {"info_unprepared_stmt", 335545071}, {"gfix_db_name", 335740929}, {"gfix_invalid_sw", 335740930}, {"gfix_incmp_sw", 335740932}, Modified: firebird/trunk/src/include/gen/iberror.h =================================================================== --- firebird/trunk/src/include/gen/iberror.h 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/include/gen/iberror.h 2013-11-05 11:54:06 UTC (rev 58750) @@ -806,6 +806,7 @@ const ISC_STATUS isc_secdb_name = 335545068L; const ISC_STATUS isc_auth_data = 335545069L; const ISC_STATUS isc_auth_datalength = 335545070L; +const ISC_STATUS isc_info_unprepared_stmt = 335545071L; const ISC_STATUS isc_gfix_db_name = 335740929L; const ISC_STATUS isc_gfix_invalid_sw = 335740930L; const ISC_STATUS isc_gfix_incmp_sw = 335740932L; @@ -1250,7 +1251,7 @@ const ISC_STATUS isc_trace_switch_param_miss = 337182758L; const ISC_STATUS isc_trace_param_act_notcompat = 337182759L; const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L; -const ISC_STATUS isc_err_max = 1194; +const ISC_STATUS isc_err_max = 1195; #else /* c definitions */ @@ -2026,6 +2027,7 @@ #define isc_secdb_name 335545068L #define isc_auth_data 335545069L #define isc_auth_datalength 335545070L +#define isc_info_unprepared_stmt 335545071L #define isc_gfix_db_name 335740929L #define isc_gfix_invalid_sw 335740930L #define isc_gfix_incmp_sw 335740932L @@ -2470,7 +2472,7 @@ #define isc_trace_switch_param_miss 337182758L #define isc_trace_param_act_notcompat 337182759L #define isc_trace_mandatory_switch_miss 337182760L -#define isc_err_max 1194 +#define isc_err_max 1195 #endif Modified: firebird/trunk/src/include/gen/msgs.h =================================================================== --- firebird/trunk/src/include/gen/msgs.h 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/include/gen/msgs.h 2013-11-05 11:54:06 UTC (rev 58750) @@ -775,6 +775,7 @@ {335545068, "Error getting security database name from configuration file"}, /* secdb_name */ {335545069, "Client authentication plugin is missing required data from server"}, /* auth_data */ {335545070, "Client authentication plugin expected @2 bytes of @3 from server, got @1"}, /* auth_datalength */ + {335545071, "Attempt to get information about an unprepared dynamic SQL statement."}, /* info_unprepared_stmt */ {335740929, "data base file name (@1) already given"}, /* gfix_db_name */ {335740930, "invalid switch @1"}, /* gfix_invalid_sw */ {335740932, "incompatible switch combination"}, /* gfix_incmp_sw */ Modified: firebird/trunk/src/include/gen/sql_code.h =================================================================== --- firebird/trunk/src/include/gen/sql_code.h 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/include/gen/sql_code.h 2013-11-05 11:54:06 UTC (rev 58750) @@ -771,6 +771,7 @@ {335545068, -902}, /* 748 secdb_name */ {335545069, -902}, /* 749 auth_data */ {335545070, -902}, /* 750 auth_datalength */ + {335545071, -901}, /* 751 info_unprepared_stmt */ {335740929, -901}, /* 1 gfix_db_name */ {335740930, -901}, /* 2 gfix_invalid_sw */ {335740932, -901}, /* 4 gfix_incmp_sw */ Modified: firebird/trunk/src/include/gen/sql_state.h =================================================================== --- firebird/trunk/src/include/gen/sql_state.h 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/include/gen/sql_state.h 2013-11-05 11:54:06 UTC (rev 58750) @@ -771,6 +771,7 @@ {335545068, "28000"}, // 748 secdb_name {335545069, "28000"}, // 749 auth_data {335545070, "28000"}, // 750 auth_datalength + {335545071, "HY007"}, // 751 info_unprepared_stmt {335740929, "00000"}, // 1 gfix_db_name {335740930, "00000"}, // 2 gfix_invalid_sw {335740932, "00000"}, // 4 gfix_incmp_sw Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/msgs/facilities2.sql 2013-11-05 11:54:06 UTC (rev 58750) @@ -1,7 +1,7 @@ /* MAX_NUMBER is the next number to be used, always one more than the highest message number. */ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?); -- -('2013-10-15 17:48:59', 'JRD', 0, 751) +('2013-11-05 13:18:17', 'JRD', 0, 752) ('2012-01-23 20:10:30', 'QLI', 1, 532) ('2009-07-16 05:26:11', 'GFIX', 3, 121) ('1996-11-07 13:39:40', 'GPRE', 4, 1) Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/msgs/messages2.sql 2013-11-05 11:54:06 UTC (rev 58750) @@ -858,6 +858,7 @@ ('secdb_name', NULL, NULL, NULL, 0, 748, NULL, 'Error getting security database name from configuration file', NULL, NULL); ('auth_data', NULL, NULL, NULL, 0, 749, NULL, 'Client authentication plugin is missing required data from server', NULL, NULL); ('auth_datalength', NULL, NULL, NULL, 0, 750, NULL, 'Client authentication plugin expected @2 bytes of @3 from server, got @1', NULL, NULL); +('info_unprepared_stmt', NULL, NULL, NULL, 0, 751, NULL, 'Attempt to get information about an unprepared dynamic SQL statement.', NULL, NULL); -- QLI (NULL, NULL, NULL, NULL, 1, 0, NULL, 'expected type', NULL, NULL); (NULL, NULL, NULL, NULL, 1, 1, NULL, 'bad block type', NULL, NULL); Modified: firebird/trunk/src/msgs/system_errors2.sql =================================================================== --- firebird/trunk/src/msgs/system_errors2.sql 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/msgs/system_errors2.sql 2013-11-05 11:54:06 UTC (rev 58750) @@ -757,6 +757,7 @@ (-902, '28', '000', 0, 748, 'secdb_name', NULL, NULL); (-902, '28', '000', 0, 749, 'auth_data', NULL, NULL); (-902, '28', '000', 0, 750, 'auth_datalength', NULL, NULL); +(-901, 'HY', '007', 0, 751, 'info_unprepared_stmt', NULL, NULL) -- GFIX (-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL) (-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL) Modified: firebird/trunk/src/remote/remote.h =================================================================== --- firebird/trunk/src/remote/remote.h 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/remote/remote.h 2013-11-05 11:54:06 UTC (rev 58750) @@ -462,7 +462,7 @@ void releaseException(); static ISC_STATUS badHandle() { return isc_bad_req_handle; } - void checkIface(); + void checkIface(ISC_STATUS code = isc_unprepared_stmt); void checkCursor(); }; Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/remote/server/server.cpp 2013-11-05 11:54:06 UTC (rev 58750) @@ -1845,10 +1845,10 @@ } -void Rsr::checkIface() +void Rsr::checkIface(ISC_STATUS code) { if (!rsr_iface) - Arg::Gds(isc_unprepared_stmt).raise(); + Arg::Gds(code).raise(); } @@ -2376,7 +2376,8 @@ USHORT ret = 0; bool done = false; - statement->checkIface(); + fb_assert(statement->rsr_iface); + statement->checkIface(); // this should not happen but... statement->rsr_iface->getInfo(&local_status, sizeof(sql_info), sql_info, sizeof(buffer), buffer); @@ -3741,7 +3742,7 @@ case op_info_sql: getHandle(statement, stuff->p_info_object); - statement->checkIface(); + statement->checkIface(isc_info_unprepared_stmt); statement->rsr_iface->getInfo(&status_vector, info_len, info_buffer, stuff->p_info_buffer_length, buffer); Modified: firebird/trunk/src/yvalve/why.cpp =================================================================== --- firebird/trunk/src/yvalve/why.cpp 2013-11-05 08:53:49 UTC (rev 58749) +++ firebird/trunk/src/yvalve/why.cpp 2013-11-05 11:54:06 UTC (rev 58750) @@ -122,11 +122,11 @@ void closeCursor(Why::StatusVector* status); void closeStatement(Why::StatusVector* status); - void checkPrepared() const + void checkPrepared(ISC_STATUS code = isc_unprepared_stmt) const { if (!statement) { - Arg::Gds(isc_unprepared_stmt).raise(); + Arg::Gds(code).raise(); } } @@ -1849,7 +1849,7 @@ { RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle)); - statement->checkPrepared(); + statement->checkPrepared(isc_info_unprepared_stmt); RefPtr<IMessageMetadata> columns(REF_NO_INCR, statement->statement->next->getOutputMetadata(&status)); status.check(); @@ -1875,7 +1875,7 @@ { RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle)); - statement->checkPrepared(); + statement->checkPrepared(isc_info_unprepared_stmt); RefPtr<IMessageMetadata> parameters(REF_NO_INCR, statement->statement->next->getInputMetadata(&status)); status.check(); @@ -2255,8 +2255,6 @@ RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle)); - statement->checkPrepared(); - Array<UCHAR> outBlr, outMessage; sqldaParse(sqlda, outBlr, outMessage, dialect); @@ -2521,7 +2519,7 @@ try { RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle)); - statement->checkPrepared(); + statement->checkPrepared(isc_info_unprepared_stmt); statement->statement->getInfo(&status, USHORT(itemLength), reinterpret_cast<const UCHAR*>(items), USHORT(bufferLength), reinterpret_cast<UCHAR*>(buffer)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |