uninitialized PK when inserting row into SQLite?

[prev] [thread] [next] [Date index for 2004/10/14]

From: Drew Wilson
Subject: uninitialized PK when inserting row into SQLite?
Date: 18:39 on 14 Oct 2004
I'm getting the exception trace (printed below) which appears to me to  
be caused by an uninitialized  primary key passed to execute by  
Class::DBI::_insert_row(). The code continues and everything seems to  
work correctly. However, this 21 line strict warning  is a little  
disturbing, and the screen I/O slows down my program.

If I put a breakpoint on this line:
Class::DBI::_insert_row(/Library/Perl/5.8.4/Class/DBI.pm:636):
636:		$sth->execute(values %$data);

I see that %$data contains:
   DB<38> x %$data
0  'zmessage'
1  Model::Message=HASH(0x1a0d318)
    'z_pk' => 2
2  'z_pk'
3  undef
4  'zlanguage'
5  1
6  'zname'
7  'MS-DOS'

'z_pk" is the table's primary key.

I am using Class::DBI 0.96, a SQLite3 database, and DBD::SQLite-1.07.

Is this a known problem?

FWW - it looks like the four following statements could be moved before  
the execute() to fix the problem.

Drew

Use of uninitialized value in subroutine entry at  
/Library/Perl/5.8.4/DBIx/ContextualFetch.pm line 51.
          
DBIx::ContextualFetch::st::_untaint_execute 
('DBIx::ContextualFetch::st=HASH(0x19eb27c)', 'foo', 'undef',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'MS-DOS File System',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'msdosfs_Tier1_proj', 'FSPersonalities:MS-DOS:FSName') called at  
/Library/Perl/5.8.4/DBIx/ContextualFetch.pm line 31
          
DBIx::ContextualFetch::st::execute('DBIx::ContextualFetch::st=HASH 
(0x19eb27c)', 'foo', 'undef',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'MS-DOS File System',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'msdosfs_Tier1_proj', 'FSPersonalities:MS-DOS:FSName') called at  
/Library/Perl/5.8.4/Class/DBI.pm line 636
         eval {...} called at /Library/Perl/5.8.4/Class/DBI.pm line 629
         Class::DBI::_insert_row('Model::Message=HASH(0x1a0d318)',  
'HASH(0x1a0e144)') called at /Library/Perl/5.8.4/Class/DBI.pm line 590
         Class::DBI::_create('Model::Message', 'HASH(0x19d8f30)') called  
at /Library/Perl/5.8.4/Class/DBI.pm line 470
         Class::DBI::create('Model::Message', 'HASH(0x1a09fd8)') called  
at /Library/Perl/5.8.4/Class/DBI.pm line 451
         Class::DBI::find_or_create('Model::Message', 'HASH(0x1a09fd8)')  
called at Model/Translation.pm line 41
         Model::Translation::addTranslation('undef', 'project',  
'msdosfs_Tier1_proj', 'filePath',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'source', 'MS-DOS File System', 'sourceLanguageCode', 'en', ...) called  
at ./importTranslations.pl line 102
          
main::processAD('/Users/drew/lre/LSM/glossaries/FU-French/ 
msdosfs_Tier1_proj.ad') called at ./importTranslations.pl line 27
Use of uninitialized value in subroutine entry at  
/Library/Perl/5.8.4/DBIx/ContextualFetch.pm line 51.
          
DBIx::ContextualFetch::st::_untaint_execute 
('DBIx::ContextualFetch::st=HASH(0x19eb27c)', 'foo', 'undef',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'MS-DOS File System',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'msdosfs_Tier1_proj', 'FSPersonalities:MS-DOS:FSName') called at  
/Library/Perl/5.8.4/DBIx/ContextualFetch.pm line 31
          
DBIx::ContextualFetch::st::execute('DBIx::ContextualFetch::st=HASH 
(0x19eb27c)', 'foo', 'undef',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'MS-DOS File System',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'msdosfs_Tier1_proj', 'FSPersonalities:MS-DOS:FSName') called at  
/Library/Perl/5.8.4/Class/DBI.pm line 636
         eval {...} called at /Library/Perl/5.8.4/Class/DBI.pm line 629
         Class::DBI::_insert_row('Model::Message=HASH(0x1a0d318)',  
'HASH(0x1a0e144)') called at /Library/Perl/5.8.4/Class/DBI.pm line 590
         Class::DBI::_create('Model::Message', 'HASH(0x19d8f30)') called  
at /Library/Perl/5.8.4/Class/DBI.pm line 470
         Class::DBI::create('Model::Message', 'HASH(0x1a09fd8)') called  
at /Library/Perl/5.8.4/Class/DBI.pm line 451
         Class::DBI::find_or_create('Model::Message', 'HASH(0x1a09fd8)')  
called at Model/Translation.pm line 41
         Model::Translation::addTranslation('undef', 'project',  
'msdosfs_Tier1_proj', 'filePath',  
'msdosfs_Tier1_proj/msdosfs_Tier1-7B46/System/Library/Filesyst...',  
'source', 'MS-DOS File System', 'sourceLanguageCode', 'en', ...) called  
at ./importTranslations.pl line 102
          
main::processAD('/Users/drew/lre/LSM/glossaries/FU-French/ 
msdosfs_Tier1_proj.ad') called at ./importTranslations.pl line 27
Class::DBI::create(/Library/Perl/5.8.4/Class/DBI.pm:455):





0  'zmessage'
1  Model::Message=HASH(0x1a0d318)
    'z_pk' => 2
2  'z_pk'
3  undef
4  'zlanguage'
5  1
6  'zname'
7  'MS-DOS'

(message missing)

uninitialized PK when inserting row into SQLite?
Drew Wilson 18:39 on 14 Oct 2004

Re: uninitialized PK when inserting row into SQLite?
Edward J. Sabol 19:06 on 14 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52