[interchange-cvs] interchange - racke modified lib/Vend/Table/DBI.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Mar 31 10:52:37 EST 2004
User: racke
Date: 2004-03-31 15:52:37 GMT
Modified: lib/Vend/Table DBI.pm
Log:
found two problems with set_slice:
* set_slice modifies the arrays for fields and values if
references are passed as argument, can cause problem
in user's code if key isn't the first column
* passing a list like qw(os23445 price 2 color red) sucked
all parameters from @_, e.g.:
> query was:insert into hit
(idf,Vend::Table::DBI=ARRAY(0xa0f3fc8),moment,useragent,userhost,referer,url,session,userip)
VALUES (?,?,?,?,?,?,?,?,?)
Revision Changes Path
2.58 +13 -7 interchange/lib/Vend/Table/DBI.pm
rev 2.58, prev_rev 2.57
Index: DBI.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/DBI.pm,v
retrieving revision 2.57
retrieving revision 2.58
diff -u -r2.57 -r2.58
--- DBI.pm 22 Aug 2003 16:15:30 -0000 2.57
+++ DBI.pm 31 Mar 2004 15:52:36 -0000 2.58
@@ -1,8 +1,8 @@
# Vend::Table::DBI - Access a table stored in an DBI/DBD database
#
-# $Id: DBI.pm,v 2.57 2003/08/22 16:15:30 jon Exp $
+# $Id: DBI.pm,v 2.58 2004/03/31 15:52:36 racke Exp $
#
-# Copyright (C) 2002-2003 Interchange Development Group
+# Copyright (C) 2002-2004 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
# MA 02111-1307 USA.
package Vend::Table::DBI;
-$VERSION = substr(q$Revision: 2.57 $, 10);
+$VERSION = substr(q$Revision: 2.58 $, 10);
use strict;
@@ -1160,7 +1160,9 @@
}
sub set_slice {
- my ($s, $key, $fary, $vary) = @_;
+ my ($s, $key, $fin, $vin) = @_;
+ my ($fary, $vary);
+
$s = $s->import_db() if ! defined $s->[$DBI];
if($s->[$CONFIG]{Read_only}) {
@@ -1175,10 +1177,14 @@
my $tkey;
my $sql;
- if(ref $fary ne 'ARRAY') {
- my $href = $fary;
+ if (ref $fin eq 'ARRAY') {
+ $fary = [@$fin];
+ $vary = [@$vin];
+ }
+ else {
+ my $href = $fin;
if(ref $href ne 'HASH') {
- $href = { $fary, $vary, @_ }
+ $href = { splice (@_, 2) };
}
$vary = [ values %$href ];
$fary = [ keys %$href ];
More information about the interchange-cvs
mailing list