Re: DBD::ODBC and cancel()
On Wed, May 14, 2008 at 03:12:27PM -0700, Dean Arnold wrote: > (DBI 1.604, DBD::ODBC 1.15, WinXP, AS 5.8.8) > > I'm trying to test cancel of long running queries > via DBD::ODBC (using psqlodbc driver). I've written > a small proxy which injects 10+ second delays in > delivery of queries from client to server. And I've > managed to get SIGINT signals delivered to my app. > But it appears that DBD::ODBC doesn't appear to > believe the stmt handle is active when I cancel it. > I hacked DBD::ODBC's dbdimp.c:odbc_cancel() to > add printf's on entry, if no stmt is active, > or if SQLCancel fails. When I run the test and > hit ctrl-C, odbc_cancel() does get called, *but* > it reports no active statement. > > So I commented out the Active test in odbc_cancel(), > and then everything works as expected. > > Is this a known sequencing problem ? Is Active not getting > set until the rows start returning ? If so, shouldn't it get > set immediately upon calling SQLExecute ? I don't think it should be checking the Active flag at all. Active (which is poorly named) wouldn't be set for an UPDATE statement, for example, but you'd still want to be able to cancel it. Tim.
DBD::ODBC and cancel()
(DBI 1.604, DBD::ODBC 1.15, WinXP, AS 5.8.8) I'm trying to test cancel of long running queries via DBD::ODBC (using psqlodbc driver). I've written a small proxy which injects 10+ second delays in delivery of queries from client to server. And I've managed to get SIGINT signals delivered to my app. But it appears that DBD::ODBC doesn't appear to believe the stmt handle is active when I cancel it. I hacked DBD::ODBC's dbdimp.c:odbc_cancel() to add printf's on entry, if no stmt is active, or if SQLCancel fails. When I run the test and hit ctrl-C, odbc_cancel() does get called, *but* it reports no active statement. So I commented out the Active test in odbc_cancel(), and then everything works as expected. Is this a known sequencing problem ? Is Active not getting set until the rows start returning ? If so, shouldn't it get set immediately upon calling SQLExecute ? I'm very certain the query is still pending in the proxy when I hit ctrl-C, so no rows have yet been returned. I turned on max tracing, but I don't see any setting/clearing of Active included in the traces. My small sample app follows. Any help much appreciated, Dean Arnold use DBI; use strict; use warnings; # # allow signals anytime !!VERY DANGEROUS!! # $ENV{PERL_SIGNALS} = 'unsafe'; my $dsn = scalar @ARGV ? shift @ARGV : 'PostgreSQL30'; my $dbh = DBI->connect("dbi:ODBC:$dsn", undef, undef, { RaiseError => 0}) or die $DBI::errstr; $| = 1; my $cancelled; my $sth = $dbh->prepare('select * from perl_dbi_test') or die $dbh->errstr; $SIG{INT} = sub { print "You cancelled.\n"; print "Not cancelled.\n" unless $sth->cancel(); $cancelled = 1; }; print "Executing...\n"; my $rc = $sth->execute; print "execute() done rc $rc, fetching rows\n"; die "Didn't cancel!\n" if $rc; print "Cancelled, error is ", $sth->errstr, "\n" if $cancelled; $dbh->disconnect();
DBD::ODBC 1.16 uploaded to CPAN
Hi, I have just uploaded DBD::ODBC 1.16 to CPAN. This release contains the following changes: =head1 CHANGES =head2 Changes in DBD::ODBC 1.16 May 13, 2008 =head3 Test Changes Small change to the last test in 10handler.t to cope with the prepare failing instead of the execute failing - spotted by Andrei Kovalevski with the ODBCng Postgres driver. Changed the 20SqlServer.t test to specifically disable MARS for the test to check multiple active statements and added a new test to check that when MARS_Connection is enabled multiple active statements are allowed. Changed the 09multi.t test to use ; as a SQL statement seperator instead of a newline. A few minor "use of unitialised" fixes in tests when a test fails. In 02simple.t Output DBMS_NAME/VER, DRIVER_NAME/VER as useful debugging aid when cpan testers report a fail. 2 new tests for odbc_query_timeout added to 03dbatt.t. Changed 02simple.t test which did not work for Oracle due to a "select 1" in the test. Test changed to do "select 1 from dual" for Oracle. New tests for numbered and named placeholders. =head3 Documentation Changes Added references to DBD::ODBC ohloh listing and markmail archives. Added Tracing sections. Added "Deviations from the DBI specification" section. Moved the FAQ entries from ODBC.pm to new FAQ document. You can view the FAQ with perldoc DBD::ODBC::FAQ. Added provisional README.windows document. Rewrote pod for odbc_query_timeout. Added a README.osx. =head3 Internal Changes More tracing in dbdimp.c for named parameters. #ifdeffed out odbc_get_primary_keys in dbdimp.c as it is no longer used. $h->func($catalog, $schema, $table, 'GetPrimaryKeys') ends up in dbdimp.c/dbd_st_primary_keys now. Reformatted dbdimp.c to avoid going over 80 columns. Tracing changed. Levels reviewed and changed in many cases avoiding levels 1 and 2 which are reserved for DBI. Now using DBIc_TRACE macro internally. =head3 Build Changes Changes to Makefile.PL to fix a newly introduced bug with 'tr', remove easysoft OOB detection and to try and use odbc_config and odbcinst if we find them to aid automatic configuration. This latter change also adds "odbc_config --cflags" to the CC line when building DBD::ODBC. Avoid warning when testing ExtUtils::MakeMaker version and it is a test release with an underscore in the version. =head3 Functionality Changes Added support for parse_trace_flag and parse_trace_flags methods and defined a DBD::ODBC private flag 'odbcdev' as a test case. Add support for the 'SQL' trace type. Added private trace type odbcdev as an experimental start. Change odbc_query_timeout attribute handling so if it is set to 0 after having set it to a non-zero value the default of no time out is restored. Added support for DBI's statistics_info method. =head3 Bug Fixes Fix bug in support for named placeholders leading to error "Can't rebind placeholder" when there is more than one named placeholder. Guard against scripts attempting to use a named placeholder more than once in a single SQL statement. If you called some methods after disconnecting (e.g., prepare/do and any of the DBD::ODBC specific methods via "func") then no error was generated. Fixed issue with use of true/false as fields names in structure on MAC OS X 10.5 (Leopard) thanks to Hayden Stainsby. Remove tracing of bound wide characters as it relies on null-terminated strings that don't exist. Fix issue causing a problem with repeatedly executing a stored procedure which returns no result-set. SQLMoreResults was only called on the first execute and some drivers (SQL Server) insist a procedure is not finished until SQLMoreResults returns SQL_NO_DATA. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com
ANNOUNCE: IBM Informix Database Driver for Perl DBI Version 2008.0513 (2008-05-13) released
IBM Informix Database Driver for Perl DBI Version 2008.0513 (2008-05-13) has been uploaded to CPAN. IBM Informix Database Driver for Perl (also known as DBD::Informix) is the driver code that enables Perl 5.6.1 or later to access Informix databases via the DBI module (but if you are not already using Perl 5.10.0 - or any later version - you should be planning to upgrade). You will need the code for DBI version 1.38 or later as well (v1.604 - or any later version - is recommended). The code for DBD::Informix is available for download via: http://www.perl.org/CPAN/modules/by-category/07_Database_Interfaces http://dbi.perl.org/ ** When you successfully build this module, use the ItWorks (Perl) ** script to report your configuration to the maintenance team (meaning ** Jonathan Leffler) at [EMAIL PROTECTED] ** The ItWorks script does not send email to anybody; you have to do ** that yourself. New in release :PRODVER:: * Fix $sth->{TYPE}: return 9 (SQL_DATE) not -1 (SQL_LVARCHAR), fixing an 11-year old bug. * Add support for BIGINT in ESQL/C 3.50, including $h->{ix_bigserial}. * CPAN Testers reporting issues because Makefile.PL not exiting successfully when pre-requisites not met. * ESQL/C 3.50 (for IDS 11.50) typedefs ifx_loc_t - update dumpesql.h to cope (Joe R Plugge <[EMAIL PROTECTED]>). * ESQL/C test fails during configuration when $Config{ccflags} has leading spaces. Records show this problem also affected Dr Guenther Seifert <[EMAIL PROTECTED]> in June 2007. Apologies for not getting it fixed sooner. Release 2008.0229: * RT#32975: Add $h->{ix_serial} and $h->{ix_serial8}. Release 2007.0914 * RT#29364: Fix problem identifying ESQL/C libraries. Release 2007.0904: * Bug fix and tidying up release - no new functionality. * Simplified internal release processing * Refixed support for ESQL/C 5.20. * Report server version better (using DBINFO). * Reworked some headers. * Reworked ExtUtils::AutoInstall code. Support email address: * This release is supported by Jonathan Leffler <[EMAIL PROTECTED]>. * You may also report your bugs via the CPAN resolution tracking system: http://rt.cpan.org/ * Such bug reports can be sent by email to [EMAIL PROTECTED]; they also get sent to [EMAIL PROTECTED], etc. As always, see the ChangeLog file for details about what has changed. Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) @(#)$Id: Announce,v 2008.2 2008/05/13 03:03:31 jleffler Exp $ smime.p7s Description: S/MIME Cryptographic Signature