summaryrefslogtreecommitdiffstats
path: root/config-db/ODLX/MetaDB/DBI.pm
diff options
context:
space:
mode:
authorOliver Tappe2006-08-16 13:16:49 +0200
committerOliver Tappe2006-08-16 13:16:49 +0200
commit0088a630adf7a7b812ccae04c16dc4029b8a8246 (patch)
tree9015ca0f8fadab1a8d77c8b99dcf4d50fb54c683 /config-db/ODLX/MetaDB/DBI.pm
parent* now creates some groups, too. (diff)
downloadcore-0088a630adf7a7b812ccae04c16dc4029b8a8246.tar.gz
core-0088a630adf7a7b812ccae04c16dc4029b8a8246.tar.xz
core-0088a630adf7a7b812ccae04c16dc4029b8a8246.zip
* fixed bug with automatic ID-creation not working as it should
* added informative comment about why no SQL-placeholders are used git-svn-id: http://svn.openslx.org/svn/openslx/trunk@304 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/ODLX/MetaDB/DBI.pm')
-rw-r--r--config-db/ODLX/MetaDB/DBI.pm22
1 files changed, 17 insertions, 5 deletions
diff --git a/config-db/ODLX/MetaDB/DBI.pm b/config-db/ODLX/MetaDB/DBI.pm
index 50c7ecf5..776285cb 100644
--- a/config-db/ODLX/MetaDB/DBI.pm
+++ b/config-db/ODLX/MetaDB/DBI.pm
@@ -9,6 +9,12 @@ $VERSION = 1.01; # API-version . implementation-version
### It provides a default implementation for every method, such that
### each DB-specific implementation needs to override only the methods
### that require a different implementation than the one provided here.
+###
+### N.B.: In case you ask yourself why none of the SQL-statements in this
+### file make use of SQL bind params (?), the answer is that at least
+### one DBD-driver didn't like them at all. As the performance gains
+### from bound params are not really necessary here, we simply do
+### not use them.
################################################################################
use strict;
@@ -228,6 +234,12 @@ sub fetchAllGroupIDsOfClient
################################################################################
### data manipulation functions
+###
+### N.B.: In case you ask yourself why none of the SQL-statements in
+### the following functions make use of SQL-placeholders (?), the answer
+### is that at least one DBD-driver didn't like them at all.
+### As the improved performance gained from using placeholders is not
+### really necessary here, we simply do not use them.
################################################################################
sub _doInsert
{
@@ -252,17 +264,17 @@ sub _doInsert
}
my @ids;
foreach my $valRow (@$valRows) {
+ if (!defined $valRow->{id} && !$ignoreIDs && $needToGenerateIDs) {
+ # let DB-backend pre-specify ID, as current DB can't generate IDs:
+ $valRow->{id} = $self->generateNextIdForTable($table);
+ vlog 3, "generated id for <$table> is <$valRow->{id}>";
+ }
my $cols = join ', ', keys %$valRow;
my $values = join ', ', map { $self->quote($valRow->{$_}) } keys %$valRow;
my $sql = "INSERT INTO $table ( $cols ) VALUES ( $values )";
my $sth = $dbh->prepare($sql)
or confess _tr(q[Can't insert into table <%s> (%s)], $table,
$dbh->errstr);
- if (!defined $valRow->{id} && !$ignoreIDs && $needToGenerateIDs) {
- # let DB-backend pre-specify ID, as current DB can't generate IDs:
- $valRow->{id} = $self->generateNextIdForTable($table);
- vlog 3, "generated id for <$table> is <$valRow->{id}>";
- }
vlog 3, $sql;
$sth->execute()
or confess _tr(q[Can't insert into table <%s> (%s)], $table,