summaryrefslogtreecommitdiff
path: root/statement.c
AgeCommit message (Collapse)Author
2014-02-22Change to supply non-NULL parameters for SC_set_error().Hiroshi Inoue
2014-02-22It's safe to lock SC_set_prepared() itself.Hiroshi Inoue
2014-02-20The 2dn argument of SC_set_prepared() is int(enum) not BOOL.Hiroshi Inoue
2013-11-08Suppress compiler warnings.Hiroshi Inoue
2013-09-02Don't issue a BEGIN when running VACUUM in auto-commit mode.Heikki Linnakangas
Normally in auto-commit mode the driver begins a new transaction implicitly at the first statement, by sending a BEGIN statement. However, some commands, like VACUUM, cannot be run in a transaction block, and you will get an error like "VACUUM cannot run inside a transaction block" from the server. In UseServerSidePrepare=0 mode, the code looks at the first word of the query to determine if the statement is one of the special ones, and if so, didn't begin a new transaction even when auto-commit mode is disabled. However, in UseServerSidePrepare=1 mode, when using SQLPrepare/ SQLExecute to run the VACUUM, that check was not made. Fix that. There was one more related inconsistency between UseServerSidePrepare modes. Without server-side-prepares, if you issued an explicit BEGIN in auto-commit mode, the implicit BEGIN was ont sent. But without server-side prepares, it was. It seems best to send the implicit BEGIN in both cases, because then you get a warning from the backend about the second BEGIN. That's a good thing, because a sane ODBC application should be using the ODBC function SQLEndTran() for transaction control, not explicit BEGIN/COMMIT. Also add a test case for executing VACUUM, with and without autocommit.
2013-09-02Remove useless 'sync' parameter from prepareParameters() function.Heikki Linnakangas
It was always passed as TRUE.
2013-07-10Revise MSDTC support.Hiroshi Inoue
1. Remove pointlessly complicated AsyncThreads stuff. Instead use _beginthread() to clean up threads. 2. Make pgenlist.dll from the structure change of ConnectionClass. The driver dlls exports the functions described in connexp.h which are used by pgenlist.dll. 3. Isolate the current communication path if necessary. While an IAsyncPG object is alive, a ConnectionClass object (hereinafter refered to as conn-obj) is assigned to it. The assignment has to be changed in the following cases. a) SQLDisconnect() is called for the current connection handle which is assigned to an IAsyncPG object. Allocate another conn-obj and move the current communication path (*sock* member of the current conn-obj) to the new conn-obj. The communicaation path is lost from the current conn-obj and the new conn-obj is assigned to the IAsyncPG object. b) Another (global) transaction is about to begin but the current global transaction is not PREPARED yet. Same as case a) but will open a new communication path for the current conn-obj for the subsequent ODBC API calls. c) Another (global) transaction is about to begin and the current global transaction is already PREPARED. Allocate another conn-obj and open a new communication path for the conn-obj. The new conn-obj is assigned to the IAsyncPG object only to issue COMMIT/ROLLBACK PREPARED command. communication pass (*sock* member of the current ConnectionClass object) to the new object and change the state of the current object NOT CONNECTED. The IAsyncPG object uses new object instead of the current object. In case b) the current object will open a new communication path.
2013-05-25Fix the *cursor XXXXXXXX already exists* error when handling *with cte* ↵Hiroshi Inoue
statements reported by Joe Conway.
2013-05-14Fix a problem reported by Jack Wilson(ljwilson@digitalav.com).Hiroshi Inoue
When DeUseDeclareFetch=1 and UseServerSidePrepare=1, issue COMMIT commands properly in case of AUTOCOMMIT on mode,
2013-04-24Fix bug with VARCHAR(5) parameter and UseServerSidePrepare=0Heikki Linnakangas
If you passed a VARCHAR parameter with column_size 5 to SQLPrepare, and you had UseServerSideprepare=0 and BoolsAsChar=1, the code describes the parameters before running the query, so that it can check if the parameter is a boolean. That produced a bogus extra empty result set to the caller in subsequent SQLExecute(). This fixes the two regression test failures. Patch by Hiroshi Inoue, with minor copy-editing by me.
2013-04-18Avoid multiple evaluation in some macros.Heikki Linnakangas
There was at least one real bug caused by the multiple evaluation of 2nd argument to SC_set_result(). SC_pre_execute() passed QR_Constructor() call as the 2nd argument, so we ended up creating extra result sets that were leaked.
2013-04-18Format if-statement with commented out "then"-block differently.Heikki Linnakangas
To silence a Coverity warning that the semicolon might be misplaced.
2013-04-18Mark these two structs as const.Heikki Linnakangas
It's a good habit to mark constants as such. But I'm also hoping that this would silence Coverity from complaining that ver2str and ver3str might not fit in 6 bytes.
2013-04-18Initialize field to silence a Coverity false positive.Heikki Linnakangas
Coverity doesn't like the fact that the struct is passed to SC_set_rowset_start without initializing rowset_start field. It's OK, SC_set_rowset_start doesn't actually use the 'incr' value calculated from the field if the 3rd arg is FALSE, so this is a false positive, but seems like a good idea to be tidy here anyway.
2013-04-18Add NULL-check, to silence a Coverity problem.Heikki Linnakangas
The problem is that if the loop above doesn't find a result set with command tag "FETCH ...", res is left to point to an already-freed result set, and we'll go ahead and call QR_set_withhold on the already-freed struct. That can't happen in practice, because the backend does always return a result set with "FETCH ..." command tag when a FETCH statement is issued, but better safe than sorry.
2013-04-18Silence compiler warnings about unused msg_truncated variables.Heikki Linnakangas
BTW, the error and notice handling could be made much smarter wrt. truncation. The caller of handle_notice/error_message knows the message size in advance, so it could easily pass it down and we could allocate a buffer of the right size, instead of using a fixed size buffer that can be too small.
2013-04-18Add parens, per compiler warning's suggestion.Heikki Linnakangas
2013-04-18Silence compiler warnings about variables set but not used.Heikki Linnakangas
2013-04-18Fix references to 'notice.txt'.Heikki Linnakangas
notice.txt doesn't exist anymore, the copyright and license information is in readme.txt now. Update references in comments.
2012-05-11Fix a compilation error etc when MULTITHREAD support is disabled.Hiroshi Inoue
2011-11-11Before dropping the statement, sync and discard the response from the server ↵Hiroshi Inoue
for the pending extended query.
2011-11-11Adjust the operations after closing eof-detected cursors.Hiroshi Inoue
2011-11-10Fix the bug that the first fetch operation doesn't work properly whenHiroshi Inoue
the operation is SQL_FETCH_ABSOLUTE or SQL_FETCH_LAST.
2011-06-11Don't clear the parsed plan in SC_recycle_statement().Hiroshi Inoue
2010-12-09Change to read and skip the rest of result data when out of memory occurs ↵Hiroshi Inoue
while reading tuples so that we can continue to use the connection.
2010-11-20Divide SC_returns_rows() macro into several categories and make ↵Hiroshi Inoue
SQLResultNumCols(), SQLDescribeCol() or SQLColAttribute() available for insert/update/delete .. returning statements.
2010-11-10Fix the bug introduced by the previous change reprted by Adrien de Croy.Hiroshi Inoue
2010-11-08Don't propgate the connection level statment options to the internal statements.Hiroshi Inoue
This fixes an infinite loop reported by Nelson Andre.
2010-10-23Fix a bug about the handling of the SQL_RETRIEVE_DATA option.Hiroshi Inoue
I hope this would fix a bug report by Andreas(maps.on@gmx.net).
2010-09-09Correct the handling of dynamic cursors so that they are substituted by ↵Hiroshi Inoue
keyset-driven ones. This fixs the bug report by Werner Kuhnle.
2010-08-211.Introduce pgtype_attr_xxxx functions which take a typmod parameter as well ↵Hiroshi Inoue
as a type oid parameter as an extension of pgtype_xxxx functions so that SQLColumns and SQLDescribeCol(SQLColAttrinute) could use common functions. 2.Call PQconnectdbParams instead of PQconnectdb when it's available. 3.Make cursor open check at transaction end a little more effective. 4.Added code for SQL_INTERVAL support and refcursor support though they are disabled.
2010-06-211.Improve the handling of bools_as_char case.Hiroshi Inoue
2.Fix a bug when creating a connection string.
2010-05-261. Use poll() instead of select() when it's available.Hiroshi Inoue
2. Take comments or line comments in a query into account. 3. Fix a crash bug on authentication failures.
2010-01-171) Allow password which contains special characters like {,},=,;.Hiroshi Inoue
2) Add a new data source option which makes it possible to use Kerberos for Windows library to reply to GSSAPI authentication request. 3) Native support for SSPI Kerberos or Negaotiate service. It may be useful for the 64-bit drivers. 4) Fix an oversight of Memory overflow handling.
2009-10-25Cleanups about the handing of unnamed parsed statements and the handlingHiroshi Inoue
of ODBC escape { .
2009-10-251. Take WITH cte staments into account.Hiroshi Inoue
2. Fix a bug about UTF8 handling. 3. Wait a ReadyForQuery Message after errors correctly.
2009-08-27Changes for 8.4.0101.Hiroshi Inoue
1.Fix a column uodatability problem reported by Tom Goodman. 2.Display SSL mode list properly on setup dialog. 3.Don't truncate the result of msgtowstr()/wstrtomsg(). 4.Implement ConfigDriver() function.
2009-04-241. Remove the implicit sslverify option and add 'verify-ca' and 'verify-full'Hiroshi Inoue
to the sslmode option. 2. Take the platforms where char is unsigned into account per report from Alex Goncharov.
2009-04-04Improve the transactional control under useDeclareFetch mode.Hiroshi Inoue
2009-03-20The version is now 8.03.0402.Hiroshi Inoue
1. Close (holdable) cursors on commit if possible. 2. Recycle columns cache info if the size becomes pretty large. 3. Add sslverify=none to conninfo in case of SSL connections via libpq of version 8.4. 4. Add a functionality to change the directory for logging. 5. Correct the error code for communication errors.
2009-01-181) Fix a bug reported by Milen Manev that SQLExec *select for a table* -> ↵Hiroshi Inoue
SQLDescribeCol() -> add a column to the table -> SQLExec *select for the table* -> SQLDescribeCol() for the added column causes a bad result. 2) Use strncpy_null() instead of strncpy().
2008-09-211. Support FE/BE communications on Big Endian platform.Hiroshi Inoue
2. Check strerror_r function's return type. 3. Suppress some compiler warnings.
2008-08-09Fix some bugs.Hiroshi Inoue
1. Reset the column binding information after SQLMoreResults(). 2. Save the rowset size properly for the FETCH_NEXT operation in case of >= 3.0 drivers. Enable geqo optiomizer by default.
2008-07-04The version is now 8.3.0201.Hiroshi Inoue
1. SQLGUID type support thanks to Jan-Willem Goossens. 2. Fix a bug about silently adding a *for read only* clause. 3. Fix a 64bit mode bug about handling of arrays of parameters. 4. Change the implemetatin of SQLForeignKeys() for 8.3+ servers. 5. Not commit the transaction too early in useDeclareFetch mode. 6. Add a cursor open check for SQLPrepare().
2008-05-031. Fix a bug in socket which uses a socket variable.Hiroshi Inoue
2. Support column alias without "as" so that links from the SQLServer work. 3. Take ';' into account when the driver adds "for read only" clause. 4. Use the E'.. ' notation not only in '=' expressions but also in LIKE expressions. 5. Change to return milliseconds parts for timestamp fields. 6. Change to return a specific sqlstate in case of multiple parameters.
2007-12-26*** empty log message ***Hiroshi Inoue
2007-10-27The version is now 8.2.0501.Hiroshi Inoue
1. Correct the COLUMN_LENGTH return value of SQLColumns() for varchar/bpchar type columns (Unicode driver). 2. Change to not return database name if case of MS Query. 3. The first cut to use Windows SSPI. The trial to use Schannel service for SSL support. 4. Be more careful about <for locking clause> in UseDeclareFetch mode. Add missing? "for read only" clause for read only queries for 8.3 or later servers for safety.
2007-08-31The version is now 8.2.0403.Hiroshi Inoue
1. Support SQLColAttribute for MS specific SQL_CA_SS_COLUMN_KEY. Some MS applications use this. 2. Improve the check of updatability of queries by checking if they have multiple tables. 3. Reduce the round trip overhead in FE/BE communications (especially in useDeclareFetch mode). 4. Fix a bug in ResolveOneParam() pointed out by Rainer Bauer. 5. Add a flag which lets SQLTables() show only accessible tables. 6. The unicode driver now can handle utf-16 surrogate pairs.
2007-06-02The version is now 8.2.0402.Hiroshi Inoue
. Fix some bugs in case without MSDTC support. . Refine the realloc handling. . Put back the @@IDENTITY implementation so as not to use lastval(). . Change SQLColumns() to return correct column length in the Unicode driver. . Remove the connection count limitation. . Fix Protocol=7.4--1 notation (should be Protocol=7.4). . Fix a typo in socket.c (bug report from Rainer bauer).
2007-04-03The version is now 8.2.0205.Hiroshi Inoue
. Append DETAIL messages to GetDiag...() messages. . Use SQL_SUCCEEDED macros so as to simplify the code. . Use lastval() function to replace IDENTITY on 8.1 or later servers. . Remove WSAStartup() and WSACleanup() from DllMain. . Load libpq from the driver's folder. . Use QR_get_value_backend_int/_text() funcs instead of QR_get_value_backend_row(). . Improve the implemetation of SQLSetPos(.., SQL_ADD/SQL_UPDATE) using the 8.2 new feature INSERT/UPDATE .. returning . . Seaparate DTC code as a Delayload DLL.