[vhffs-dev] [720] Removed all references to old DB columns from services.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 720
Author:   beuss
Date:     2007-07-12 14:25:20 +0000 (Thu, 12 Jul 2007)

Log Message:
-----------
Removed all references to old DB columns from services.

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
    trunk/vhffs-api/src/Vhffs/Services/DNS.pm
    trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
    trunk/vhffs-api/src/Vhffs/Services/Mail.pm
    trunk/vhffs-api/src/Vhffs/Services/Mailing.pm
    trunk/vhffs-api/src/Vhffs/Services/Mysql.pm
    trunk/vhffs-api/src/Vhffs/Services/Postgres.pm
    trunk/vhffs-api/src/Vhffs/Services/Repository.pm
    trunk/vhffs-api/src/Vhffs/Services/Svn.pm


Modified: trunk/vhffs-api/src/Vhffs/Services/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Cvs.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Cvs.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -105,7 +105,7 @@
 
         die('Unable to create parent object') unless(defined($parent));
 
-        my $sql = 'INSERT INTO vhffs_cvs(cvsroot, owner_uid, owner_gid, public, object_id) VALUES (?, ?, ?, TRUE, ?)';
+        my $sql = 'INSERT INTO vhffs_cvs(cvsroot, public, object_id) VALUES (?, TRUE, ?)';
         my $sth = $dbh->prepare($sql);
         $sth->execute($cvsroot, $user->get_uid, $group->get_gid, $parent->get_oid);
 
@@ -163,18 +163,6 @@
 	}
 }
 
-sub set_user
-{
-	my ( $self , $user ) = @_;
-	$self->{'owner_uid'} = $user->get_uid() if(defined $user && defined $self);
-}
-
-sub set_group
-{
-	my ( $self , $group ) = @_;
-	$self->{'owner_gid'} = $group->get_gid() if(defined $group && defined $self);
-}
-
 sub get_cvsroot
 {
 	my $self = shift;
@@ -205,7 +193,7 @@
 
 sub get_by_cvsroot {
     my($main, $cvsroot) = @_;
-    my $sql = 'SELECT c.cvs_id, c.cvsroot, c.owner_uid, c.owner_gid, c.public, c.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id WHERE c.cvsroot = ?';
+    my $sql = 'SELECT c.cvs_id, c.cvsroot, o.owner_uid, o.owner_gid, c.public, c.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id WHERE c.cvsroot = ?';
     my $dbh = $main->get_db_object();
     my @params;
     return undef unless(@params = $dbh->selectrow_array($sql, undef, $cvsroot));
@@ -221,7 +209,6 @@
     
     $self->{cvsroot} = $cvsroot;
     $self->{cvs_id} = $cvs_id;
-    $self->{owner_gid} = $owner_gid;
     $self->{public} = $public;
     return $self;
 }
@@ -238,7 +225,7 @@
     my $result;
     my $tmp;
 
-    $query = 'SELECT c.cvs_id, c.cvsroot, c.owner_uid, c.owner_gid, c.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id';
+    $query = 'SELECT c.cvs_id, c.cvsroot, o.owner_uid, o.owner_gid, c.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id';
     if(defined $state) {
         $query .= ' AND o.state=?';
         push(@params, $state);
@@ -249,7 +236,7 @@
     }
 
     if(defined $group) {
-        $query .= ' AND c.owner_gid=?';
+        $query .= ' AND o.owner_gid=?';
         push(@params, $group->get_gid);
     }
     $query .= " ORDER BY c.cvsroot";
@@ -273,7 +260,7 @@
     my $cvsroot;
     return undef if ( ! defined $group );
     
-    my $query = 'SELECT c.cvs_id, c.cvsroot, c.owner_uid, c.owner_gid, c.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id WHERE c.owner_gid=? ORDER BY c.cvsroot';
+    my $query = 'SELECT c.cvs_id, c.cvsroot, o.owner_uid, o.owner_gid, c.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id WHERE o.owner_gid=? ORDER BY c.cvsroot';
 
     my $request = $main->{'db'}->prepare( $query ) or return -1;
 

Modified: trunk/vhffs-api/src/Vhffs/Services/DNS.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/DNS.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/DNS.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -69,7 +69,7 @@
         push @params, '%'.$name.'%';
     }
     if(defined $group) {
-        $sql .= ' AND d.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push @params, $group->get_gid;
     }
     $sql .= ' ORDER BY d.domain';
