8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

Enhanced diags for unprepared statement

This commit is contained in:
alexpeshkoff 2013-11-05 11:54:06 +00:00
parent 3947227e43
commit 9dbdab9d28
13 changed files with 25 additions and 15 deletions

View File

@ -1552,6 +1552,8 @@ C --
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

View File

@ -783,6 +783,7 @@ const
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;

View File

@ -772,6 +772,7 @@ static const struct {
{"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},

View File

@ -806,6 +806,7 @@ const ISC_STATUS isc_wirecrypt_plugin = 335545067L;
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_user_only = 337182757L;
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 @@ const ISC_STATUS isc_err_max = 1194;
#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 @@ const ISC_STATUS isc_err_max = 1194;
#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

View File

@ -775,6 +775,7 @@ Data source : @4"}, /* eds_statement */
{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 */

View File

@ -771,6 +771,7 @@ static const struct {
{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 */

View File

@ -771,6 +771,7 @@ static const struct {
{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

View File

@ -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)

View File

@ -858,6 +858,7 @@ Data source : @4', NULL, NULL)
('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);

View File

@ -757,6 +757,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-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)

View File

@ -462,7 +462,7 @@ public:
void releaseException();
static ISC_STATUS badHandle() { return isc_bad_req_handle; }
void checkIface();
void checkIface(ISC_STATUS code = isc_unprepared_stmt);
void checkCursor();
};

View File

@ -1845,10 +1845,10 @@ void ConnectAuth::accept(PACKET* send, Auth::WriterImplementation*)
}
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 @@ static USHORT check_statement_type( Rsr* statement)
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 @@ void rem_port::info(P_OP op, P_INFO* stuff, PACKET* sendL)
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);

View File

@ -122,11 +122,11 @@ public:
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 @@ ISC_STATUS API_ROUTINE isc_dsql_describe(ISC_STATUS* userStatus, FB_API_HANDLE*
{
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 @@ ISC_STATUS API_ROUTINE isc_dsql_describe_bind(ISC_STATUS* userStatus, FB_API_HAN
{
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 @@ ISC_STATUS API_ROUTINE isc_dsql_fetch(ISC_STATUS* userStatus, FB_API_HANDLE* stm
RefPtr<IscStatement> statement(translateHandle(statements, stmtHandle));
statement->checkPrepared();
Array<UCHAR> outBlr, outMessage;
sqldaParse(sqlda, outBlr, outMessage, dialect);
@ -2521,7 +2519,7 @@ ISC_STATUS API_ROUTINE isc_dsql_sql_info(ISC_STATUS* userStatus, FB_API_HANDLE*
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));