Skip Menu |
 

This queue is for tickets about the DBD-ODBC CPAN distribution.

Report information
The Basics
Id: 49065
Status: rejected
Priority: 0/
Queue: DBD-ODBC

People
Owner: Nobody in particular
Requestors: oystein.torget [...] dnv.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.15
Fixed in: (no value)

Attachments


Subject: SQL query length limited to about 65500 characters when binding used with SQL Server
Download (untitled) / with headers
text/plain 649b
The driver fails to execute a query if the query is longer than about 65500 characters and the query uses at least one bind parameter. The error message from the driver can vary. The attached script creates the following error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'TES@P1I'. (SQL-42S22) [state was 42S22 now 42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (SQL-42000) Queries that are longer than 65500 characters are accepted, but only if they do not contain binding parameters. The problem occurs on SQL Server 2000. The attached script demonstrates the problem.
Subject: test_query_size_with_binding.pl
#!perl use strict; use warnings; use DBI; my $dns = "driver={SQL Server};database=test_querysize;pwd=test;uid=test;server=localhost"; my $dbh = DBI->connect( "DBI:ODBC:${dns}", undef, undef, { PrintError => 0, RaiseError => 1 } ); my @values = 1 .. 2_663 ; my $where_sql = join( ' OR ', map { " TEST_COLUMN = '$_'" } @values ); my $select_sql = <<END_SQL; SELECT TESTID TEST_COLUMN FROM TEST_QUERYSIZE WHERE $where_sql AND TESTID = ? END_SQL print "Query length: " . length( $select_sql ) . "\n"; my $result; eval { $result = $dbh->selectall_arrayref( $select_sql, {}, ( 1 ) ); }; if( $@ ){ print $dbh->errstr(); }
Download (untitled) / with headers
text/plain 1.1k
On Thu Aug 27 05:48:49 2009, oyse wrote: Show quoted text
> The driver fails to execute a query if the query is longer than about > 65500 characters and the query uses at least one bind parameter. > > The error message from the driver can vary. The attached script creates > the following error: > > [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name > 'TES@P1I'. (SQL-42S22) [state was 42S22 now 42000] > [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not > be prepared. (SQL-42000) > > Queries that are longer than 65500 characters are accepted, but only if > they do not contain binding parameters. > > The problem occurs on SQL Server 2000. > > The attached script demonstrates the problem. >
As with the other bug your reported the script you provided works fine with a number of SQL Server drivers I am using but fails with some MS SQL Server drivers. I believe this is a fault in the driver and possibly comes about when 1 or more parameters is used because the MS SQL Server driver rearranges your SQL when bound parameters are used and SQLDescribeParam is called - this rearrangement is possibly placed into too small a buffer. Martin -- Martin J. Evans Wetherby, UK
Download (untitled) / with headers
text/plain 104b
This is a sql server odbc driver issue so this bug is rejected. Martin -- Martin J. Evans Wetherby, UK


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.