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 554)


	
			
Variable Summary
 mixed $connected
 mixed $datestyle
 mixed $dbid
 mixed $enc
 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, [string $enc = ""], [string $datestyle = ""])
 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 573)

Flag true if database was connected ok

mixed $datestyle = "UNICODE" (line 569)

The database internal date format/style

mixed $dbid = false (line 581)

Unique identifier for database access

mixed $enc = "" (line 571)

The database character encoding

mixed $executable_sql = "" (line 585)

The SQL statement last executed on this database. This

mixed $host = "" (line 561)

Host server of this database

mixed $name = "" (line 559)

Name of this database

mixed $passwd = "" (line 567)

Default password to connect as

mixed $persistent = false (line 578)

True if we want a persistent connection

mixed $port = 0 (line 563)

Port to access it via TCP

mixed $rid (line 589)

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

mixed $timer (line 592)

Microtimer for query execute timing

mixed $type = "" (line 557)

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

mixed $user = "" (line 565)

Default user to connect as

Methods
Constructor database (line 604)

Constructor

database database ([string $name = ""], [string $user = ""], [string $passwd = ""], [string $host = ""], integer $port, [string $enc = ""], [string $datestyle = ""])
  • 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
  • string $enc: The database character encoding (database dependent)
  • string $datestyle: The database date style (eg. 'ISO')
affectedrows (line 698)

This method must be defined in the child class.

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

Start a new database transaction.

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

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 741)

Commit the currently open database transaction.

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

This method must be defined in the child class.

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

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 782)

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 770)

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 635)

This method must be defined in the child class.

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

This method must be defined in the child class.

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

This method must be defined in the child class.

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

This method must be defined in the child class.

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

This method must be defined in the child class.

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

This method must be defined in the child class.

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

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 691)

This method must be defined in the child class.

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

This method must be defined in the child class.

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

Rollback the currently open database transaction.

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

This method must be defined in the child class.

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

This method must be defined in the child class.

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

This method must be defined in the child class.

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

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