phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc class.db_pgsql.inc.php,1.35,1.36


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] phpgwapi/inc class.db_pgsql.inc.php,1.35,1.36
Date: Fri, 10 Oct 2003 08:51:46 +0000

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv27539

Modified Files:
        class.db_pgsql.inc.php 
Log Message:
merging to head db create function

Index: class.db_pgsql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.db_pgsql.inc.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** class.db_pgsql.inc.php      9 Oct 2003 03:31:32 -0000       1.35
--- class.db_pgsql.inc.php      10 Oct 2003 08:51:42 -0000      1.36
***************
*** 67,75 ****
                                if 
($GLOBALS['phpgw_info']['server']['db_persistent'])
                                {
!                                       $this->Link_ID=pg_pconnect($cstr);
                                }
                                else
                                {
!                                       $this->Link_ID=pg_connect($cstr);
                                }
  
--- 67,75 ----
                                if 
($GLOBALS['phpgw_info']['server']['db_persistent'])
                                {
!                                       $this->address@hidden($cstr);
                                }
                                else
                                {
!                                       $this->address@hidden($cstr);
                                }
  
***************
*** 77,80 ****
--- 77,81 ----
                                {
                                        $this->halt('Link-ID == false, 
'.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'').'connect failed');
+                                       return 0; 
                                }
                                else
***************
*** 88,91 ****
--- 89,93 ----
                                }
                        }
+                       return $this->Link_ID; 
                }
  
***************
*** 154,172 ****
                                return 0;
                        }
! 
!                       $this->connect();
! 
!                       /* printf("<br>Debug: query = %s<br>\n", 
$Query_String); */
  
                        $this->Query_ID = @pg_Exec($this->Link_ID, 
$Query_String);
                        $this->Row   = 0;
  
!                       $this->Error = pg_ErrorMessage($this->Link_ID);
                        $this->Errno = ($this->Error == '') ? 0 : 1;
                        if (! $this->Query_ID)
                        {
                                $this->halt('Invalid SQL: ' . $Query_String, 
$line, $file);
                        }
! 
                        return $this->Query_ID;
                }
--- 156,185 ----
                                return 0;
                        }
!                       if (!$this->connect())
!                       {
!                               return 0; /* we already complained in connect() 
about that. */
!                       };
!                       # New query, discard previous result.
!                       if ($this->Query_ID)
!                       {
!                               $this->free();
!                       } 
!                       
!                       if ($this->Debug)
!                       {
!                               printf("Debug: query = %s<br>\n", 
$Query_String);
!                       } 
  
                        $this->Query_ID = @pg_Exec($this->Link_ID, 
$Query_String);
                        $this->Row   = 0;
  
!                       $this->Error = @pg_ErrorMessage($this->Link_ID);
                        $this->Errno = ($this->Error == '') ? 0 : 1;
                        if (! $this->Query_ID)
                        {
                                $this->halt('Invalid SQL: ' . $Query_String, 
$line, $file);
+                               return 0; 
                        }
!                       # Will return nada if it fails. That's fine. 
                        return $this->Query_ID;
                }
***************
*** 206,211 ****
                        $this->Record = @pg_fetch_array($this->Query_ID, 
$this->Row++);
  
!                       $this->Error = pg_ErrorMessage($this->Link_ID);
!                       $this->Errno = ($this->Error == '') ? 0 : 1;
  
                        $stat = is_array($this->Record);
--- 219,227 ----
                        $this->Record = @pg_fetch_array($this->Query_ID, 
$this->Row++);
  
!                       if ($this->Link_ID)
!                       { 
!                               $this->Error = pg_ErrorMessage($this->Link_ID);
!                               $this->Errno = ($this->Error == '') ? 0 : 1;
!                       }
  
                        $stat = is_array($this->Record);
***************
*** 242,246 ****
                function transaction_abort()
                {
!                       return pg_Exec($this->Link_ID,'rollback');
                }
  
--- 258,262 ----
                function transaction_abort()
                {
!                       return @pg_Exec($this->Link_ID,'rollback');
                }
  
***************
*** 394,400 ****
  
                function halt($msg, $line = '', $file = '')
!               {
                        if ($this->Halt_On_Error == 'no')
                        {
                                return;
                        }
--- 410,419 ----
  
                function halt($msg, $line = '', $file = '')
!               { 
!                       /* private: error handling */ 
                        if ($this->Halt_On_Error == 'no')
                        {
+                               $this->Error = @pg_ErrorMessage($this->Link_ID);
+                               $this->Errno = 1;
                                return;
                        }
***************
*** 501,506 ****
                                $this->User = $adminname;
                                $this->Password = $adminpasswd;
                        }
! 
                        if (! $this->Host)
                        {
--- 520,530 ----
                                $this->User = $adminname;
                                $this->Password = $adminpasswd;
+                               $this->Database = 'template1'; 
                        }
!                       
!                       /*
!                       This doesn't work if the httpd server user doesn't have 
execute permissions on the createdb program
!                       */ 
!                       /*
                        if (! $this->Host)
                        {
***************
*** 514,521 ****
                        if($outval != 0) 
                        {
!                               /* either the rights r not available or the 
postmaster is not running .... */
                                echo 'database creation failure <BR>';
                                echo 'please setup the postreSQL database 
manually<BR>';
!                       }
  
                        $this->User = $currentUser;
--- 538,548 ----
                        if($outval != 0) 
                        {
!                               // either the rights are not available or the 
postmaster is not running .... 
                                echo 'database creation failure <BR>';
                                echo 'please setup the postreSQL database 
manually<BR>';
!                       }*/
!                       
!                       $this->query("CREATE DATABASE $currentDatabase");
!                       $this->query("grant all on $currentDatabase.* to 
address@hidden identified by '$currentPassword'"); 
  
                        $this->User = $currentUser;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]