[CDBI] Problem calling update on a MS SQL Server DB
steven.mackenzie at aptile.co.uk
Tue May 30 14:17:06 BST 2006
I'm using CDBI 3.0.6 (latest in the Active State PPM repository), and
I'm doing some testing against MS SQL Server 2005 (Express version) as
I initially built and tested my code against SQLite, but am trying
another DB to see if there are any performance gains to be had. SQLite
seems to become very slow for inserting/commiting into tables with 10s
of thousands of rows in.
So far the only change to my code is in the base class where I have
use base qw( Class::DBI::MSSQL );
#use base qw( Class::DBI ); # currently using 3.0.6 from ActiveState ppm.
The error I get seems to be because CDBI has 'quoted' the primary key
parameter value in the update:
(Can't update 1: DBD::ODBC::st execute failed: [Microsoft][ODBC SQL
Server Driver][SQL Server]String or binary data would be truncated.
[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been
terminated. (SQL-01000)(DBD: st_execute/SQLExecute err=-1) [for
Statement "UPDATE DiscoverySetResources
SET title = ?
" with ParamValues: 1="Active Navigation :: Information Management
Solutions", 2='1'] at C:/Perl/site/lib/DBIx/ContextualFetch.pm line 52.
The class definition for my DB class includes these lines:
__PACKAGE__->columns(Primary => qw/dsrid/);
__PACKAGE__->columns(Essential => qw/rid dsid StateId RetrievalUrl
SignificantContentFingerprint DsRelativeUrl OrigUrl HttpStatus Title
Depth IndirectCount LastRequested IsDiscovered /);
Does anyone have any idea how to prevent or control the quoting of
integer parameter values?
Or do I have a different kind of problem??
Thanks for any help,
More information about the ClassDBI