go-database
[ class tree: go-database ] [ index: go-database ] [ all elements ]

Class: base_db

Source Location: /classes/database/base_db.class.inc.php

Class Overview


Class that connects to MySQL using the MySQLi extension


Author(s):

Version:

  • $Id: imap.class.inc 1201 2008-10-22 18:23:34Z mschering $

Variables

Methods


Child classes:

db
Class that connects to MySQL using the MySQLi extension

Class Details

[line 24]
Class that connects to MySQL using the MySQLi extension

Tags:

author:  Merijn Schering <mschering@intermesh.nl>
version:  $Id: imap.class.inc 1201 2008-10-22 18:23:34Z mschering $
access:  public


[ Top ]


Class Variables

$database =  ""

[line 38]

The database name
Type:   string


[ Top ]

$debug =  false

[line 59]

Set to true for debugging messages.
Type:   bool


[ Top ]

$errno =  0

[line 94]

Database error number
Type:   int


[ Top ]

$error =  ""

[line 101]

Database error message
Type:   string


[ Top ]

$halt_on_error =  "yes"

[line 66]

"yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
Type:   string


[ Top ]

$host =  ""

[line 31]

The database host
Type:   string


[ Top ]

$link =  false

[line 115]

The database connection link identifier
Type:   resource


[ Top ]

$locked =  false

[line 129]

True when a table is locked
Type:   bool


[ Top ]

$password =  ""

[line 52]

The database password
Type:   string


[ Top ]

$record = array()

[line 80]

The current record from a select query
Type:   array


[ Top ]

$result =  false

[line 122]

The result object from a query
Type:   resource


[ Top ]

$row =

[line 87]

The current row index when waling through a result set
Type:   unknown_type


[ Top ]

$seq_table =  "go_db_sequence"

[line 73]

The sequence table to use for autoincrementing numbers.
Type:   unknown_type


[ Top ]

$type =  "mysqli"

[line 108]

Type of database connector
Type:   string


[ Top ]

$user =  ""

[line 45]

The database username
Type:   string


[ Top ]



Class Methods


constructor __construct [line 138]

db __construct( [unknown_type $config = null])

Constructor a config object with db_host, db_pass, db_user and db_name may be passed so it can connect to a different database then the default.

Tags:

access:  public

Overridden in child classes as:

GO_LINKS::__construct()
GO_USERS::__construct()
The constructor initializes the SQL database connection.
GO_AUTH::__construct()
GO_MODULES::__construct()
Constructor. Loads all installed modules into the modules array
GO_GROUPS::__construct()
Constructor. Calls parent class base_groups constructor
GO_SECURITY::__construct()
Constructor. Initialises base class of the security class family
smtp_restrict::__construct()

Parameters:

unknown_type   $config  

[ Top ]

method affected_rows [line 391]

int affected_rows( )

Gets the number of affected rows in a previous MySQL operatio

Overridden in child classes as:

db::affected_rows()
Gets the number of affected rows in a previous MySQL operatio

[ Top ]

method connect [line 199]

resource connect( )

Connnects to the database

Tags:

return:  The connection link identifier
access:  public

Overridden in child classes as:

db::connect()
Connnects to the database

[ Top ]

method escape [line 548]

mixed escape( mixed $value, [bool $trim = true])

Escapes a value to make it safe to send to MySQL

Tags:

return:  the escaped value.
access:  public

Overridden in child classes as:

db::escape()
Escapes a value to make it safe to send to MySQL

Parameters:

mixed   $value  
bool   $trim   Trim the value

[ Top ]

method f [line 300]

mixed f( string $name)

Fetch a single field from a result record

Tags:

return:  the field value
access:  public

Parameters:

string   $name   Field name or index

[ Top ]

method found_rows [line 230]

unknown found_rows( )

Returns the number of rows found when you have used SELECT SQL_CALC_FOUND_ROWS

Tags:

access:  public

Overridden in child classes as:

db::found_rows()
Returns the number of rows found when you have used SELECT SQL_CALC_FOUND_ROWS

[ Top ]

method free [line 207]

void free( )

Frees the memory associated with a result

return void

Overridden in child classes as:

db::free()
Frees the memory associated with a result

[ Top ]

method halt [line 576]

void halt( unknown_type $msg)

Halts when an error occurs

Tags:

access:  protected

Parameters:

unknown_type   $msg  

