From: <di...@us...> - 2010-10-31 11:26:59
|
Revision: 51809 http://firebird.svn.sourceforge.net/firebird/?rev=51809&view=rev Author: dimitr Date: 2010-10-31 11:26:52 +0000 (Sun, 31 Oct 2010) Log Message: ----------- Fixed CORE-3205: isc_dsql_exec_immed2() doesn't return error codes isc_stream_eof and isc_sing_select_err. Also, restore the legacy behavior for EXECUTE PROCEDURE and RETURNING queries. This is expected to fix CORE-3203. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2010-10-31 08:55:17 UTC (rev 51808) +++ firebird/trunk/src/dsql/dsql.cpp 2010-10-31 11:26:52 UTC (rev 51809) @@ -255,12 +255,9 @@ } } - // A select with a non zero output length is a singleton select - bool singleton; - if (statement->getType() == DsqlCompiledStatement::TYPE_SELECT && out_msg_length != 0) - singleton = true; - else - singleton = false; + // A select with a non zero output length is a singleton select + const bool singleton = + (statement->getType() == DsqlCompiledStatement::TYPE_SELECT && out_msg_length != 0); if (!(request->req_flags & dsql_req::FLAG_EMBEDDED)) { @@ -353,15 +350,20 @@ Jrd::ContextPoolHolder context(tdbb, &request->getPool()); + const DsqlCompiledStatement* statement = request->getStatement(); + // if the cursor isn't open, we've got a problem - if (!(request->req_flags & dsql_req::FLAG_OPENED_CURSOR)) + if (reqTypeWithCursor(statement->getType())) { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << - Arg::Gds(isc_dsql_cursor_err) << - Arg::Gds(isc_dsql_cursor_not_open)); + if (!(request->req_flags & dsql_req::FLAG_OPENED_CURSOR)) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << + Arg::Gds(isc_dsql_cursor_err) << + Arg::Gds(isc_dsql_cursor_not_open)); + } } - dsql_msg* message = (dsql_msg*) request->getStatement()->getReceiveMsg(); + dsql_msg* message = (dsql_msg*) statement->getReceiveMsg(); // Set up things for tracing this call Jrd::Attachment* att = request->req_dbb->dbb_attachment; @@ -374,11 +376,11 @@ parse_blr(request, blr_length, blr, msg_length, message->msg_parameters); } - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_GET_SEGMENT) + if (statement->getType() == DsqlCompiledStatement::TYPE_GET_SEGMENT) { // For get segment, use the user buffer and indicator directly. - const dsql_par* parameter = request->getStatement()->getBlob()->blb_segment; + const dsql_par* parameter = statement->getBlob()->blb_segment; const dsql_par* null = parameter->par_null; dsc userDesc; @@ -408,7 +410,7 @@ JRD_receive(tdbb, request->req_request, message->msg_number, message->msg_length, msgBuffer); - const dsql_par* const eof = request->getStatement()->getEof(); + const dsql_par* const eof = statement->getEof(); dsc eofDesc = eof->par_desc; eofDesc.dsc_address = msgBuffer + IPTR(eofDesc.dsc_address); @@ -445,6 +447,8 @@ Jrd::ContextPoolHolder context(tdbb, &request->getPool()); + const DsqlCompiledStatement* statement = request->getStatement(); + if (option & DSQL_drop) { // Release everything associated with the request @@ -458,12 +462,16 @@ else if (option & DSQL_close) { // Just close the cursor associated with the request - if (!(request->req_flags & dsql_req::FLAG_OPENED_CURSOR)) + if (reqTypeWithCursor(statement->getType())) { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-501) << - Arg::Gds(isc_dsql_cursor_close_err)); + if (!(request->req_flags & dsql_req::FLAG_OPENED_CURSOR)) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-501) << + Arg::Gds(isc_dsql_cursor_close_err)); + } + + close_cursor(tdbb, request); } - close_cursor(tdbb, request); } } @@ -492,7 +500,9 @@ Jrd::ContextPoolHolder context(tdbb, &request->getPool()); - if (request->getStatement()->getFlags() & DsqlCompiledStatement::FLAG_ORPHAN) + const DsqlCompiledStatement* statement = request->getStatement(); + + if (statement->getFlags() & DsqlCompiledStatement::FLAG_ORPHAN) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << Arg::Gds(isc_bad_req_handle)); @@ -500,7 +510,7 @@ // if the cursor isn't open, we've got a problem - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_PUT_SEGMENT) + if (statement->getType() == DsqlCompiledStatement::TYPE_PUT_SEGMENT) { if (!(request->req_flags & dsql_req::FLAG_OPENED_CURSOR)) { @@ -510,7 +520,7 @@ } } - dsql_msg* message = (dsql_msg*) request->getStatement()->getReceiveMsg(); + dsql_msg* message = (dsql_msg*) statement->getReceiveMsg(); // Insure that the blr for the message is parsed, regardless of // whether anything is found by the call to receive. @@ -518,11 +528,11 @@ if (blr_length) parse_blr(request, blr_length, blr, msg_length, message->msg_parameters); - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_PUT_SEGMENT) + if (statement->getType() == DsqlCompiledStatement::TYPE_PUT_SEGMENT) { // For put segment, use the user buffer and indicator directly. - const dsql_par* parameter = request->getStatement()->getBlob()->blb_segment; + const dsql_par* parameter = statement->getBlob()->blb_segment; dsc userDesc; if (!request->req_user_descs.get(parameter, userDesc)) @@ -600,6 +610,8 @@ length = strlen(string); } + const DsqlCompiledStatement* statement = request->getStatement(); + try { // Figure out which parser version to use @@ -647,7 +659,7 @@ // Can not prepare a CREATE DATABASE/SCHEMA statement - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_CREATE_DB) + if (statement->getType() == DsqlCompiledStatement::TYPE_CREATE_DB) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-530) << Arg::Gds(isc_dsql_crdb_prepare_err)); @@ -806,13 +818,15 @@ SET_TDBB(tdbb); Jrd::Attachment* attachment = request->req_dbb->dbb_attachment; + const DsqlCompiledStatement* statement = request->getStatement(); + if (request->req_request) { ThreadStatusGuard status_vector(tdbb); try { - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_GET_SEGMENT || - request->getStatement()->getType() == DsqlCompiledStatement::TYPE_PUT_SEGMENT) + if (statement->getType() == DsqlCompiledStatement::TYPE_GET_SEGMENT || + statement->getType() == DsqlCompiledStatement::TYPE_PUT_SEGMENT) { BLB_close(tdbb, request->req_blb); request->req_blb = NULL; @@ -878,7 +892,9 @@ { UCHAR bpb[24]; - const dsql_blb* blob = request->getStatement()->getBlob(); + const DsqlCompiledStatement* statement = request->getStatement(); + + const dsql_blb* blob = statement->getBlob(); map_in_out(request, false, blob->blb_open_in_msg, in_blr_length, in_blr, in_msg_length, NULL, in_msg); @@ -915,7 +931,7 @@ bid* blob_id = (bid*) desc.dsc_address; - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_GET_SEGMENT) + if (statement->getType() == DsqlCompiledStatement::TYPE_GET_SEGMENT) { if (null) { @@ -1030,10 +1046,16 @@ Jrd::ContextPoolHolder context(tdbb, &request->getPool()); + const DsqlCompiledStatement* statement = request->getStatement(); + + // A select with a non zero output length is a singleton select + const bool singleton = + (statement->getType() == DsqlCompiledStatement::TYPE_SELECT && out_msg_length != 0); + execute_request(tdbb, request, tra_handle, in_blr_length, in_blr, in_msg_length, in_msg, out_blr_length, out_blr, out_msg_length, out_msg, - false); + singleton); release_request(tdbb, request, true); } @@ -1067,7 +1089,7 @@ @param out_blr @param out_msg_length @param out_msg - @param singleton + @param singleton **/ static void execute_request(thread_db* tdbb, @@ -1081,12 +1103,13 @@ { request->req_transaction = *tra_handle; - switch (request->getStatement()->getType()) + const DsqlCompiledStatement* statement = request->getStatement(); + + switch (statement->getType()) { case DsqlCompiledStatement::TYPE_START_TRANS: JRD_start_transaction(tdbb, &request->req_transaction, 1, &request->req_dbb->dbb_attachment, - request->getStatement()->getDdlData().getCount(), - request->getStatement()->getDdlData().begin()); + statement->getDdlData().getCount(), statement->getDdlData().begin()); *tra_handle = request->req_transaction; return; @@ -1150,7 +1173,7 @@ // If there is no data required, just start the request - const dsql_msg* message = request->getStatement()->getSendMsg(); + const dsql_msg* message = statement->getSendMsg(); if (message) map_in_out(request, false, message, in_blr_length, in_blr, in_msg_length, NULL, in_msg); @@ -1170,9 +1193,9 @@ // TYPE_EXEC_BLOCK has no outputs so there are no out_msg // supplied from client side, but TYPE_EXEC_BLOCK requires // 2-byte message for EOS synchronization - const bool isBlock = (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_EXEC_BLOCK); + const bool isBlock = (statement->getType() == DsqlCompiledStatement::TYPE_EXEC_BLOCK); - message = request->getStatement()->getReceiveMsg(); + message = statement->getReceiveMsg(); if ((out_msg_length && message) || isBlock) { UCHAR temp_buffer[FB_DOUBLE_ALIGN * 2]; @@ -1249,7 +1272,7 @@ } UCHAR buffer[20]; // Not used after retrieved - if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_UPDATE_CURSOR) + if (statement->getType() == DsqlCompiledStatement::TYPE_UPDATE_CURSOR) { sql_info(tdbb, request, sizeof(sql_records_info), sql_records_info, sizeof(buffer), buffer); @@ -1260,7 +1283,7 @@ Arg::Gds(isc_update_conflict)); } } - else if (request->getStatement()->getType() == DsqlCompiledStatement::TYPE_DELETE_CURSOR) + else if (statement->getType() == DsqlCompiledStatement::TYPE_DELETE_CURSOR) { sql_info(tdbb, request, sizeof(sql_records_info), sql_records_info, sizeof(buffer), buffer); @@ -1272,7 +1295,7 @@ } } - const bool have_cursor = reqTypeWithCursor(request->getStatement()->getType()) && !singleton; + const bool have_cursor = reqTypeWithCursor(statement->getType()) && !singleton; trace.finish(have_cursor, res_successful); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2010-11-01 10:46:37
|
Revision: 51819 http://firebird.svn.sourceforge.net/firebird/?rev=51819&view=rev Author: alexpeshkoff Date: 2010-11-01 10:46:31 +0000 (Mon, 01 Nov 2010) Log Message: ----------- Fixed segfault in dsql_prepare Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2010-11-01 03:21:36 UTC (rev 51818) +++ firebird/trunk/src/dsql/dsql.cpp 2010-11-01 10:46:31 UTC (rev 51819) @@ -610,8 +610,6 @@ length = strlen(string); } - const DsqlCompiledStatement* statement = request->getStatement(); - try { // Figure out which parser version to use @@ -659,6 +657,8 @@ // Can not prepare a CREATE DATABASE/SCHEMA statement + const DsqlCompiledStatement* statement = request->getStatement(); + if (statement->getType() == DsqlCompiledStatement::TYPE_CREATE_DB) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-530) << This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2010-11-02 09:35:54
|
Revision: 51831 http://firebird.svn.sourceforge.net/firebird/?rev=51831&view=rev Author: dimitr Date: 2010-11-02 09:35:48 +0000 (Tue, 02 Nov 2010) Log Message: ----------- Fixed SET TRANSACTION statement. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2010-11-02 03:27:51 UTC (rev 51830) +++ firebird/trunk/src/dsql/dsql.cpp 2010-11-02 09:35:48 UTC (rev 51831) @@ -1108,7 +1108,7 @@ switch (statement->getType()) { case DsqlCompiledStatement::TYPE_START_TRANS: - JRD_start_transaction(tdbb, &request->req_transaction, 1, &request->req_dbb->dbb_attachment, + JRD_start_transaction(tdbb, &request->req_transaction, 1, request->req_dbb->dbb_attachment, statement->getDdlData().getCount(), statement->getDdlData().begin()); *tra_handle = request->req_transaction; return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2010-11-08 16:37:13
|
Revision: 51876 http://firebird.svn.sourceforge.net/firebird/?rev=51876&view=rev Author: dimitr Date: 2010-11-08 16:37:07 +0000 (Mon, 08 Nov 2010) Log Message: ----------- Fixed CORE-3029: Bugcheck "Too many savepoints (287)" at rollback after exception at EXECUTE BLOCK with exception handler. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2010-11-08 16:32:38 UTC (rev 51875) +++ firebird/trunk/src/dsql/dsql.cpp 2010-11-08 16:37:07 UTC (rev 51876) @@ -1190,6 +1190,14 @@ message->msg_length, msgBuffer); } + // Selectable execute block should get the "proc fetch" flag assigned, + // which ensures that the savepoint stack is preserved while suspending + if (statement->getType() == DsqlCompiledStatement::TYPE_SELECT_BLOCK) + { + fb_assert(request->req_request); + request->req_request->req_flags |= req_proc_fetch; + } + // TYPE_EXEC_BLOCK has no outputs so there are no out_msg // supplied from client side, but TYPE_EXEC_BLOCK requires // 2-byte message for EOS synchronization This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2010-11-19 14:38:02
|
Revision: 51935 http://firebird.svn.sourceforge.net/firebird/?rev=51935&view=rev Author: hvlad Date: 2010-11-19 14:37:56 +0000 (Fri, 19 Nov 2010) Log Message: ----------- Fixed bug CORE-3219 : trace manager crash server with DSQL_unprepare Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2010-11-19 14:33:30 UTC (rev 51934) +++ firebird/trunk/src/dsql/dsql.cpp 2010-11-19 14:37:56 UTC (rev 51935) @@ -2898,6 +2898,7 @@ TraceSQLStatementImpl stmt(request, NULL); TraceManager::event_dsql_free(att, &stmt, DSQL_drop); } + request->req_traced = false; if (request->req_cursor) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2011-01-28 18:58:50
|
Revision: 52223 http://firebird.svn.sourceforge.net/firebird/?rev=52223&view=rev Author: dimitr Date: 2011-01-28 18:58:44 +0000 (Fri, 28 Jan 2011) Log Message: ----------- More work on enlarging the message buffers. To be continued. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-01-28 18:51:23 UTC (rev 52222) +++ firebird/trunk/src/dsql/dsql.cpp 2011-01-28 18:58:44 UTC (rev 52223) @@ -2380,7 +2380,7 @@ align = type_alignments[dtype_short]; if (align) offset = FB_ALIGN(offset, align); - USHORT null_offset = offset; + const ULONG null_offset = offset; offset += sizeof(SSHORT); const dsql_par* const parameter = parameters[index - 1]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2011-02-06 11:57:27
|
Revision: 52302 http://firebird.svn.sourceforge.net/firebird/?rev=52302&view=rev Author: dimitr Date: 2011-02-06 11:57:18 +0000 (Sun, 06 Feb 2011) Log Message: ----------- Fixed CORE-1620: Incorrect error message if EXECUTE STATEMENT contains empty string. It doesn't fix the "uninitialized variable" issue per se, but I'm not sure this is strictly required, as it gets initialized if the statement contains at least one character, and all cases of empty string are now caught in advance. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-02-05 03:26:13 UTC (rev 52301) +++ firebird/trunk/src/dsql/dsql.cpp 2011-02-06 11:57:18 UTC (rev 52302) @@ -583,17 +583,19 @@ dsql_req* request = NULL; - if (!string) + if (string && !length) { + length = strlen(string); + } + + if (!string || !length) + { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Unexpected end of command // CVC: Nothing will be line 1, column 1 for the user. Arg::Gds(isc_command_end_err2) << Arg::Num(1) << Arg::Num(1)); } - if (length == 0) - length = strlen(string); - try { // Figure out which parser version to use This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-03-01 01:07:50
|
Revision: 52487 http://firebird.svn.sourceforge.net/firebird/?rev=52487&view=rev Author: asfernandes Date: 2011-03-01 01:07:44 +0000 (Tue, 01 Mar 2011) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-02-28 16:03:53 UTC (rev 52486) +++ firebird/trunk/src/dsql/dsql.cpp 2011-03-01 01:07:44 UTC (rev 52487) @@ -751,7 +751,7 @@ } else { - fb_assert(request != (*symbol)); + fb_assert(request != *symbol); ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-502) << Arg::Gds(isc_dsql_decl_err) << Arg::Gds(isc_dsql_cursor_redefined) << request->req_cursor); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2011-03-16 21:08:38
|
Revision: 52546 http://firebird.svn.sourceforge.net/firebird/?rev=52546&view=rev Author: hvlad Date: 2011-03-16 21:08:32 +0000 (Wed, 16 Mar 2011) Log Message: ----------- Fixed bug CORE-3389 : isc_dsql_exec_immed2 with zero transaction handle could lead to a BUGCHECK(147). While HEAD is not affected directly by this exact test case i see no harm to repeat the fix there too. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-03-16 20:44:07 UTC (rev 52545) +++ firebird/trunk/src/dsql/dsql.cpp 2011-03-16 21:08:32 UTC (rev 52546) @@ -1033,10 +1033,18 @@ request = prepareRequest(tdbb, database, *tra_handle, length, string, dialect, parser_version, isInternalRequest); + const DsqlCompiledStatement* statement = request->getStatement(); + + // Only allow NULL trans_handle if we're starting a transaction + + if (!*tra_handle && statement->getType() != DsqlCompiledStatement::TYPE_START_TRANS) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << + Arg::Gds(isc_bad_trans_handle)); + } + Jrd::ContextPoolHolder context(tdbb, &request->getPool()); - const DsqlCompiledStatement* statement = request->getStatement(); - // A select with a non zero output length is a singleton select const bool singleton = (statement->getType() == DsqlCompiledStatement::TYPE_SELECT && out_msg_length != 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2011-04-13 12:39:55
|
Revision: 52713 http://firebird.svn.sourceforge.net/firebird/?rev=52713&view=rev Author: alexpeshkoff Date: 2011-04-13 12:39:44 +0000 (Wed, 13 Apr 2011) Log Message: ----------- Added more diagnostics in DEV_BUILD. If you find it reasonable, can be internationalized and added to release too. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-04-13 10:38:10 UTC (rev 52712) +++ firebird/trunk/src/dsql/dsql.cpp 2011-04-13 12:39:44 UTC (rev 52713) @@ -1518,7 +1518,11 @@ if (err || count) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_sqlda_err)); + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << (err ? "Message buffer too short" : "Wrong number of message parameters") +#endif + ); } const DsqlCompiledStatement* statement = request->getStatement(); @@ -1625,7 +1629,11 @@ if (*blr != blr_version4 && *blr != blr_version5) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_sqlda_err)); + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << "Wrong BLR version" +#endif + ); } blr++; // skip the blr_version @@ -1633,7 +1641,11 @@ if (*blr++ != blr_begin || *blr++ != blr_message) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_sqlda_err)); + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << "Missing blr_begin / blr_message" +#endif + ); } ++blr; // skip the message number @@ -1752,7 +1764,11 @@ default: ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_sqlda_err)); + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << "Wrong BLR type" +#endif + ); } USHORT align = type_alignments[desc.dsc_dtype]; @@ -1765,7 +1781,11 @@ if (*blr++ != blr_short || *blr++ != 0) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_sqlda_err)); + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << "Wrong BLR type for NULL indicator" +#endif + ); } align = type_alignments[dtype_short]; @@ -1805,7 +1825,11 @@ if (*blr++ != (UCHAR) blr_end || offset != msg_length) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_sqlda_err)); + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << (offset != msg_length ? "Invalid message length" : "Missing blr_end") +#endif + ); } return count; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2011-05-12 14:57:01
|
Revision: 52932 http://firebird.svn.sourceforge.net/firebird/?rev=52932&view=rev Author: dimitr Date: 2011-05-12 14:56:54 +0000 (Thu, 12 May 2011) Log Message: ----------- Fixed CORE-3477: Passing non-existing SQL parameters always crash server. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-05-12 14:51:12 UTC (rev 52931) +++ firebird/trunk/src/dsql/dsql.cpp 2011-05-12 14:56:54 UTC (rev 52932) @@ -1653,6 +1653,16 @@ count += (*blr++) << 8; count /= 2; + if (count != parameters.getCount()) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << "Wrong number of message parameters" +#endif + ); + } + ULONG offset = 0; for (USHORT index = 1; index <= count; index++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2011-12-19 10:01:08
|
Revision: 53709 http://firebird.svn.sourceforge.net/firebird/?rev=53709&view=rev Author: hvlad Date: 2011-12-19 10:01:02 +0000 (Mon, 19 Dec 2011) Log Message: ----------- Fixed AV in trace when statement free event is traced and it is first traced event for a given statement (i.e. prepare\execution was not traced before). Adriano, please review. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-12-19 09:59:11 UTC (rev 53708) +++ firebird/trunk/src/dsql/dsql.cpp 2011-12-19 10:01:02 UTC (rev 53709) @@ -2235,16 +2235,16 @@ child->addFlags(DsqlCompiledStatement::FLAG_ORPHAN); child->setParentRequest(NULL); - Jrd::ContextPoolHolder context(tdbb, &child->getPool()); - release_statement(child); + // hvlad: lines below is commented out as + // - child is already unlinked from its parent request + // - we should not free child's sql text until its owner request is alive + // It seems to me we should destroy owner request here, not a child + // statement - as it always was before + + //Jrd::ContextPoolHolder context(tdbb, &child->getPool()); + //release_statement(child); } - // For requests that are linked to a parent, unlink it - - const DsqlCompiledStatement* statement = request->getStatement(); - - release_statement(const_cast<DsqlCompiledStatement*>(statement)); - // If the request had an open cursor, close it if (request->req_flags & dsql_req::FLAG_OPENED_CURSOR) { @@ -2282,6 +2282,9 @@ } } + const DsqlCompiledStatement* statement = request->getStatement(); + release_statement(const_cast<DsqlCompiledStatement*>(statement)); + // Release the entire request if explicitly asked for if (drop) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2011-12-21 00:51:34
|
Revision: 53718 http://firebird.svn.sourceforge.net/firebird/?rev=53718&view=rev Author: asfernandes Date: 2011-12-21 00:51:28 +0000 (Wed, 21 Dec 2011) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2011-12-20 14:30:41 UTC (rev 53717) +++ firebird/trunk/src/dsql/dsql.cpp 2011-12-21 00:51:28 UTC (rev 53718) @@ -2238,9 +2238,9 @@ // hvlad: lines below is commented out as // - child is already unlinked from its parent request // - we should not free child's sql text until its owner request is alive - // It seems to me we should destroy owner request here, not a child - // statement - as it always was before - + // It seems to me we should destroy owner request here, not a child + // statement - as it always was before + //Jrd::ContextPoolHolder context(tdbb, &child->getPool()); //release_statement(child); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2012-02-06 21:50:56
|
Revision: 53985 http://firebird.svn.sourceforge.net/firebird/?rev=53985&view=rev Author: asfernandes Date: 2012-02-06 21:50:49 +0000 (Mon, 06 Feb 2012) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2012-02-06 20:10:50 UTC (rev 53984) +++ firebird/trunk/src/dsql/dsql.cpp 2012-02-06 21:50:49 UTC (rev 53985) @@ -1458,10 +1458,10 @@ // Prepare a request for execution. Return SQL status code. // Note: caller is responsible for pool handling. static dsql_req* prepareRequest(thread_db* tdbb, dsql_dbb* database, jrd_tra* transaction, - ULONG stringLength, const TEXT* string, USHORT clientDialect, USHORT parserVersion, + ULONG textLength, const TEXT* text, USHORT clientDialect, USHORT parserVersion, bool isInternalRequest) { - return prepareStatement(tdbb, database, transaction, stringLength, string, clientDialect, + return prepareStatement(tdbb, database, transaction, textLength, text, clientDialect, parserVersion, isInternalRequest); } @@ -1469,29 +1469,26 @@ // Prepare a statement for execution. Return SQL status code. // Note: caller is responsible for pool handling. static dsql_req* prepareStatement(thread_db* tdbb, dsql_dbb* database, jrd_tra* transaction, - ULONG string_length, const TEXT* string, USHORT client_dialect, USHORT parser_version, + ULONG textLength, const TEXT* text, USHORT clientDialect, USHORT parserVersion, bool isInternalRequest) { - ISC_STATUS_ARRAY local_status; - MOVE_CLEAR(local_status, sizeof(local_status)); + TraceDSQLPrepare trace(database->dbb_attachment, transaction, textLength, text); - TraceDSQLPrepare trace(database->dbb_attachment, transaction, string_length, string); - - if (client_dialect > SQL_DIALECT_CURRENT) + if (clientDialect > SQL_DIALECT_CURRENT) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << Arg::Gds(isc_wish_list)); } - if (string && !string_length) + if (text && textLength == 0) { - size_t sql_length = strlen(string); - if (sql_length > MAX_USHORT) - sql_length = MAX_USHORT; - string_length = static_cast<USHORT>(sql_length); + size_t sqlLength = strlen(text); + if (sqlLength > MAX_USHORT) + sqlLength = MAX_USHORT; + textLength = static_cast<USHORT>(sqlLength); } - if (!string || !string_length) + if (!text || textLength == 0) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << // Unexpected end of command @@ -1501,12 +1498,12 @@ // Get rid of the trailing ";" if there is one. - for (const TEXT* p = string + string_length; p-- > string;) + for (const TEXT* p = text + textLength; p-- > text;) { if (*p != ' ') { if (*p == ';') - string_length = p - string; + textLength = p - text; break; } } @@ -1519,222 +1516,226 @@ DsqlCompiledStatement* statement = FB_NEW(pool) DsqlCompiledStatement(pool); DsqlCompilerScratch* scratch = FB_NEW(pool) DsqlCompilerScratch(pool, database, transaction, statement); - scratch->clientDialect = client_dialect; + scratch->clientDialect = clientDialect; dsql_req* request = NULL; - try { + try + { + // Parse the SQL statement. If it croaks, return - // Parse the SQL statement. If it croaks, return + Parser parser(*tdbb->getDefaultPool(), clientDialect, + scratch->getAttachment()->dbb_db_SQL_dialect, parserVersion, text, textLength, + tdbb->getAttachment()->att_charset); - Parser parser(*tdbb->getDefaultPool(), client_dialect, - scratch->getAttachment()->dbb_db_SQL_dialect, parser_version, string, string_length, - tdbb->getAttachment()->att_charset); + dsql_nod* node = parser.parse(); - dsql_nod* node = parser.parse(); - Firebird::string transformedText = parser.getTransformedString(); - SSHORT charSetId = database->dbb_attachment->att_charset; - - // If the attachment charset is NONE, replace non-ASCII characters by question marks, so that - // engine internals doesn't receive non-mappeable data to UTF8. If an attachment charset is - // used, validate the string. - if (charSetId == CS_NONE) - { - for (char* p = transformedText.begin(), *end = transformedText.end(); p < end; ++p) + if (!node) { - if (UCHAR(*p) > 0x7F) - *p = '?'; + // CVC: Apparently, Parser::parse won't return if the command is incomplete, + // because yyerror() will call ERRD_post(). + // This may be a special case, but we don't know about positions here. + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + // Unexpected end of command + Arg::Gds(isc_command_end_err)); } - } - else - { - CharSet* charSet = INTL_charset_lookup(tdbb, charSetId); - if (!charSet->wellFormed(transformedText.length(), (const UCHAR*) transformedText.begin(), NULL)) + string transformedText = parser.getTransformedString(); + SSHORT charSetId = database->dbb_attachment->att_charset; + + // If the attachment charset is NONE, replace non-ASCII characters by question marks, so + // that engine internals doesn't receive non-mappeable data to UTF8. If an attachment + // charset is used, validate the string. + if (charSetId == CS_NONE) { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << - Arg::Gds(isc_malformed_string)); + for (char* p = transformedText.begin(), *end = transformedText.end(); p < end; ++p) + { + if (UCHAR(*p) > 0x7F) + *p = '?'; + } } + else + { + CharSet* charSet = INTL_charset_lookup(tdbb, charSetId); - UCharBuffer temp; + if (!charSet->wellFormed(transformedText.length(), + (const UCHAR*) transformedText.begin(), NULL)) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << + Arg::Gds(isc_malformed_string)); + } - CsConvert conversor(charSet->getStruct(), - INTL_charset_lookup(tdbb, CS_METADATA)->getStruct()); - conversor.convert(transformedText.length(), (const UCHAR*) transformedText.c_str(), temp); + UCharBuffer temp; - transformedText.assign(temp.begin(), temp.getCount()); - } + CsConvert conversor(charSet->getStruct(), + INTL_charset_lookup(tdbb, CS_METADATA)->getStruct()); + conversor.convert(transformedText.length(), (const UCHAR*) transformedText.c_str(), temp); - statement->setSqlText(FB_NEW(pool) RefString(pool, transformedText)); + transformedText.assign(temp.begin(), temp.getCount()); + } - if (!node) - { - // CVC: Apparently, Parser::parse won't return if the command is incomplete, - // because yyerror() will call ERRD_post(). - // This may be a special case, but we don't know about positions here. - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << - // Unexpected end of command - Arg::Gds(isc_command_end_err)); - } + statement->setSqlText(FB_NEW(pool) RefString(pool, transformedText)); - // allocate the send and receive messages + // allocate the send and receive messages - statement->setSendMsg(FB_NEW(pool) dsql_msg(pool)); - dsql_msg* message = FB_NEW(pool) dsql_msg(pool); - statement->setReceiveMsg(message); - message->msg_number = 1; + statement->setSendMsg(FB_NEW(pool) dsql_msg(pool)); + dsql_msg* message = FB_NEW(pool) dsql_msg(pool); + statement->setReceiveMsg(message); + message->msg_number = 1; - statement->setType(DsqlCompiledStatement::TYPE_SELECT); + statement->setType(DsqlCompiledStatement::TYPE_SELECT); - node = PASS1_statement(scratch, node); - fb_assert(node); + node = PASS1_statement(scratch, node); + fb_assert(node); - const DsqlCompiledStatement::Type statementType = statement->getType(); + const DsqlCompiledStatement::Type statementType = statement->getType(); - switch (statementType) - { - case DsqlCompiledStatement::TYPE_COMMIT: - case DsqlCompiledStatement::TYPE_COMMIT_RETAIN: - case DsqlCompiledStatement::TYPE_ROLLBACK: - case DsqlCompiledStatement::TYPE_ROLLBACK_RETAIN: - case DsqlCompiledStatement::TYPE_START_TRANS: - request = FB_NEW(statement->getPool()) DsqlTransactionRequest(scratch); - request->req_traced = false; - trace.setStatement(request); - return request; // Stop here for statements not requiring code generation. + switch (statementType) + { + case DsqlCompiledStatement::TYPE_COMMIT: + case DsqlCompiledStatement::TYPE_COMMIT_RETAIN: + case DsqlCompiledStatement::TYPE_ROLLBACK: + case DsqlCompiledStatement::TYPE_ROLLBACK_RETAIN: + case DsqlCompiledStatement::TYPE_START_TRANS: + request = FB_NEW(statement->getPool()) DsqlTransactionRequest(scratch); + request->req_traced = false; + trace.setStatement(request); + return request; // Stop here for statements not requiring code generation. - case DsqlCompiledStatement::TYPE_CREATE_DB: - case DsqlCompiledStatement::TYPE_DDL: - request = FB_NEW(statement->getPool()) DsqlDdlRequest(scratch); - break; + case DsqlCompiledStatement::TYPE_CREATE_DB: + case DsqlCompiledStatement::TYPE_DDL: + request = FB_NEW(statement->getPool()) DsqlDdlRequest(scratch); + break; - default: - request = FB_NEW(statement->getPool()) DsqlDmlRequest(scratch); - break; - } + default: + request = FB_NEW(statement->getPool()) DsqlDmlRequest(scratch); + break; + } - request->req_traced = true; - trace.setStatement(request); + request->req_traced = true; + trace.setStatement(request); - if (statementType == DsqlCompiledStatement::TYPE_DDL) - { - if (parser.isStmtAmbiguous() && - scratch->getAttachment()->dbb_db_SQL_dialect != client_dialect) + if (statementType == DsqlCompiledStatement::TYPE_DDL) { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-817) << - Arg::Gds(isc_ddl_not_allowed_by_db_sql_dial) << - Arg::Num(scratch->getAttachment()->dbb_db_SQL_dialect)); + if (parser.isStmtAmbiguous() && + scratch->getAttachment()->dbb_db_SQL_dialect != clientDialect) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-817) << + Arg::Gds(isc_ddl_not_allowed_by_db_sql_dial) << + Arg::Num(scratch->getAttachment()->dbb_db_SQL_dialect)); + } + + statement->setDdlScratch(scratch); } - statement->setDdlScratch(scratch); - } + if (clientDialect > SQL_DIALECT_V5) + statement->addFlags(DsqlCompiledStatement::FLAG_BLR_VERSION5); + else + statement->addFlags(DsqlCompiledStatement::FLAG_BLR_VERSION4); - if (client_dialect > SQL_DIALECT_V5) - statement->addFlags(DsqlCompiledStatement::FLAG_BLR_VERSION5); - else - statement->addFlags(DsqlCompiledStatement::FLAG_BLR_VERSION4); + GEN_request(scratch, node); - GEN_request(scratch, node); + // Create the messages buffers + for (size_t i = 0; i < scratch->ports.getCount(); ++i) + { + dsql_msg* message = scratch->ports[i]; - // Create the messages buffers - for (size_t i = 0; i < scratch->ports.getCount(); ++i) - { - dsql_msg* message = scratch->ports[i]; + // Allocate buffer for message + const ULONG newLen = message->msg_length + FB_DOUBLE_ALIGN - 1; - // Allocate buffer for message - const ULONG newLen = message->msg_length + FB_DOUBLE_ALIGN - 1; + message->msg_buffer_number = request->req_msg_buffers.getCount(); + request->req_msg_buffers.grow(message->msg_buffer_number + 1); - message->msg_buffer_number = request->req_msg_buffers.getCount(); - request->req_msg_buffers.grow(message->msg_buffer_number + 1); + UCHAR*& msgBuffer = request->req_msg_buffers[message->msg_buffer_number]; + fb_assert(!msgBuffer); - UCHAR*& msgBuffer = request->req_msg_buffers[message->msg_buffer_number]; - fb_assert(!msgBuffer); + msgBuffer = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newLen]; + msgBuffer = (UCHAR*) FB_ALIGN((U_IPTR) msgBuffer, FB_DOUBLE_ALIGN); + } - msgBuffer = FB_NEW(*tdbb->getDefaultPool()) UCHAR[newLen]; - msgBuffer = (UCHAR*) FB_ALIGN((U_IPTR) msgBuffer, FB_DOUBLE_ALIGN); - } + // stop here for ddl statements - // stop here for ddl statements + if (statementType == DsqlCompiledStatement::TYPE_CREATE_DB || + statementType == DsqlCompiledStatement::TYPE_DDL) + { + // Notify Trace API manager about new DDL request cooked. + trace.prepare(res_successful); + return request; + } - if (statementType == DsqlCompiledStatement::TYPE_CREATE_DB || - statementType == DsqlCompiledStatement::TYPE_DDL) - { - // Notify Trace API manager about new DDL request cooked. - trace.prepare(res_successful); - return request; - } + // have the access method compile the statement - // have the access method compile the statement - #ifdef DSQL_DEBUG - if (DSQL_debug & 64) - { - dsql_trace("Resulting BLR code for DSQL:"); - gds__trace_raw("Statement:\n"); - gds__trace_raw(string, string_length); - gds__trace_raw("\nBLR:\n"); - fb_print_blr(scratch->getBlrData().begin(), - (ULONG) scratch->getBlrData().getCount(), - gds__trace_printer, 0, 0); - } + if (DSQL_debug & 64) + { + dsql_trace("Resulting BLR code for DSQL:"); + gds__trace_raw("Statement:\n"); + gds__trace_raw(text, textLength); + gds__trace_raw("\nBLR:\n"); + fb_print_blr(scratch->getBlrData().begin(), + (ULONG) scratch->getBlrData().getCount(), + gds__trace_printer, 0, 0); + } #endif - // check for warnings - if (tdbb->tdbb_status_vector[2] == isc_arg_warning) - { - // save a status vector - memcpy(local_status, tdbb->tdbb_status_vector, sizeof(ISC_STATUS_ARRAY)); - } + ISC_STATUS_ARRAY localStatus; + MOVE_CLEAR(localStatus, sizeof(localStatus)); - ISC_STATUS status = FB_SUCCESS; + // check for warnings + if (tdbb->tdbb_status_vector[2] == isc_arg_warning) + { + // save a status vector + memcpy(localStatus, tdbb->tdbb_status_vector, sizeof(ISC_STATUS_ARRAY)); + } - try - { - JRD_compile(tdbb, - scratch->getAttachment()->dbb_attachment, - &request->req_request, - scratch->getBlrData().getCount(), - scratch->getBlrData().begin(), - statement->getSqlText(), - scratch->getDebugData().getCount(), - scratch->getDebugData().begin(), - isInternalRequest); - } - catch (const Firebird::Exception&) - { - status = tdbb->tdbb_status_vector[1]; - trace.prepare(status == isc_no_priv ? res_unauthorized : res_failed); - } + ISC_STATUS status = FB_SUCCESS; - // restore warnings (if there are any) - if (local_status[2] == isc_arg_warning) - { - size_t indx, len, warning; + try + { + JRD_compile(tdbb, + scratch->getAttachment()->dbb_attachment, + &request->req_request, + scratch->getBlrData().getCount(), + scratch->getBlrData().begin(), + statement->getSqlText(), + scratch->getDebugData().getCount(), + scratch->getDebugData().begin(), + isInternalRequest); + } + catch (const Firebird::Exception&) + { + status = tdbb->tdbb_status_vector[1]; + trace.prepare(status == isc_no_priv ? res_unauthorized : res_failed); + } - // find end of a status vector - PARSE_STATUS(tdbb->tdbb_status_vector, indx, warning); - if (indx) - --indx; + // restore warnings (if there are any) + if (localStatus[2] == isc_arg_warning) + { + size_t indx, len, warning; - // calculate length of saved warnings - PARSE_STATUS(local_status, len, warning); - len -= 2; + // find end of a status vector + PARSE_STATUS(tdbb->tdbb_status_vector, indx, warning); + if (indx) + --indx; - if ((len + indx - 1) < ISC_STATUS_LENGTH) - memcpy(&tdbb->tdbb_status_vector[indx], &local_status[2], sizeof(ISC_STATUS) * len); - } + // calculate length of saved warnings + PARSE_STATUS(localStatus, len, warning); + len -= 2; - // free blr memory - scratch->getBlrData().free(); + if ((len + indx - 1) < ISC_STATUS_LENGTH) + memcpy(&tdbb->tdbb_status_vector[indx], &localStatus[2], sizeof(ISC_STATUS) * len); + } - if (status) - Firebird::status_exception::raise(tdbb->tdbb_status_vector); + // free blr memory + scratch->getBlrData().free(); - // Notify Trace API manager about new request cooked. - trace.prepare(res_successful); + if (status) + Firebird::status_exception::raise(tdbb->tdbb_status_vector); - return request; + // Notify Trace API manager about new request cooked. + trace.prepare(res_successful); + return request; } catch (const Firebird::Exception&) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2012-03-26 09:01:59
|
Revision: 54247 http://firebird.svn.sourceforge.net/firebird/?rev=54247&view=rev Author: alexpeshkoff Date: 2012-03-26 09:01:48 +0000 (Mon, 26 Mar 2012) Log Message: ----------- Correction - thanks to Claudio Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2012-03-26 08:19:13 UTC (rev 54246) +++ firebird/trunk/src/dsql/dsql.cpp 2012-03-26 09:01:48 UTC (rev 54247) @@ -1861,7 +1861,7 @@ } string utf; - return DataTypeUtil::convertToUTF8(s, utf) ? utf : s; + return DataTypeUtil::convertToUTF8(s, utf, id) ? utf : s; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2012-03-29 13:56:31
|
Revision: 54280 http://firebird.svn.sourceforge.net/firebird/?rev=54280&view=rev Author: hvlad Date: 2012-03-29 13:56:21 +0000 (Thu, 29 Mar 2012) Log Message: ----------- Fixed bug CORE-3801 : Warnings could be put twice in status-vector Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2012-03-29 13:53:21 UTC (rev 54279) +++ firebird/trunk/src/dsql/dsql.cpp 2012-03-29 13:56:21 UTC (rev 54280) @@ -760,6 +760,7 @@ { // save a status vector memcpy(localStatus, tdbb->tdbb_status_vector, sizeof(ISC_STATUS_ARRAY)); + fb_utils::init_status(tdbb->tdbb_status_vector); } ISC_STATUS status = FB_SUCCESS; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2012-08-10 15:40:34
|
Revision: 57023 http://firebird.svn.sourceforge.net/firebird/?rev=57023&view=rev Author: asfernandes Date: 2012-08-10 15:40:27 +0000 (Fri, 10 Aug 2012) Log Message: ----------- Fix segfault while checking for trace of failed statement compilation. (happens with CORE-3794 testcase) Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2012-08-09 20:01:59 UTC (rev 57022) +++ firebird/trunk/src/dsql/dsql.cpp 2012-08-10 15:40:27 UTC (rev 57023) @@ -1595,6 +1595,10 @@ request = parser.parse(); + request->req_dbb = scratch->getAttachment(); + request->req_transaction = scratch->getTransaction(); + request->statement = scratch->getStatement(); + if (parser.isStmtAmbiguous()) scratch->flags |= DsqlCompilerScratch::FLAG_AMBIGUOUS_STMT; @@ -1649,10 +1653,6 @@ ntrace_result_t traceResult = res_successful; try { - request->req_dbb = scratch->getAttachment(); - request->req_transaction = scratch->getTransaction(); - request->statement = scratch->getStatement(); - request->dsqlPass(tdbb, scratch, &traceResult); } catch (const Exception&) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2013-01-24 16:52:16
|
Revision: 57620 http://sourceforge.net/p/firebird/code/57620 Author: dimitr Date: 2013-01-24 16:52:13 +0000 (Thu, 24 Jan 2013) Log Message: ----------- Slightly improved the condition for the Adriano's backward compatibility workaround, this optimizes METD_move() into a plain memcpy() for strings with an explicitly declared charset. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2013-01-24 16:47:03 UTC (rev 57619) +++ firebird/trunk/src/dsql/dsql.cpp 2013-01-24 16:52:13 UTC (rev 57620) @@ -281,7 +281,7 @@ return 100; } - map_in_out(this, true, message, 0, blr, msgLength, msgBuffer); + map_in_out(this, true, message, 0, NULL, msgLength, msgBuffer); trace.fetch(false, res_successful); return FB_SUCCESS; @@ -859,7 +859,7 @@ JRD_receive(tdbb, req_request, message->msg_number, message->msg_length, msgBuffer); if (outMsgLength) - map_in_out(this, true, message, 0, outBlr, outMsgLength, outMsg); + map_in_out(this, true, message, 0, NULL, outMsgLength, outMsg); // if this is a singleton select, make sure there's in fact one record @@ -1484,7 +1484,7 @@ // blr_text/blr_varying (i.e. with the connection charset). I'm reseting the charset // here at the server as a way to make older (and not yet changed) client work // correctly. - if (desc.isText()) + if (desc.isText() && desc.getTextType() == ttype_dynamic) desc.setTextType(ttype_none); request->req_user_descs.put(parameter, desc); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2013-02-08 01:50:45
|
Revision: 57647 http://sourceforge.net/p/firebird/code/57647 Author: asfernandes Date: 2013-02-08 01:50:37 +0000 (Fri, 08 Feb 2013) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2013-02-08 01:48:49 UTC (rev 57646) +++ firebird/trunk/src/dsql/dsql.cpp 2013-02-08 01:50:37 UTC (rev 57647) @@ -1273,7 +1273,7 @@ @param parameters **/ -static USHORT parse_blr(dsql_req* request, ULONG blr_length, const UCHAR* const blr, +static USHORT parse_blr(dsql_req* request, ULONG blr_length, const UCHAR* blr, const ULONG msg_length, const Array<dsql_par*>& parameters_list) { HalfStaticArray<const dsql_par*, 16> parameters; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2013-03-25 01:25:04
|
Revision: 57830 http://sourceforge.net/p/firebird/code/57830 Author: asfernandes Date: 2013-03-25 01:25:01 +0000 (Mon, 25 Mar 2013) Log Message: ----------- Fixed problem reported in fb-devel: FB3 and SQL_NULL. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2013-03-24 16:16:29 UTC (rev 57829) +++ firebird/trunk/src/dsql/dsql.cpp 2013-03-25 01:25:01 UTC (rev 57830) @@ -1988,7 +1988,8 @@ SLONG sql_len, sql_sub_type, sql_scale, sql_type; param->par_desc.getSqlInfo(&sql_len, &sql_sub_type, &sql_scale, &sql_type); - if (input_message && param->par_desc.dsc_dtype == dtype_text && + if (input_message && + (param->par_desc.dsc_dtype == dtype_text || param->par_is_text) && (param->par_desc.dsc_flags & DSC_null)) { sql_type = SQL_NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2013-03-29 23:25:45
|
Revision: 57870 http://sourceforge.net/p/firebird/code/57870 Author: asfernandes Date: 2013-03-29 23:25:43 +0000 (Fri, 29 Mar 2013) Log Message: ----------- Make it work as before, although I think openCursor should fail with DDL statements. Please check CursorTest.cpp (ddlFetch) in fbstuff. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2013-03-29 23:25:28 UTC (rev 57869) +++ firebird/trunk/src/dsql/dsql.cpp 2013-03-29 23:25:43 UTC (rev 57870) @@ -201,7 +201,7 @@ } else { - fb_assert(!flOpenCursor); + ///fb_assert(!flOpenCursor); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2014-08-06 13:46:31
|
Revision: 59959 http://sourceforge.net/p/firebird/code/59959 Author: alexpeshkoff Date: 2014-08-06 13:46:26 +0000 (Wed, 06 Aug 2014) Log Message: ----------- Restored a check dropped accidentially by one of my recent commits Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2014-08-06 08:55:47 UTC (rev 59958) +++ firebird/trunk/src/dsql/dsql.cpp 2014-08-06 13:46:26 UTC (rev 59959) @@ -426,7 +426,7 @@ const size_t MAX_CURSOR_LENGTH = 132 - 1; string cursor = name; - if (cursor[0] == '\"') + if (cursor.hasData() && cursor[0] == '\"') { // Quoted cursor names eh? Strip'em. // Note that "" will be replaced with ". This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-05-13 13:24:36
|
Revision: 61534 http://sourceforge.net/p/firebird/code/61534 Author: alexpeshkoff Date: 2015-05-13 13:24:33 +0000 (Wed, 13 May 2015) Log Message: ----------- Fixed CORE-4785: Bad packet of op_execute kills the server Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-05-13 00:14:28 UTC (rev 61533) +++ firebird/trunk/src/dsql/dsql.cpp 2015-05-13 13:24:33 UTC (rev 61534) @@ -80,7 +80,7 @@ static ULONG get_request_info(thread_db*, dsql_req*, ULONG, UCHAR*); static dsql_dbb* init(Jrd::thread_db*, Jrd::Attachment*); -static void map_in_out(dsql_req*, bool, const dsql_msg*, IMessageMetadata*, UCHAR*, +static void map_in_out(Jrd::thread_db*, dsql_req*, bool, const dsql_msg*, IMessageMetadata*, UCHAR*, const UCHAR* = NULL); static USHORT parse_metadata(dsql_req*, IMessageMetadata*, const Array<dsql_par*>&); static dsql_req* prepareRequest(thread_db*, dsql_dbb*, jrd_tra*, ULONG, const TEXT*, USHORT, bool); @@ -283,7 +283,7 @@ return false; } - map_in_out(this, true, message, delayedFormat, msgBuffer); + map_in_out(tdbb, this, true, message, delayedFormat, msgBuffer); delayedFormat = NULL; trace.fetch(false, ITracePlugin::RESULT_SUCCESS); @@ -654,7 +654,7 @@ const dsql_msg* message = statement->getSendMsg(); if (message) - map_in_out(this, false, message, inMetadata, NULL, inMsg); + map_in_out(tdbb, this, false, message, inMetadata, NULL, inMsg); // we need to map_in_out before tracing of execution start to let trace // manager know statement parameters values @@ -714,7 +714,7 @@ JRD_receive(tdbb, req_request, message->msg_number, message->msg_length, msgBuffer); if (outMsg) - map_in_out(this, true, message, NULL, outMsg); + map_in_out(tdbb, this, true, message, NULL, outMsg); // if this is a singleton select, make sure there's in fact one record @@ -981,13 +981,23 @@ @param in_dsql_msg_buf **/ -static void map_in_out(dsql_req* request, bool toExternal, const dsql_msg* message, +static void map_in_out(thread_db* tdbb, dsql_req* request, bool toExternal, const dsql_msg* message, IMessageMetadata* meta, UCHAR* dsql_msg_buf, const UCHAR* in_dsql_msg_buf) { - thread_db* tdbb = JRD_get_thread_data(); - USHORT count = parse_metadata(request, meta, message->msg_parameters); + // Sanity check + + if (count && !(request ? in_dsql_msg_buf : dsql_msg_buf)) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << + Arg::Gds(isc_dsql_sqlda_err) +#ifdef DEV_BUILD + << Arg::Gds(isc_random) << "Missing message data buffer" +#endif + ); + } + bool err = false; for (FB_SIZE_T i = 0; i < message->msg_parameters.getCount(); ++i) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-05-14 10:04:29
|
Revision: 61541 http://sourceforge.net/p/firebird/code/61541 Author: alexpeshkoff Date: 2015-05-14 10:04:26 +0000 (Thu, 14 May 2015) Log Message: ----------- Postfix for CORE-4785 Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-05-14 00:14:45 UTC (rev 61540) +++ firebird/trunk/src/dsql/dsql.cpp 2015-05-14 10:04:26 UTC (rev 61541) @@ -988,7 +988,7 @@ // Sanity check - if (count && !(request ? in_dsql_msg_buf : dsql_msg_buf)) + if (count && !(toExternal ? dsql_msg_buf : in_dsql_msg_buf)) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << Arg::Gds(isc_dsql_sqlda_err) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2015-11-17 11:46:24
|
Revision: 62574 http://sourceforge.net/p/firebird/code/62574 Author: dimitr Date: 2015-11-17 11:46:21 +0000 (Tue, 17 Nov 2015) Log Message: ----------- FB3 seems to be properly protected from CORE-4983 at the y-valve level, but I'm adding an additional protection for the engine anyway (call me paranoid). Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-11-17 11:37:54 UTC (rev 62573) +++ firebird/trunk/src/dsql/dsql.cpp 2015-11-17 11:46:21 UTC (rev 62574) @@ -264,6 +264,12 @@ } } + if (!req_request) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << + Arg::Gds(isc_unprepared_stmt)); + } + dsql_msg* message = (dsql_msg*) statement->getReceiveMsg(); // Set up things for tracing this call @@ -650,6 +656,12 @@ Firebird::IMessageMetadata* outMetadata, UCHAR* outMsg, bool singleton) { + if (!req_request) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-504) << + Arg::Gds(isc_unprepared_stmt)); + } + // If there is no data required, just start the request const dsql_msg* message = statement->getSendMsg(); @@ -672,10 +684,7 @@ // Selectable execute block should get the "proc fetch" flag assigned, // which ensures that the savepoint stack is preserved while suspending if (statement->getType() == DsqlCompiledStatement::TYPE_SELECT_BLOCK) - { - fb_assert(req_request); req_request->req_flags |= req_proc_fetch; - } // TYPE_EXEC_BLOCK has no outputs so there are no out_msg // supplied from client side, but TYPE_EXEC_BLOCK requires This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |