[vhffs-dev] [951] Pgsql API is now only using prepared statements

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


Revision: 951
Author:   gradator
Date:     2007-09-30 01:09:11 +0000 (Sun, 30 Sep 2007)

Log Message:
-----------
Pgsql API is now only using prepared statements

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm


Modified: trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm	2007-09-30 01:02:12 UTC (rev 950)
+++ trunk/vhffs-api/src/Vhffs/Services/Pgsql.pm	2007-09-30 01:09:11 UTC (rev 951)
@@ -105,9 +105,8 @@
 {
     my $self = shift;
 
-    my $query = "DELETE FROM vhffs_pgsql WHERE object_id='".$self->{'object_id'}."'";
-    my $request = $self->{'db'}->prepare($query);
-    $request->execute or return -1;
+    my $request = $self->{'db'}->prepare( 'DELETE FROM vhffs_pgsql WHERE object_id=?' );
+    $request->execute( $self->{'object_id'} )  or return -1;
 
     return -2 if( $self->SUPER::delete < 0 );
     return 1;
@@ -217,8 +216,8 @@
 {   
     my $self = shift;
     
-    my $request = $self->{'db'}->prepare("UPDATE vhffs_pgsql SET dbpass='' WHERE dbname='".$self->get_dbname."'") or return -1;
-    $request->execute();
+    my $request = $self->{'db'}->prepare('UPDATE vhffs_pgsql SET dbpass=\'\' WHERE dbname=?') or return -1;
+    $request->execute( $self->get_dbname );
     return 1;
 }
 


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