DBI::Changes - Log of significant changes to the DBI
I'll be building this list shortly. Make ODBC version 3.0 default! Add array parameter binding (per new DBI Spec) Add row caching/multiple row fetches to speed selects Better/more tests on multiple statement handles which ensure the correct number of rows Better/more tests on all queries which ensure the correct number of rows Better tests on SQLExecDirect/do Change default behaviour to use SQLDescribeParam instead of SQL_VARCHAR. Keep checking Oracle's ODBC drivers for Windows to fix the Date binding problem
See DBD::ODBC POD for more detail.
Changes to internal timestamp type handling and test structure to ensure tests work for all platforms. DB2 was giving me fits due to bad assumptions. Thanks to Martin Evans (again) for help in identifying the problems and helping research solutions. This includes the scale/precision values to correctly store full timestamps.
Moving API usage to ODBC 3.0 specifications. With lots of help from Martin Evans (again!). Thanks Martin!!!!!
.44 was never officially released. Fix for do() and execute to handle DB2 correctly. Patch/discovery thanks to Martin Evans. Partly moving towards defaulting to ODBC 3.x standards.
Fix for FoxPro (and potentially other) Drivers!!!!! Add support for DBI column_info Fix for binding undef value which comes from dereferencing hash Fix to make all bound columns word (int) aligned in the buffer.
Added patches to the tests to support ActiveState's automated build process. Fix ping() to try SQLTables for a test, instead of a strange query.
Fixed problem where SQLDescribeParam would fail (probably bug in ODBC driver). Now reverts to SQL_VARCHAR if that happens, instead of failing the query.
Fixed error report when using Oracle's driver. There is a known problem. Left the error on the test, but added warning indicating it's a known problem.
Most significant change is the change in the default binding type which forces DBD::ODBC to attempt to determine the bind type if one is not passed. I decided to make this the default behavior to make things as simple as possible.
Fixed connection code put in 0.39 to work correctly.
Two minor patches for building, one for Cygwin one if both iODBC and unixODBC libraries are installed. Probably need better command line on this, but if someone has the problem, please let me know (and hopefully send a patch with it).
See mytest/longbin.pl for demonstration of inserting and retrieving long binary files to/from the db. Uses MD5 algorithm to verify data. Please do some similar test(s) with your database before using it in production. The various bind types are different for each database! Finally removed distribution of old iODBC. See www.iodbc.org or www.unixodbc.org for newer/better versions of the ODBC driver manager for Unix (and others?). Added ability to force ODBC environment version. Fix to SQLColAttributes. Changes to connect sequence to provide better error messages for those using DSN-less connections.
Fixed do function (again) thanks to work by Martin Evans.
Patches for get_info where return type is string. Patches thanks to Steffen Goldner. Thanks Steffen! Patched get_info to NOT attempt to get data for SQL_DRIVER_HSTMT and SQL_DRIVER_HDESC as they expect data in and have limited value (IMHO).
Further fixed build for ODBC 2.x drivers. The new SQLExecDirect code had SQLAllocHandle which is a 3.x function, not a 2.x function. Sigh. I should have caught that the first time. Signed, the Mad-and- not-thorough-enough-patcher. Additionally, a random core dump occurred in the tests, based upon the new SQLExecDirect code. This has been fixed.
Fixed build for ODBC 2.x drivers. The new SQLExecDirect code had SQLFreeHandle which is a 3.x function, not a 2.x function.
Fixed (finally) multiple result sets with differing numbers of columns. The final fix was to call SQLFreeStmt(SQL_UNBIND) before repreparing the statement for the next query. Added more to the multi-statement tests to ensure the data retrieved was what was expected. Now, DBD::ODBC overrides DBI's do to call SQLExecDirect for simple statements (those without parameters). Please advise if you run into problems. Hopefully, this will provide some small speed improvement for simple "do" statements. You can also call $dbh->func($stmt, ExecDirect). I'm not sure this has great value unless you need to ensure SQLExecDirect is being called. Patches thanks to Merijn Broeren. Thanks Merijn!
Further revamped tests to attempt to determine if SQLDescribeParam will work to handle the binding types. The t/08bind.t attempts to determine if SQLDescribeParam is supported. note that Oracle's ODBC driver under NT doesn't work correctly when binding dates using the ODBC date formatting {d } or {ts }. So, test #3 will fail in t/08bind.t New support for primary_key_info thanks to patches by Martin Evans. New support for catalog, schema, table and table_type in table_info thanks to Martin Evans. Thanks Martin for your work and your continuing testing, suggestions and general support! Support for upcoming dbi get_info.
Revamped tests to include tests for multiple result sets. The tests are ODBC driver platform specific and will be skipped for drivers which do not support multiple result sets.
Finally tested new binding techniques with SQL Server 2000, but there is a nice little bug in their MDAC and ODBC drivers according to the knowledge base article # Q273813, titled "FIX: "Incorrect Syntax near the Keyword 'by' " Error Message with Column Names of "C", "CA" or "CAS" (Q273813) DBD::ODBC now does not name any of the columns A, B, C, or D they are now COL_A, COL_B, COL_C, COL_D. *** NOTE: *** I AM STRONGLY CONSIDERING MAKING THE NEW BINDING the default for future versions. I do not believe it will break much existing code (if any) as anyone binding to non VARCHAR (without the ODBC driver doing a good conversion from the VARCHAR) will have a problem. It may be subtle, however, since much code will work, but say, binding dates may not with some drivers. Please comment soon...
*** WARNING: ***
Changes to the binding code to allow the use of SQLDescribeParam to determine if the type of column being bound. This is experimental and activated by setting $dbh->{odbc_default_bind_type} = 0; # before creating the query... Currently the default value of odbc_default_bind_type = SQL_VARCHAR which mimicks the current behavior. If you set odbc_default_bind_type to 0, then SQLDescribeParam will be called to determine the columen type. Not ALL databases handle this correctly. For example, Oracle returns SQL_VARCHAR for all types and attempts to convert to the correct type for us. However, if you use the ODBC escaped date/time format such as: {ts '1998-05-13 00:01:00'} then Oracle complains. If you bind this with a SQL_TIMESTAMP type, however, Oracle's ODBC driver will parse the time/date correctly. Use at your own risk! Fix to dbdimp.c to allow quoted identifiers to begin/end with either " or '. The following will not be treated as if they have a bind placeholder: "isEstimated?" '01-JAN-1987 00:00:00' 'Does anyone insert a ?'
More SAP patches to Makfile.PL to eliminate the call to Data Sources A patch to the test (for SAP and potentially others), to allow fallback to SQL_TYPE_DATE in the tests
Added SAP patches to build directly against SAP driver instead of driver manager thanks to Flemming Frandsen (thanks!) Added support to fix ping for Oracle8. May break other databases, so please report this as soon as possible. The downside is that we need to actually execute the dummy query.
Added ping patch for Solid courtesy of Marko Asplund Updated disconnect to rollback if autocommit is not on. This should silence some errors when disconnecting. Updated SQL_ROWSET_SIZE attribute. Needed to force it to odbc_SQL_ROWSET_SIZE to obey the DBI rules. Added odbc_SQL_DRIVER_ODBC_VER, which obtains the version of the Driver upon connect. This internal capture of the version is a read-only attributed and is used during array binding of parameters. Added odbc_ignore_named_placeholders attribute to facilicate creating triggers within SAPDB and Oracle, to name two. The syntax in these DBs is to allow use of :old and :new to access column values before and after updates. Example: $dbh->{odbc_ignore_named_placeholders} = 1; # set it for all future statements # ignores :foo, :new, etc, but not :1 or ? $dbh->do("create or replace etc :new.D = sysdate etc");
Cygwin patches from Neil Lunn (untested by me). Thanks Neil!
SQL_ROWSET_SIZE attribute patch from Andrew Brown > There are only 2 additional lines allowing for the setting of > SQL_ROWSET_SIZE as db handle option. > > The purpose to my madness is simple. SqlServer (7 anyway) by default > supports only one select statement at once (using std ODBC cursors). > According to the SqlServer documentation you can alter the default setting > of > three values to force the use of server cursors - in which case multiple > selects are possible. > > The code change allows for: > $dbh->{SQL_ROWSET_SIZE} = 2; # Any value > 1 > > For this very purpose. > > The setting of SQL_ROWSET_SIZE only affects the extended fetch command as > far as I can work out and thus setting this option shouldn't affect > DBD::ODBC operations directly in any way. > > Andrew >
VMS and other patches from Martin Evans (thanks!)
[1] a fix for Makefile.PL to build DBD::ODBC on OpenVMS.
[2] fix trace message coredumping after SQLDriverConnect
[3] fix call to SQLCancel which fails to pass the statement handle properly.
[4] consume diagnostics after SQLDriverConnect/SQLConnect call or they remain until the next error occurs and it then looks confusing (this is due to ODBC spec for SQLError). e.g. test 02simple returns a data truncated error only now instead of all the informational diags that are left from the connect call, like the "database changed", "language changed" messages you get from MS SQL Server.
Replaced C++ style comments with C style to support more platforms more easily.
Fixed bug which use the single quote (') instead of a double quote (") for "literal" column names. This helped when having a colon (:) in the column name.
Fixed bug which would cause DBD::ODBC to core-dump (crash) if DBI tracing level was greater than 3.
Fixed problem where ODBC.pm would have "use of uninitialized variable" if calling DBI's type_info.
Fixed problem where ODBC.xs *may* have an overrun when calling SQLDataSources.
Fixed problem with DBI 1.14, where fprintf was being called instead of PerlIO_printf for debug information
Fixed problem building with unixODBC per patch from Nick Gorham
Added ability to bind_param_inout() via patches from Jeremy Cooper. Haven't figured out a good, non-db specific way to test. My current test platform attempts to determine the connected database type via ugly hacks and will test, if it thinks it can. Feel free to patch and send me something...Also, my current Oracle ODBC driver fails miserably and dies.
Updated t/02simple.t to not print an error, when there is not one.
Added support for SQLSpecialColumns thanks to patch provided by Martin J. Evans [martin@easysoft.com]
Fixed bug introduced in 0.26 which was introduced of SQLMoreResults was not supported by the driver.
Examined patch for ping method to repair problem reported by Chris Bezil. Thanks Chris!
Added simple test for ping method working which should identify this in the future.
Put in patch for returning only positive rowcounts from dbd_st_execute. The original patch was submitted by Jon Smirl and put back in by David Good. Reasoning seems sound, so I put it back in. However, any databases that return negative rowcounts for specific reasons, will no longer do so.
Put in David Good's patch for multiple result sets. Thanks David! See mytest\moreresults.pl for an example of usage.
Added readme.txt in iodbcsrc explaining an issue there with iODBC 2.50.3 and data_sources.
data_sources
Put in rudimentary cancel support via SQLCancel. Call $sth->cencel to utilize. However, it is largely untested by me, as I do not have a good sample for this yet. It may come in handy with threaded perl, someday or it may work in a signal handler.
Added conditional compilation for SQL_WVARCHAR and SQL_WLONGVARCHAR. If they are not defined by your driver manager, they will not be compiled in to the code. If you would like to support these types on some platforms, you may be able to #define SQL_WVARCHAR (-9) #define SQL_WLONGVARCHAR (-10)
Added more long tests with binding in t\09bind.t. Note use of bind_param!
Fixed Test #13 in 02simple.t. Would fail, improperly, if there was only one data source defined.
Fixed (hopefully) SQL Server 7 and ntext type "Out of Memory!" errors via patch from Thomas Lowery. Thanks Thomas!
Added more support for Solid to handle the fact that it does not support data_sources nor SQLDriverConnect. Patch supplied by Samuli Karkkainen [skarkkai@woods.iki.fi]. Thanks! It's untested by me, however.
Added some information from Adam Curtin about a bug in iodbc 2.50.3's data_sources. See iodbcsrc\readme.txt.
Added information in this pod from Stephen Arehart regarding DSNLess connections.
Added fix for sp_prepare/sp_execute bug reported by Paul G. Weiss.
Added some code for handling a hint on disconnect where the user gets an error for not committing.
Fixed for threaded perl builds. Note that this was tested only on Win32, with no threads in use and using DBI 1.13. Note, for ActiveState/PERL_OBJECT builds, DBI 1.13_01 is required as of 9/8/99. If you are using ActiveState's perl, this can be installed by using PPM.
Thanks to all who provided patches!
Added ability to connect to an ODBC source without prior creation of DSN. See mytest/contest.pl for example with MS Access. (Also note that you will need documentation for your ODBC driver -- which, sadly, can be difficult to find).
Fixed case sensitivity in tests.
Hopefully fixed test #4 in t/09bind.t. Updated it to insert the date column and updated it to find the right type of the column. However, it doesn't seem to work on my Linux test machine, using the OpenLink drivers with MS-SQL Server (6.5). It complains about binding the date time. The same test works under Win32 with SQL Server 6.5, Oracle 8.0.3 and MS Access 97 ODBC drivers. Hmmph.
Fixed some binary type issues (patches from Jon Smirl)
Added SQLStatistics, SQLForeignKeys, SQLPrimaryKeys (patches from Jon Smirl) Thanks (again), Jon, for providing the build_results function to help reduce duplicate code!
Worked on LongTruncOk for Openlink drivers.
Note: those trying to bind variables need to remember that you should use the following syntax:
use DBI; ... $sth->bind_param(1, $str, DBI::SQL_LONGVARCHAR);
Added support for unixodbc (per Nick Gorham) Added support for OpenLinks udbc (per Patrick van Kleef) Added Support for esodbc (per Martin Evans) Added Support for Easysoft (per Bob Kline)
Changed table_info to produce a list of views, too. Fixed bug in SQLColumns call. Fixed blob handling via patches from Jochen Wiedmann. Added data_sources capability via snarfing code from DBD::Adabas (Jochen Wiedmann)
SQLColAttributes fixes for SQL Server and MySQL. Fixed tables method by renaming to new table_info method. Added new tyoe_info_all method. Improved Makefile.PL support for Adabase.
Added iODBC source code to distribution.Fall-back to using iODBC header files in some cases.
Enhancements to build process. Better handling of errors in error handling code.
This release is mostly due to the good work of Jeff Urlwin. My eternal thanks to you Jeff.
Fixed "SQLNumResultCols err" on joins and 'order by' with some drivers (see Microsoft Knowledge Base article #Q124899). Thanks to Paul O'Fallon for that one.
Added more (probably incomplete) support for unix ODBC in Makefile.PL
Increased default SQL_COLUMN_DISPLAY_SIZE and SQL_COLUMN_LENGTH to 2000 for drivers that don't provide a way to query them dynamically. Was 100!
When fetch reaches the end-of-data it automatically frees the internal ODBC statement handle and marks the DBI statement handle as inactive (thus an explicit 'finish' is *not* required).
Also:
LongTruncOk for Oracle ODBC (where fbh->datalen < 0) Added tracing into SQLBindParameter (help diagnose oracle odbc bug) Fixed/worked around bug/result from Latest Oracle ODBC driver where in SQLColAttribute cbInfoValue was changed to 0 to indicate fDesc had a value Added work around for compiling w/ActiveState PRK (PERL_OBJECT) Updated tests to include date insert and type Added more "backup" SQL_xxx types for tests Updated bind test to test binding select NOTE: bind insert fails on Paradox driver (don't know why)
Added support for: (see notes below)
SQLGetInfo via $dbh->func(xxx, GetInfo) SQLGetTypeInfo via $dbh->func(xxx, GetTypeInfo) SQLDescribeCol via $sth->func(colno, DescribeCol) SQLColAttributes via $sth->func(xxx, colno, ColAttributes) SQLGetFunctions via $dbh->func(xxx, GetFunctions) SQLColumns via $dbh->func(catalog, schema, table, column, 'columns')
Fixed $DBI::err to reflect the real ODBC error code which is a 5 char code, not necessarily numeric.
Fixed fetches when LongTruncOk == 1.
Updated tests to pass more often (hopefully 100% <G>)
Updated tests to test long reading, inserting and the LongTruncOk attribute.
Updated tests to be less driver specific.
They now rely upon SQLGetTypeInfo heavily in order to create the tables. The test use this function to "ask" the driver for the name of the SQL type to correctly create long, varchar, etc types. For example, in Oracle the SQL_VARCHAR type is VARCHAR2, while MS Access uses TEXT for the SQL Name. Again, in Oracle the SQL_LONGVARCHAR is LONG, while in Access it's MEMO. The tests currently handle this correctly (at least with Access and Oracle, MS SQL server will be tested also).
To install DBD::ODBC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBD::ODBC
CPAN shell
perl -MCPAN -e shell install DBD::ODBC
For more information on module installation, please visit the detailed CPAN module installation guide.