not being able to insert any new entries gave me the incentive to fix a
few bugs:
DBIx::Compat now knows about Pg joins
s/\*Table/*MainTable/ in several places that look sensible
stray debugging print now protected by "if debug > 2"
s/OUTER/LEFT OUTER/ in BuildFields
I'm still fuzzy on SQL JOIN semantics, so someone who knows should probably
check that (4) is what was intended.
(2) is the controversial one - but "make test" still works, so there's no
way I could have broken any existing code ;)
Note: you still can't insert/delete/update multiple tables at once,
this just makes it work in the presence of !LinkName, by using the
!Table you gave, not the list of tables that would be used in a SELECT.
--
- Gus
Index: Compat.pm
===================================================================
RCS file: /var/lib/cvs/debian/libdbix-recordset-perl/Compat.pm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Compat.pm
--- Compat.pm 6 Aug 2001 23:08:29 -0000 1.1.1.1
+++ Compat.pm 11 Dec 2001 05:11:10 -0000
@@ -289,7 +289,6 @@
'Placeholders' => 2, # Placeholders supported, but the perl
# type must be the same as the db
type
- 'SupportSQLJoin' => 0, # Driver does not supports
INNER/LEFT/RIGHt JOIN Syntax in SQL select
'NumericTypes' => {
20 => 1,
21 => 1,
Index: Recordset.pm
===================================================================
RCS file: /var/lib/cvs/debian/libdbix-recordset-perl/Recordset.pm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Recordset.pm
--- Recordset.pm 6 Aug 2001 23:08:29 -0000 1.1.1.1
+++ Recordset.pm 11 Dec 2001 05:22:14 -0000
@@ -858,7 +858,7 @@
sub TableName ($)
{
- return $_[0] -> {'*Table'} ;
+ return $_[0] -> {'*MainTable'} ;
}
## ----------------------------------------------------------------------------
@@ -872,7 +872,7 @@
sub TableNameWithoutFilter ($)
{
- my $tab = $_[0] -> {'*Table'} ;
+ my $tab = $_[0] -> {'*MainTable'} ;
return $1 if ($tab =~ /^$_[0]->{'*TableFilter'}(.*?)$/) ;
return $tab ;
@@ -1028,7 +1028,7 @@
$f = $v -> {'!MainField'} ;
$mf -> {$f} = $k ;
$mf -> {"$tab4f->{$f}.$f"} = $k ;
- print LOG "DB: Field $v->{'!MainField'} has link $k\n" ;
+ print LOG "DB: Field $v->{'!MainField'} has link $k\n" if ($self ->
+{'*Debug'} > 2) ;
}
$self -> {'*MainFields'} = $mf ;
}
@@ -1195,17 +1195,17 @@
{
my ($self, $fields, $vals, $bind_values, $bind_types) = @_ ;
- $self -> savecroak ("Insert disabled for table $self->{'*Table'}") if
(!($self->{'*WriteMode'} & wmINSERT)) ;
+ $self -> savecroak ("Insert disabled for table $self->{'*MainTable'}") if
+(!($self->{'*WriteMode'} & wmINSERT)) ;
$self->{'*Stats'}{insert}++ ;
if (defined ($bind_values))
{
- return $self->do ("INSERT INTO $self->{'*Table'} ($fields) VALUES ($vals)",
undef, $bind_values, $bind_types) ;
+ return $self->do ("INSERT INTO $self->{'*MainTable'} ($fields) VALUES
+($vals)", undef, $bind_values, $bind_types) ;
}
else
{
- return $self->do ("INSERT INTO $self->{'*Table'} ($fields) VALUES ($vals)") ;
+ return $self->do ("INSERT INTO $self->{'*MainTable'} ($fields) VALUES
+($vals)") ;
}
}
@@ -1225,17 +1225,17 @@
{
my ($self, $data, $where, $bind_values, $bind_types) = @_ ;
- $self -> savecroak ("Update disabled for table $self->{'*Table'}") if
(!($self->{'*WriteMode'} & wmUPDATE)) ;
+ $self -> savecroak ("Update disabled for table $self->{'*MainTable'}") if
+(!($self->{'*WriteMode'} & wmUPDATE)) ;
$self->{'*Stats'}{update}++ ;
if (defined ($bind_values))
{
- return $self->do ("UPDATE $self->{'*Table'} SET $data WHERE $where", undef,
$bind_values, $bind_types) ;
+ return $self->do ("UPDATE $self->{'*MainTable'} SET $data WHERE $where",
+undef, $bind_values, $bind_types) ;
}
else
{
- return $self->do ("UPDATE $self->{'*Table'} SET $data WHERE $where") ;
+ return $self->do ("UPDATE $self->{'*MainTable'} SET $data WHERE $where") ;
}
}
@@ -1254,18 +1254,18 @@
{
my ($self, $where, $bind_values, $bind_types) = @_ ;
- $self -> savecroak ("Delete disabled for table $self->{'*Table'}") if
(!($self->{'*WriteMode'} & wmDELETE)) ;
- $self -> savecroak ("Clear (Delete all) disabled for table $self->{'*Table'}") if
(!$where && !($self->{'*WriteMode'} & wmCLEAR)) ;
+ $self -> savecroak ("Delete disabled for table $self->{'*MainTable'}") if
+(!($self->{'*WriteMode'} & wmDELETE)) ;
+ $self -> savecroak ("Clear (Delete all) disabled for table
+$self->{'*MainTable'}") if (!$where && !($self->{'*WriteMode'} & wmCLEAR)) ;
$self->{'*Stats'}{'delete'}++ ;
if (defined ($bind_values))
{
- return $self->do ("DELETE FROM $self->{'*Table'} " . ($where?"WHERE
$where":''), undef, $bind_values, $bind_types) ;
+ return $self->do ("DELETE FROM $self->{'*MainTable'} " . ($where?"WHERE
+$where":''), undef, $bind_values, $bind_types) ;
}
else
{
- return $self->do ("DELETE FROM $self->{'*Table'} " . ($where?"WHERE
$where":'')) ;
+ return $self->do ("DELETE FROM $self->{'*MainTable'} " . ($where?"WHERE
+$where":'')) ;
}
}
@@ -1918,7 +1918,7 @@
{
my $v ;
- $rtabrel = $table . ',' . join (',', map { "OUTER $_ " } keys %tables) ;
+ $rtabrel = $table . ',' . join (',', map { "LEFT OUTER $_ " } keys %tables) ;
$tabrel = ($tabrel?"$tabrel and ":'') . join (' and ', values %tables) ;
}
@@ -2706,13 +2706,13 @@
($self = $newself) or return undef ;
}
- $self -> savecroak ("Delete disabled for table $self->{'*Table'}") if
(!($self->{'*WriteMode'} & wmDELETE)) ;
+ $self -> savecroak ("Delete disabled for table $self->{'*MainTable'}") if
+(!($self->{'*WriteMode'} & wmDELETE)) ;
my @bind_values ;
my @bind_types ;
my $expr = $self->BuildWhere ($where,\@bind_values,\@bind_types) ;
- $self -> savecroak ("Clear (Delete all) disabled for table $self->{'*Table'}") if
(!$expr && !($self->{'*WriteMode'} & wmCLEAR)) ;
+ $self -> savecroak ("Clear (Delete all) disabled for table
+$self->{'*MainTable'}") if (!$expr && !($self->{'*WriteMode'} & wmCLEAR)) ;
my $links = $self -> {'*Links'} ;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]