@@ -119,7 +119,7 @@
 
         die('Unable to create parent object') unless(defined $parent);
 
-        my $sql = 'INSERT INTO vhffs_dns (domain, owner_uid, owner_gid, object_id, ns, mbox, serial, refresh, retry, expire, minimum, ttl) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+        my $sql = 'INSERT INTO vhffs_dns (domain, object_id, ns, mbox, serial, refresh, retry, expire, minimum, ttl) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
         my ($day, $month, $year);
         (undef,undef,undef,$day,$month,$year) = localtime(time);
         my $serial = sprintf('%.4u%.2u%.2u01',$year+1900,$month+1,$day);
@@ -210,7 +210,7 @@
 {
     my ($main, $name) = @_;
     
-    my $sql = 'SELECT d.dns_id, d.domain, d.owner_gid, d.ns, d.mbox, d.serial, d.refresh, d.retry, d.expire, d.minimum, d.ttl, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_dns d INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE d.domain = ?';
+    my $sql = 'SELECT d.dns_id, d.domain, o.owner_gid, d.ns, d.mbox, d.serial, d.refresh, d.retry, d.expire, d.minimum, d.ttl, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_dns d INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE d.domain = ?';
 
     my $dbh = $main->get_db_object();
     my @params;
@@ -286,7 +286,6 @@
 
     $self->{dns_id} = $dns_id;
     $self->{domain} = $domain;
-    $self->{owner_gid} = $owner_gid;
     $self->{ns} = $ns;
     $self->{mbox} = $mbox;
     $self->{serial} = $serial;

Modified: trunk/vhffs-api/src/Vhffs/Services/Httpd.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Httpd.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Httpd.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -83,7 +83,7 @@
     
         die('Unable to create parent object') unless(defined($parent));
 
-        my $sql = 'INSERT INTO vhffs_httpd(servername, owner_uid, owner_gid, object_id) VALUES(?, ?, ?, ?)';
+        my $sql = 'INSERT INTO vhffs_httpd(servername, object_id) VALUES(?, ?)';
 
         my $sth = $dbh->prepare($sql);
         $sth->execute($servername, $user->get_uid, $group->get_gid, $parent->get_oid);
@@ -160,7 +160,7 @@
     my $result;
     my $tmp;
 
-    $sql = 'SELECT  h.httpd_id, h.servername, h.owner_uid, h.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
+    $sql = 'SELECT  h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
     if(defined $state) {
         $sql .= ' AND o.state = ?';
         push(@params, $state);
@@ -170,7 +170,7 @@
         push(@params, '%'.$name.'%');
     }
     if(defined($group)) {
-        $sql .= ' AND h.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push(@params, $group->get_gid);
     }
 	$sql .= " ORDER BY servername";
@@ -201,7 +201,7 @@
     my $objs = [];
     my $result;
 
-    $sql = 'SELECT  h.httpd_id, h.servername, h.owner_uid, h.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername LIKE ?';
+    $sql = 'SELECT  h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername LIKE ?';
 
     push(@params, $letter);
 
@@ -235,7 +235,7 @@
     my $objs;
     my $result;
 
-    $sql = 'SELECT h.httpd_id, h.servername, h.owner_uid, h.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
+    $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id';
 
     if( ( defined $state ) && ( $state < Vhffs::Constants::TO_DELETE ) ) {
         $sql .= 'WHERE o.state= ? AND ( o.description LIKE ? OR w.servername LIKE ? )';
@@ -271,7 +271,7 @@
     my $tmp;
 
     
-    $sql = 'SELECT h.httpd_id, h.servername, h.owner_uid, h.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id AND h.owner_gid = ? ORDER BY servername';
+    $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id AND o.owner_gid = ? ORDER BY servername';
 
 
     $sth = $vhffs->get_db_object()->prepare( $sql );
@@ -300,7 +300,7 @@
 
 sub get_by_servername {
     my ($main, $servername) = @_;
-    my $sql = 'SELECT h.httpd_id, h.servername, h.owner_uid, h.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername = ?';
+    my $sql = 'SELECT h.httpd_id, h.servername, o.owner_uid, o.owner_gid, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername = ?';
     
     my $dbh = $main->get_db_object();
     my @params;
@@ -328,10 +328,9 @@
     my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, $state, Vhffs::Constants::TYPE_HTTPD);
     return undef unless(defined($self));
 
-    foreach (qw(httpd_id servername owner_gid)) {
-        no strict 'refs';
-        eval '$self->{$_} = $'.$_;
-    }
+    $self->{http_id} = $http_id;
+    $self->{servername} = $servername;
+    
     return $self;
 }
 

Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -105,7 +105,7 @@
 
         die('Unable to create parent object') unless(defined $parent);
 
-        my $sql = 'INSERT INTO vhffs_mxdomain(domain, unix_user, boxes_path, max_popbox, catchall, owner_uid, owner_gid, object_id) VALUES(?, \'exim\', ?, 0, \'\', ?, ?, ?)';
+        my $sql = 'INSERT INTO vhffs_mxdomain(domain, unix_user, boxes_path, max_popbox, catchall, object_id) VALUES(?, \'exim\', ?, 0, \'\', ?)';
         my $domain_hash = Vhffs::Functions::hash_mxdomain($domain);
         my $sth = $dbh->prepare($sql);
         $sth->execute($domain, $domain_hash, $user->get_uid(), $group->get_gid, $parent->get_oid);
@@ -497,7 +497,7 @@
 sub get_by_mxdomain {
     my ($main, $domain) = @_;
 
-    my $sql = 'SELECT m.mxdomain_id, m.owner_gid, m.domain, m.unix_user, m.boxes_path, m.max_popbox, m.catchall, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE domain = ?';
+    my $sql = 'SELECT m.mxdomain_id, o.owner_gid, m.domain, m.unix_user, m.boxes_path, m.max_popbox, m.catchall, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE domain = ?';
     my $dbh = $main->get_db_object();
     my @params;
     return undef unless(@params = $dbh->selectrow_array($sql, undef, $domain));
@@ -524,7 +524,6 @@
     return undef unless defined($self);
     
     $self->{mxdomain_id} = $mxdomain_id;
-    $self->{owner_gid} = $owner_gid;
     $self->{domain} = $domain;
     $self->{unix_user} = $unix_user;
     $self->{boxes_path} = $boxes_path;
@@ -558,7 +557,7 @@
         push(@params, '%'.$name.'%');
     }
     if(defined $group) {
-        $sql .= ' AND m.owner_gid= ?';
+        $sql .= ' AND o.owner_gid= ?';
         push(@params, $group->get_gid);
     }
     $request = $vhffs->{'db'}->prepare( $sql );

Modified: trunk/vhffs-api/src/Vhffs/Services/Mailing.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mailing.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Mailing.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -83,8 +83,8 @@
     $dbh->begin_work;
 
     eval {
-        # Group must be the mail domain owner or user default mail domain.
-        my $sql = 'SELECT mxdomain_id FROM vhffs_mxdomain WHERE domain = ? AND owner_gid = ?';
+        # Group must be the mail domain owner or use default mail domain.
+        my $sql = 'SELECT mxdomain_id FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.domain = ? AND o.owner_gid = ?';
         die('Mail domain not found') unless($domain eq $main->get_config()->get_service("mailing")->{'default_domain'} ||
                             $dbh->do($sql, undef, $domain, $group->get_gid) > 0);
 
@@ -92,7 +92,7 @@
         die('Unable to create parent object') unless(defined $parent);
 
 	# open sub, post members only
-        $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, owner_uid, owner_gid, object_id, admin, open_archive, reply_to, sub_ctrl, post_ctrl) VALUES(?, ?, ?, ?, ?, ?, ?, FALSE, TRUE, ?, ? )';
+        $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, object_id, admin, open_archive, reply_to, sub_ctrl, post_ctrl) VALUES(?, ?, ?, ?, ?, FALSE, TRUE, ?, ? )';
         my $sth = $dbh->prepare($sql);
         $sth->execute($local, $domain, $local, $user->get_uid, $group->get_gid, $parent->get_oid, $admin, Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED, Vhffs::Constants::ML_POSTING_MEMBERS_ONLY);
         $dbh->commit;
