smoky has asked for the wisdom of the Perl Monks concerning the following question:
This piece of code places a new repository within the database. This generates a log like:my $query = $self->{dbConn}->prepare("INSERT INTO repository(rname +) VALUES('". $repository->getName ."')"); my $affected = $query->execute; $self->{dbConn}->commit; $logger->debug($DBI::errstr || 'no errors found, ' . $affected . ' + affected');
This next example of code is where the bug is:2009/04/02 11:15:15 DEBUG> ResultSQL.pm:62 ResultSQL::prvInsertRepo - +Reporting repository 2009/04/02 11:15:15 DEBUG> ResultSQL.pm:65 ResultSQL::prvInsertRepo - +INSERT INTO repository(rname) VALUES('testSQL') 2009/04/02 11:15:15 DEBUG> ResultSQL.pm:69 ResultSQL::prvInsertRepo - +no errors found, 1 affected
This generates this log:$logger->debug("INSERT INTO script(repoid, sname) SELECT repoid, '" +. $scriptN . "' as sname FROM repository WHERE rname='" . $repository +->getName . "'"); my $query = $self->{dbConn}->prepare("INSERT INTO script(repoi +d, sname) SELECT repoid, '" . $scriptN . "' as sname FROM repository +WHERE rname='" . $scriptN . "'"); my $affected = $query->execute; $self->{dbConn}->commit; $logger->debug($DBI::errstr || 'no errors found, ' . $affected + . ' affected');
There is another method which gets called after this, but it pretty much does the same job but if a different set of data. When I check the database out I would have an entry in the repository table, but nothing else. As I said before, if I take the SQL from my log, paste it into SQL Developer, it will execute as expected.. Any ideas? I am totally stuck.. Cheers in advance ..2009/04/02 11:15:15 DEBUG> ResultSQL.pm:78 ResultSQL::prvInsertScripts + - Reporting scripts 2009/04/02 11:15:15 DEBUG> ResultSQL.pm:81 ResultSQL::prvInsertScripts + - INSERT INTO script(repoid, sname) SELECT repoid, 'tableName' as sn +ame FROM repository WHERE rname='testSQL' 2009/04/02 11:15:15 DEBUG> ResultSQL.pm:85 ResultSQL::prvInsertScripts + - no errors found, 0E0 affected
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI Oracle insert not working
by tilly (Archbishop) on Apr 02, 2009 at 12:13 UTC | |
by smoky (Novice) on Apr 02, 2009 at 12:32 UTC | |
by tilly (Archbishop) on Apr 02, 2009 at 12:56 UTC | |
|
Re: DBI Oracle insert not working
by mje (Curate) on Apr 02, 2009 at 10:44 UTC | |
by smoky (Novice) on Apr 02, 2009 at 11:12 UTC | |
by mje (Curate) on Apr 02, 2009 at 12:19 UTC |