Class database

Description

Define a database. This is a parent class to all of the supported

database flavours. It holds the main data describing a database and it's connection. The actual functionality to connect to a physical database and access its data is defined in the child classes of this one. For example, see file 'db-postgres.php'.

Normal users of the system should not have to deal with this class directly.

The datasources class is a container for multiple 'databases' or instances of this class.

Located in /database-defs.php (line 546)


	
			
Variable Summary
 mixed $connected
 mixed $dbid
 mixed $host
 mixed $name
 mixed $passwd
 mixed $persistent
 mixed $port
 mixed $rid
 mixed $timer
 mixed $type
 mixed $user
Method Summary
 database database ([string $name = ""], [string $user = ""], [string $passwd = ""], [string $host = ""], integer $port)
 void affectedrows (mixed $rid)
 boolean begin_transaction ()
 boolean bool_from_db_value (mixed $dbvalue)
 boolean commit ()
 void connect (mixed $persistent)
 string convert_boolean_syntax (string $sql)
 integer current_sequencevalue (string $sequencename, string $table, string $column)
 mixed db_value_from_bool (boolean $boolvalue)
 void disconnect ()
 void errormessage (mixed $rid)
 void fetch_array (mixed $rid, mixed $rowno)
 void fetch_row (mixed $rid, mixed $rowno)
 void freeresult (mixed $rid)
 void lock (mixed $tablelist, mixed $mode)
 integer next_sequencevalue (string $sequencename, string $table, string $column)
 void numrows (mixed $rid)
 void query (mixed $sql)
 boolean rollback ()
 void set_char_encoding (mixed $encoding)
 void set_datestyle (mixed $datestyle)
 void set_sequencevalue (mixed $newval, mixed $sequencename, mixed $table, mixed $column)
 string SQL (pointer $sqlquery)
Variables
mixed $connected = false (line 561)

Flag true if database was connected ok

mixed $dbid = false (line 569)

Unique identifier for database access

mixed $executable_sql = "" (line 573)

The SQL statement last executed on this database. This

mixed $host = "" (line 553)

Host server of this database

mixed $name = "" (line 551)

Name of this database

mixed $passwd = "" (line 559)

Default password to connect as

mixed $persistent = false (line 566)

True if we want a persistent connection

mixed $port = 0 (line 555)

Port to access it via TCP

mixed $rid (line 577)

The result ID last returned by a query on this DB. Also

mixed $timer (line 580)

Microtimer for query execute timing

mixed $type = "" (line 549)

Type of database eg: "postgres", "mssql_server"..

mixed $user = "" (line 557)

Default user to connect as

Methods
Constructor database (line 590)

Constructor

database database ([string $name = ""], [string $user = ""], [string $passwd = ""], [string $host = ""], integer $port)
  • string $name: The database name
  • string $user: The username of user who can access the database
  • string $passwd: The user password which can access the database
  • string $host: The hostname of the machine running the database
  • integer $port: The port number of the database server
affectedrows (line 680)

This method must be defined in the child class.

  • abstract:
void affectedrows (mixed $rid)
begin_transaction (line 715)

Start a new database transaction.

  • return: Whether transaction was started or not
boolean begin_transaction ()
bool_from_db_value (line 742)

Return a Php boolean from a database field value. The database field is expected to be a container of some form of logical value. Here is where we convert it according to the current database.

  • return: The boolean value derived from the field value
boolean bool_from_db_value (mixed $dbvalue)
  • mixed $dbvalue: The value from the database field to convert
commit (line 723)

Commit the currently open database transaction.

  • return: Whether the commit succeeded or not
boolean commit ()
connect (line 610)

This method must be defined in the child class.

  • abstract:
void connect (mixed $persistent)
convert_boolean_syntax (line 887)

Make conversions of boolean syntax found in the SQL string and return the 'standardised' SQL. This assumes that Axyl SQL will be written in the form 'WHERE foo=TRUE'.

  • return: The converted SQL string
string convert_boolean_syntax (string $sql)
  • string $sql: SQL string to make conversions in
current_sequencevalue (line 764)

Return the current sequence value, given a sequence name, the table and the field it applies to.

  • return: The current sequence value
integer current_sequencevalue (string $sequencename, string $table, string $column)
  • string $sequencename: The name of the sequence to use
  • string $table: The name of the table the sequence is for
  • string $column: The name of the table column the sequence is for
db_value_from_bool (line 752)

Return a suitable database field value to contain the value for the given boolean.

  • return: The value suitable for the database field
mixed db_value_from_bool (boolean $boolvalue)
  • boolean $boolvalue: The boolean value to convert
disconnect (line 617)

This method must be defined in the child class.

  • abstract:
void disconnect ()
errormessage (line 693)

This method must be defined in the child class.

  • abstract:
void errormessage (mixed $rid)
fetch_array (line 707)

This method must be defined in the child class.

  • abstract:
void fetch_array (mixed $rid, mixed $rowno)
fetch_row (line 700)

This method must be defined in the child class.

  • abstract:
void fetch_row (mixed $rid, mixed $rowno)
freeresult (line 687)

This method must be defined in the child class.

  • abstract:
void freeresult (mixed $rid)
lock (line 810)

This method must be defined in the child class.

  • abstract:
void lock (mixed $tablelist, mixed $mode)
next_sequencevalue (line 782)

Return the next sequence value, given a sequence name, the table and the field it applies to.

  • return: The next sequence value
integer next_sequencevalue (string $sequencename, string $table, string $column)
  • string $sequencename: The name of the sequence to use
  • string $table: The name of the table the sequence is for
  • string $column: The name of the table column the sequence is for
numrows (line 673)

This method must be defined in the child class.

  • abstract:
void numrows (mixed $rid)
query (line 623)

This method must be defined in the child class.

  • abstract:
void query (mixed $sql)
rollback (line 731)

Rollback the currently open database transaction.

  • return: Whether the rollback succeeded or not
boolean rollback ()
set_char_encoding (line 803)

This method must be defined in the child class.

  • abstract:
void set_char_encoding (mixed $encoding)
set_datestyle (line 796)

This method must be defined in the child class.

  • abstract:
void set_datestyle (mixed $datestyle)
set_sequencevalue (line 789)

This method must be defined in the child class.

  • abstract:
void set_sequencevalue (mixed $newval, mixed $sequencename, mixed $table, mixed $column)
SQL (line 820)

Given an Axyl SQL query object, build the SQL string from it in suitable format for the currently connected database server.

  • return: The SQL string built from the query object
string SQL (pointer $sqlquery)
  • pointer $sqlquery: Pointer to an Axyl query object

Documentation generated by phpDocumentor 1.3.0RC3