@@ -123,7 +123,7 @@
     my ($main, $local, $domain) = @_;
     
     my $dbh = $main->get_db_object();
-    my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, ml.owner_gid, ml.admin, ml.open_archive, ml.reply_to, ml.sub_ctrl, ml.post_ctrl, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?';
+    my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, o.owner_gid, ml.admin, ml.open_archive, ml.reply_to, ml.sub_ctrl, ml.post_ctrl, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?';
     my $sth = $dbh->prepare($sql);
     return undef unless ($sth->execute($domain, $local) > 0);
     my @params = $sth->fetchrow_array;
@@ -146,7 +146,6 @@
     $self->{local_part} = $local_part;
     $self->{domain} = $domain,
     $self->{prefix} = $prefix;
-    $self->{owner_gid} = $owner_gid;
     $self->{admin} = $admin;
     $self->{open_archive} = $open_archive;
     $self->{reply_to} = $reply_to;
@@ -509,7 +508,7 @@
         push @params, $state;
     }
     if(defined $group) {
-        $sql .= ' AND ml.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push @params, $group->get_gid;
     }
     if(defined $name) {

Modified: trunk/vhffs-api/src/Vhffs/Services/Mysql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mysql.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Mysql.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -126,7 +126,7 @@
         my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_MYSQL);
         die('Unable to create parent object') unless defined ($parent);
 
