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.30.2.1.2.9


From: nomail
Subject: [Phpgroupware-cvs] phpgwapi/inc/class.db_pgsql.inc.php, 1.30.2.1.2.9
Date: Mon, 28 Jun 2004 09:08:09 +0200

Update of /phpgwapi/inc
Modified Files:
        Branch: Version-0_9_16-branch
          class.db_pgsql.inc.php

date: 2004/06/28 07:08:09;  author: powerstat;  state: Exp;  lines: +167 -7

Log Message:
phpdoc update
=====================================================================
Index: phpgwapi/inc/class.db_pgsql.inc.php
diff -u phpgwapi/inc/class.db_pgsql.inc.php:1.30.2.1.2.8 
phpgwapi/inc/class.db_pgsql.inc.php:1.30.2.1.2.9
--- phpgwapi/inc/class.db_pgsql.inc.php:1.30.2.1.2.8    Tue Feb 10 13:51:18 2004
+++ phpgwapi/inc/class.db_pgsql.inc.php Mon Jun 28 07:08:09 2004
@@ -17,6 +17,7 @@
        * 
        * @package phpgwapi
        * @subpackage database
+       * @ignore
        */
        class db extends db_
        {
@@ -33,12 +34,25 @@
                        }
                }
 
-               /* public: constructor */
+               /**
+               * Constructor
+               *
+               * @param $query SQL query
+               */
                function db($query = '')
                {
                        $this->db_($query);
                }
 
+               /**
+                * Connect to database
+                * 
+                * @param string $Database Database name
+                * @param string $Host Database host
+                * @param string $User Database user
+                * @param string $Password Database users password
+                * @return resource Database connection_id
+                */
                function connect($Database = '', $Host = '', $User = '', 
$Password = '')
                {
                        /* Handle defaults */
@@ -93,6 +107,12 @@
                        return $this->Link_ID; 
                }
 
+        /**
+         * Convert a unix timestamp to a rdms specific timestamp
+         *
+         * @param int unix timestamp
+         * @return string rdms specific timestamp
+         */
                function to_timestamp($epoch)
                {
                        $db_version = $this->db_version;
@@ -106,6 +126,12 @@
                        }
                }
 
+        /**
+         * Convert a rdms specific timestamp to a unix timestamp
+         *
+         * @param string rdms specific timestamp
+         * @return int unix timestamp
+         */
                function from_timestamp($timestamp)
                {
                        if (floor($this->db_version) == 6)
@@ -118,26 +144,50 @@
                        }
                }
 
-               // For PostgreSQL 6.x
+        /**
+         * Convert a unix timestamp to a rdms specific timestamp in PostgreSQL 
6
+         *
+         * @param int unix timestamp
+         * @return string rdms specific timestamp
+                * @access private
+         */
                function to_timestamp_6($epoch)
                {
 
                }
 
-               // For PostgreSQL 6.x
+        /**
+         * Convert a rdms specific timestamp to a unix timestamp for 
PostgreSQL 6
+         *
+         * @param string rdms specific timestamp
+         * @return int unix timestamp
+                * @access private
+         */
                function from_timestamp_6($timestamp)
                {
 
                }
 
-               // For PostgreSQL 7.x
+        /**
+         * Convert a unix timestamp to a rdms specific timestamp in PostgreSQL 
7
+         *
+         * @param int unix timestamp
+         * @return string rdms specific timestamp
+                * @access private
+         */
                function to_timestamp_7($epoch)
                {
                        // This needs the GMT offset!
                        return date('Y-m-d H:i:s-00',$epoch);
                }
 
-               // For PostgreSQL 7.x
+        /**
+         * Convert a rdms specific timestamp to a unix timestamp for 
PostgreSQL 6
+         *
+         * @param string rdms specific timestamp
+         * @return int unix timestamp
+                * @access private
+         */
                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);
@@ -145,12 +195,25 @@
                        return 
mktime($parts[4],$parts[5],$parts[6],$parts[2],$parts[3],$parts[1]);
                }
 
-               /* This only affects systems not using persistant connections */
+               /**
+                * Disconnect database connection
+                *
+                * This only affects systems not using persistant connections 
+                * @return integer 1: ok; 0: not possible/already closed
+                */
                function disconnect()
                {
                        return @pg_close($this->Link_ID);
                }
 
+        /**
+         * Execute a query
+         *
+         * @param string $Query_String the query to be executed
+         * @param mixed $line the line method was called from - use __LINE__
+         * @param string $file the file method was called from - use __FILE__
+         * @return integer Current result if sucesful and null if failed
+         */
                function query($Query_String, $line = '', $file = '')
                {
                        if ($Query_String == '')
@@ -186,6 +249,16 @@
                        return $this->Query_ID;
                }
 