[ Top ]

method insert_id [line 557]

int insert_id( )

Returns the auto generated id used in the last query

Tags:

access:  public

Overridden in child classes as:

db::insert_id()
Returns the auto generated id used in the last query

[ Top ]

method insert_row [line 485]

bool insert_row( string $table, array $fields, [string $types = ''], [bool $trim = true], [ $replace = false])

Inserts a row in a table

Tags:

access:  public

Parameters:

string   $table   The table name
array   $fields   An associative array with fieldname=>value
string   $types   The types of the parameters. possible values: i, d, s, b for integet, double, string and blob
bool   $trim   Trim values in the array
   $replace  

[ Top ]

method lock [line 251]

unknown lock( string $table, [string $mode = "write"])

Lock a table

Tags:

access:  public

Parameters:

string   $table  
string   $mode   Modes are: "read", "read local", "write", "low priority write"

[ Top ]

method nextid [line 325]

int nextid( string $seq_name)

Get a next unique ID for a table. Used instead of auto increment so that we have better support for different database backends.

Tags:

return:  the next unique ID
access:  public

Parameters:

string   $seq_name  

[ Top ]

method next_record [line 240]

unknown next_record( [int $result_type = DB_ASSOC])

Walk the reseult set from a select query

Tags:

access:  public

Overridden in child classes as:

db::next_record()
Walk the result set from a select query

Parameters:

int   $result_type   DB_ASSOC, DB_BOTH or DB_NUM

[ Top ]

method num_fields [line 400]

int num_fields( )

Get the number of fields in a result

Overridden in child classes as:

db::num_fields()
Get the number of fields in a result

[ Top ]

method num_rows [line 383]

int num_rows( )

Return the number of rows found in the last select statement

Tags:

return:  Number of rows
access:  public

Overridden in child classes as:

db::num_rows()
Return the number of rows found in the last select statement

[ Top ]

method p [line 312]

mixed p( string $name)

Print a single field from a result record.

Tags:

return:  the field value
access:  public

Parameters:

string   $name   Field name or index

[ Top ]

method query [line 219]

object The query( string $sql, [string $types = ''], [mixed $params = array()])

Queries the database

Tags:

return:  result object
access:  public

Overridden in child classes as:

db::query()
Queries the database

Parameters:

string   $sql  
string   $types   The types of the parameters. possible values: i, d, s, b for integet, double, string and blob
mixed   $params   If a single or an array of parameters are given in the statement will be prepared

[ Top ]

method replace_row [line 536]

bool replace_row( string $table, array $fields, string $types, [bool $trim = true], string $index)

Replaces a row in a table

Tags:

access:  public

Parameters:

string   $table   The table name
string   $index   The field name to select on ( WHERE '$index'=1). This field must be present in the $fields parameter
array   $fields   An associative array with fieldname=>value
string   $types   The types of the parameters. possible values: i, d, s, b for integet, double, string and blob
bool   $trim   Trim values in the array

[ Top ]

method set_config [line 150]

void set_config( [object $config = null])

Set's the connection parameters. A config object with db_host, db_pass, db_user and db_name may be passed so it can connect to a different database then the default.

Tags:

access:  public

Parameters:

object   $config  

[ Top ]

method set_error [line 566]

void set_error( )

Sets the error and errno property

Tags:

access:  protected

Overridden in child classes as:

db::set_error()
Sets the error and errno property

[ Top ]

method set_parameters [line 185]

void set_parameters( string $host, string $database, string $user, string $pass)

Set the connection parameters manually

Tags:

access:  public

Parameters:

string   $host  
string   $database  
string   $user  
string   $pass  

[ Top ]

method unlock [line 282]

bool unlock( )

Unlock tables

Tags:

return:  True on success
access:  public
[ Top ]

method update_row [line 414]

bool update_row( string $table, string $index, array $fields, [string $types = ''], [bool $trim = true])

Updates a row from a table

Tags:

access:  public

Parameters:

string   $table   The table name
string   $index   The field name to select on ( WHERE '$index'=1). This field must be present in the $fields parameter
array   $fields   An associative array with fieldname=>value
string   $types   The types of the parameters. possible values: i, d, s, b for integet, double, string and blob
bool   $trim   Trim values in the array

[ Top ]


Documentation generated on Thu, 30 Oct 2008 14:13:23 +0100 by phpDocumentor 1.4.0