-        my $sql = 'INSERT INTO vhffs_mysql(dbname, dbuser, dbpass, owner_uid, owner_gid, object_id) VALUES(?, ?, ?, ?, ?, ?)';
+        my $sql = 'INSERT INTO vhffs_mysql(dbname, dbuser, dbpass, object_id) VALUES(?, ?, ?, ?)';
         my $sth = $dbh->prepare($sql);
         $sth->execute($dbname, $dbuser, $dbpass, $user->get_uid, $group->get_gid, $parent->get_oid);
 
@@ -147,11 +147,10 @@
 {
 	my $self = shift;	
 
-	my $query = "UPDATE vhffs_mysql SET owner_uid='".$self->{'owner_uid'}."', dbpass='".$self->{'dbpass'}."' WHERE dbname='".$self->{'dbname'}."'";
-	my $request = $self->{'db'}->prepare( $query );
-	$request->execute;
+	my $query = 'UPDATE vhffs_mysql SET dbpass = ? WHERE dbname = ?';
+	my $request = $self->get_db_object()->prepare( $query );
+	$request->execute($self->{dbpass}, $self->{dbname});
 
-
 	$self->SUPER::commit;
 }
 
@@ -229,7 +228,6 @@
     return undef unless(defined $self);
 
     $self->{mysql_id} = $mysql_id;
-    $self->{owner_gid} = $owner_gid;
     $self->{dbname} = $dbname;
     $self->{dbuser} = $dbuser;
     $self->{dbpass} = $dbpass;
@@ -250,7 +248,7 @@
 sub get_by_dbname($$) {
     my ($vhffs, $dbname) = @_;
 
-    my $sql = q{SELECT m.mysql_id, m.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?};
+    my $sql = q{SELECT m.mysql_id, o.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?};
     my $dbh = $vhffs->get_db_object();
     my @params;
     return undef unless(@params = $dbh->selectrow_array($sql, undef, $dbname));
@@ -265,7 +263,7 @@
     my $mysql = [];
     my @params;
    
-    my $sql = 'SELECT m.mysql_id, m.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mysql m, vhffs_object o WHERE m.object_id = o.object_id';
+    my $sql = 'SELECT m.mysql_id, o.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mysql m, vhffs_object o WHERE m.object_id = o.object_id';
 
     if(defined $state) {
         $sql .= ' AND o.state = ?';
@@ -276,7 +274,7 @@
         push(@params, '%'.$name.'%');
     }
     if(defined $group) {
-        $sql .= ' AND m.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push(@params, $group->get_gid);
     }
 

Modified: trunk/vhffs-api/src/Vhffs/Services/Postgres.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Postgres.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Postgres.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -140,7 +140,7 @@
         my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_PGSQL);
         die('Unable to create parent object') unless defined ($parent);
 