+        /**
+         * Execute a query with limited result set
+         *
+         * @param string $Query_String the query to be executed
+         * @param integer $offset row to start from
+         * @param mixed $line the line method was called from - use __LINE__
+         * @param string $file the file method was called from - use __FILE__
+         * @param int $num_rows number of rows to return (optional), if unset 
will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
+         * @return integer Current result if sucesful and null if failed
+         */
                function limit_query($Query_String, $offset, $line = '', $file 
= '', $num_rows = 0)
                {
                        $offset         = intval($offset);
@@ -220,6 +293,11 @@
                        $this->Query_ID = 0;
                }
 
+        /**
+         * Move to the next row in the results set
+         *
+         * @return boolean was another row found?
+         */
                function next_record()
                {
                        $this->Record = @pg_fetch_array($this->Query_ID, 
$this->Row++);
@@ -239,6 +317,12 @@
                        return $stat;
                }
 
+        /**
+         * Move to position in result set
+         *
+         * @param integer $pos Required row (optional), default first row
+         * @return integer 1 if sucessful or 0 if not found
+         */
                function seek($pos)
                {
                        $this->Row = $pos;
@@ -249,6 +333,11 @@
                        return $this->query('begin');
                }
 
+        /**
+         * Complete the transaction
+         *
+         * @return boolean True if sucessful, False if failed
+         */
                function transaction_commit()
                {
                        if (! $this->Errno)
@@ -261,11 +350,23 @@
                        }
                }
 
+        /**
+         * Rollback the current transaction
+         *
+         * @return boolean True if sucessful, False if failed
+         */
                function transaction_abort()
                {
                        return @pg_Exec($this->Link_ID,'rollback');
                }
 
+        /**
+         * Find the primary key of the last insertion on the current db 
connection
+         *
+         * @param string $table name of table the insert was performed on
+         * @param string $field the autoincrement primary key of the table
+         * @return integer The id, -1 if failed
+         */
                function get_last_insert_id($table, $field)
                {
                        if (!isset($table) || $table == '' || !isset($field) || 
$field == '')
@@ -295,6 +396,13 @@
                        return $Record[0];
                }
 
+        /**
+         * Lock a table
+         *
+         * @param string $table name of table to lock
+         * @param string $mode type of lock required (optional), default write
+         * @return boolean True if sucessful, False if failed
+         */
                function lock($table, $mode = 'write')
                {
                        $result = $this->transaction_begin();
@@ -321,12 +429,23 @@
                        return $result;
                }
 
+        /**
+         * Unlock a table
+         *
+         * @return boolean True if sucessful, False if failed
+         */
                function unlock()
                {
                        return $this->transaction_commit();
                }
 
 
+        /**
+         * Get the id for the next sequence
+         *
+         * @param string $seq_name Name of the sequence
+         * @return integer sequence id
+         */
                function nextid($seq_name)
                {
                        $this->connect();
@@ -370,6 +489,13 @@
                        return $nextid;
                }
 
+        /**
+         * Get description of a table
+         *
+         * @param string $table name of table to describe
+         * @param boolean $full optional, default False summary information, 
True full information
+         * @return array Table meta data
+         */
                function metadata($table)
                {
                        $count = 0;
@@ -399,21 +525,44 @@
                        return $res;
                }
 
+        /**
+         * Get the number of rows affected by last update
+         *
+         * @return integer number of affected rows
+         */
                function affected_rows()
                {
                        return pg_cmdtuples($this->Query_ID);
                }
 
+        /**
+         * Number of rows in current result set
+         *
+         * @return integer number of rows
+         */
                function num_rows()
                {
                        return pg_numrows($this->Query_ID);
                }
 
+        /**
+         * Number of fields in current row
+         *
+         * @return integer number of fields
+         */
                function num_fields()
                {
                        return pg_numfields($this->Query_ID);
                }
 
+        /**
+        * Error handler
+        *
+        * @param string $msg error message
+        * @param integer $line line of calling method/function (optional)
+        * @param string $file file of calling method/function (optional)
+               * @access private
+        */
                function halt($msg, $line = '', $file = '')
                { 
                        /* private: error handling */ 
@@ -486,6 +635,11 @@
                        }
                }
 
+        /**
+         * Get a list of table names in the current database
+         *
+         * @return array List of the tables
+         */
                function table_names()
                {
                        $return = array();
@@ -515,6 +669,12 @@
                        return $return;
                }
 
+        /**
+         * Create a new database
+         *
+         * @param string $adminname Name of database administrator user 
(optional)
+         * @param string $adminpasswd Password for the database administrator 
user (optional)
+         */
                function create_database($adminname = '', $adminpasswd = '')
                {
                        $currentUser = $this->User;




reply via email to

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