[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.db_pgsql.inc.php [Version-0_9_16-b
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.db_pgsql.inc.php [Version-0_9_16-branch] |
Date: |
Mon, 13 Mar 2006 18:30:39 +0000 |
CVSROOT: /sources/phpgwapi
Module name: phpgwapi
Branch: Version-0_9_16-branch
Changes by: Sigurd Nes <address@hidden> 06/03/13 18:30:39
Modified files:
inc : class.db_pgsql.inc.php
Log message:
enables support for postgresql 8.x
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/inc/class.db_pgsql.inc.php.diff?only_with_tag=Version-0_9_16-branch&tr1=1.30.2.1.2.10&tr2=1.30.2.1.2.11&r1=text&r2=text
Patches:
Index: phpgwapi/inc/class.db_pgsql.inc.php
diff -u phpgwapi/inc/class.db_pgsql.inc.php:1.30.2.1.2.10
phpgwapi/inc/class.db_pgsql.inc.php:1.30.2.1.2.11
--- phpgwapi/inc/class.db_pgsql.inc.php:1.30.2.1.2.10 Sat Nov 6 15:34:26 2004
+++ phpgwapi/inc/class.db_pgsql.inc.php Mon Mar 13 18:30:39 2006
@@ -9,12 +9,12 @@
* @link http://www.sanisoft.com/phplib/manual/DB_sql.php
* @package phpgwapi
* @subpackage database
- * @version $Id: class.db_pgsql.inc.php,v 1.30.2.1.2.10 2004/11/06
15:34:26 powerstat Exp $
+ * @version $Id: class.db_pgsql.inc.php,v 1.30.2.1.2.11 2006/03/13
18:30:39 sigurdne Exp $
*/
/**
* Database class for PostgreSQL
- *
+ *
* @package phpgwapi
* @subpackage database
* @ignore
@@ -46,7 +46,7 @@
/**
* Connect to database
- *
+ *
* @param string $Database Database name
* @param string $Host Database host
* @param string $User Database user
@@ -92,7 +92,7 @@
if (! $this->Link_ID)
{
$this->halt('Link-ID == false,
'.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'').'connect failed');
- return 0;
+ return 0;
}
else
{
@@ -104,7 +104,7 @@
$this->db_version = $parts[1];
}
}
- return $this->Link_ID;
+ return $this->Link_ID;
}
/**
@@ -191,14 +191,14 @@
function from_timestamp_7($timestamp)
{
ereg('([0-9]{4})-([0-9]{2})-([0-9]{2})
([0-9]{2}):([0-9]{2}):([0-9]{2})',$timestamp,$parts);
-
+
return
mktime($parts[4],$parts[5],$parts[6],$parts[2],$parts[3],$parts[1]);
}
/**
* Disconnect database connection
*
- * This only affects systems not using persistant connections
+ * This only affects systems not using persistant connections
* @return integer 1: ok; 0: not possible/already closed
*/
function disconnect()
@@ -228,12 +228,12 @@
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;
@@ -243,9 +243,9 @@
if (! $this->Query_ID)
{
$this->halt('Invalid SQL: ' . $Query_String,
$line, $file);
- return 0;
+ return 0;
}
- # Will return nada if it fails. That's fine.
+ # Will return nada if it fails. That's fine.
return $this->Query_ID;
}
@@ -303,7 +303,7 @@
$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;
}
@@ -374,13 +374,23 @@
return -1;
}
- $oid = pg_getlastoid($this->Query_ID);
- if ($oid == -1)
+ $params = explode('.',$this->db_version);
+
+ if ($params[0] < 8 || ($params[0] == 8 && $params[0]
==0))
{
- return -1;
+ $oid = pg_getlastoid($this->Query_ID);
+ if ($oid == -1)
+ {
+ return -1;
+ }
+
+ $result = @pg_Exec($this->Link_ID, "select
$field from $table where oid=$oid");
+ }
+ else
+ {
+ $result = @pg_Exec($this->Link_ID, "select
lastval()");
}
- $result = @pg_Exec($this->Link_ID, "select $field from
$table where oid=$oid");
if (!$result)
{
return -1;
@@ -515,7 +525,7 @@
for ($i=0; $i<$count; $i++)
{
$res[$i]['table'] = $table;
- $res[$i]['name'] = pg_FieldName ($id, $i);
+ $res[$i]['name'] = pg_FieldName ($id, $i);
$res[$i]['type'] = pg_FieldType ($id, $i);
$res[$i]['len'] = pg_FieldSize ($id, $i);
$res[$i]['flags'] = '';
@@ -564,8 +574,8 @@
* @access private
*/
function halt($msg, $line = '', $file = '')
- {
- /* private: error handling */
+ {
+ /* private: error handling */
if ($this->Halt_On_Error == 'no')
{
$this->Error = @pg_ErrorMessage($this->Link_ID);
@@ -685,12 +695,12 @@
{
$this->User = $adminname;
$this->Password = $adminpasswd;
- $this->Database = 'template1';
+ $this->Database = 'template1';
}
-
+
/*
This doesn't work if the httpd server user doesn't have
execute permissions on the createdb program
- */
+ */
/*
if (! $this->Host)
{
@@ -701,15 +711,15 @@
system('createdb -h ' . $this->Host . ' ' .
$currentDatabase, $outval);
}
- if($outval != 0)
+ if($outval != 0)
{
- // either the rights are not available or the
postmaster is not running ....
+ // 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->query("grant all on $currentDatabase.* to
address@hidden identified by '$currentPassword'");
$this->User = $currentUser;
$this->Password = $currentPassword;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/inc class.db_pgsql.inc.php [Version-0_9_16-branch],
Sigurd Nes <=