-        my $sql = 'INSERT INTO vhffs_pgsql(dbname, dbuser, dbpass, owner_uid, owner_gid, object_id) VALUES(?, ?, ?, ?, ?, ?)';
+        my $sql = 'INSERT INTO vhffs_pgsql(dbname, dbuser, dbpass, object_id) VALUES(?, ?, ?, ?)';
         my $sth = $dbh->prepare($sql);
         $sth->execute($dbname, $dbuser, $dbpass, $user->get_uid, $group->get_gid, $parent->get_oid);
 
@@ -161,9 +161,9 @@
 {
 	my $self = shift;	
 
-	my $query = "UPDATE vhffs_pgsql SET owner_uid='".$self->{'owner_uid'}."', dbuser= '".$self->{'dbuser'}."', dbpass='".$self->{'dbpass'}."' WHERE dbname='".$self->{'dbname'}."'";
-	my $request = $self->{'db'}->prepare( $query );
-	$request->execute;
+    my $sql = 'UPDATE vhffs_pgsql SET dbuser = ?, dbpass = ? WHERE pgsql_id = ?';
+	my $sth = $self->get_db_object()->prepare( $query );
+	$sth->execute($self->{dbuser}, $self->{dbpass}, $self->{pgsql_id});
 
 
 	$self->SUPER::commit;
@@ -262,7 +262,7 @@
 sub get_by_dbname($$) {
     my ($vhffs, $dbname) = @_;
 
-    my $sql = q{SELECT m.pgsql_id, m.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?};
+    my $sql = q{SELECT m.pgsql_id, o.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?};
     my $dbh = $vhffs->get_db_object();
     my @params;
     return undef unless(@params = $dbh->selectrow_array($sql, undef, $dbname));
@@ -278,7 +278,7 @@
     my $postgres = [];
     my @params;
 
-    my $sql = 'SELECT p.pgsql_id, p.owner_gid, p.dbname, p.dbuser, p.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql p, vhffs_object o WHERE p.object_id = o.object_id';
+    my $sql = 'SELECT p.pgsql_id, o.owner_gid, p.dbname, p.dbuser, p.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql p, vhffs_object o WHERE p.object_id = o.object_id';
 
     if(defined $state) {
         $sql .= ' AND o.state = ?';
@@ -289,7 +289,7 @@
         push(@params, '%'.$name.'%');
     }
     if(defined $group) {
-        $sql .= ' AND p.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push(@params, $group->get_gid);
     }
 

Modified: trunk/vhffs-api/src/Vhffs/Services/Repository.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Repository.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Repository.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -102,7 +102,7 @@
         my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_REPOSITORY);
         die('Unable to create parent object') unless(defined $parent);
 
-        my $sql = 'INSERT INTO vhffs_repository(name, owner_uid, owner_gid, quota, quota_used, object_id) VALUES(?, ?, ?, ?, 0, ?)';
+        my $sql = 'INSERT INTO vhffs_repository(name, quota, quota_used, object_id) VALUES(?, ?, 0, ?)';
 
         #Quota
         my $config = $main->get_config()->get_service('repository');
@@ -140,7 +140,7 @@
 
     my @params;
 
-    my $sql = 'SELECT r.repository_id, r.name, r.owner_uid, r.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE r.name = ?';
+    my $sql = 'SELECT r.repository_id, r.name, o.owner_uid, o.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE r.name = ?';
 
     my $dbh = $main->get_db_object();
     return undef unless(@params = $dbh->selectrow_array($sql, undef, $name));
@@ -156,7 +156,6 @@
 
     $self->{repository_id} = $repository_id;
     $self->{name} = $name;
-    $self->{owner_gid} = $owner_gid;
     $self->{quota} = $quota;
     $self->{quota_used} = $quota_used;
 
@@ -184,7 +183,7 @@
 	my $repos = [];
     my @params;
 
-    my $sql = 'SELECT r.repository_id, r.name, r.owner_uid, r.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r, vhffs_object o WHERE r.object_id = o.object_id';
+    my $sql = 'SELECT r.repository_id, r.name, o.owner_uid, o.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r, vhffs_object o WHERE r.object_id = o.object_id';
     if(defined($state)) {
         $sql .= ' AND o.state = ?';
         push(@params, $state);
@@ -194,7 +193,7 @@
         push(@params, $name);
     }
     if(defined($group)) {
-        $sql .= ' AND r.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push(@params, $group->get_gid);
     }
 	$sql .= ' ORDER BY r.name';
@@ -283,7 +282,7 @@
 	my $repos = [];
 	return undef if ( ! defined $group );
 
-    my $sql = 'SELECT r.repository_id, r.name, r.owner_uid, r.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE r.owner_gid = ?';
+    my $sql = 'SELECT r.repository_id, r.name, o.owner_uid, o.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE o.owner_gid = ?';
 
     my $dbh = $main->get_db_object();
     my $sth = $dbh->prepare($sql);

Modified: trunk/vhffs-api/src/Vhffs/Services/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Svn.pm	2007-07-12 14:21:27 UTC (rev 719)
+++ trunk/vhffs-api/src/Vhffs/Services/Svn.pm	2007-07-12 14:25:20 UTC (rev 720)
@@ -80,7 +80,7 @@
 
         die('Unable to create parent object') unless(defined $parent);
 
-        my $sql = 'INSERT INTO vhffs_svn(reponame, owner_uid, owner_gid, public, ml_name, object_id) VALUES(?, ?, ?, 1, \'\', ?)';
+        my $sql = 'INSERT INTO vhffs_svn(reponame, public, ml_name, object_id) VALUES(?, 1, \'\', ?)';
         my $sth = $dbh->prepare($sql);
         $sth->execute($rname, $user->get_uid, $group->get_gid, $parent->get_oid) or return undef;
 
@@ -100,7 +100,7 @@
     my ($main, $reponame) = @_;
     my @params;
 
-    my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?';
+    my $sql = 'SELECT s.svn_id, s.reponame, o.owner_uid, o.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?';
 
     my $dbh = $main->get_db_object();
 
@@ -119,7 +119,6 @@
 
     $self->{svn_id} = $svn_id;
     $self->{reponame} = $reponame;
-    $self->{owner_gid} = $owner_gid;
     $self->{public} = $public;
     $self->{ml_name} = $ml_name;
 
@@ -205,7 +204,7 @@
     my $svn = [];
     my @params;
 
-    my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s, vhffs_object o WHERE o.object_id = s.object_id';
+    my $sql = 'SELECT s.svn_id, s.reponame, o.owner_uid, o.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s, vhffs_object o WHERE o.object_id = s.object_id';
     
 
     if(defined $state) {
@@ -217,7 +216,7 @@
         push(@params, $name);
     }
     if(defined($group)) {
-        $sql .= ' AND s.owner_gid = ?';
+        $sql .= ' AND o.owner_gid = ?';
         push(@params, $group->get_gid);
     }
     $sql .= ' ORDER BY s.reponame';
@@ -243,8 +242,8 @@
 
     return undef unless( defined $group );
 
-    my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER
- JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.owner_gid = ? ORDER BY s.reponame';
+    my $sql = 'SELECT s.svn_id, s.reponame, o.owner_uid, o.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER
+ JOIN vhffs_object o ON o.object_id = s.object_id WHERE o.owner_gid = ? ORDER BY s.reponame';
 
     my $dbh = $vhffs->get_db_object();
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/