TITAN Library for PHP5  5.1.0
Web Software Development Kit for PHP5
mysqli Class Reference

Titan SQL Database MySQLi Engine Class (deprecated: use \tl\io\pdo\mysql instead) More...

Public Member Functions

 __construct ($host, $user, $pass, $database= '')
 
 connect ($user= '', $pass= '', $host= '')
 
 close ()
 
 select ($database= '')
 
 get_error ()
 
get_field_names ($table)
 
get_field_defs ($table, $name_only=true)
 
 unquery ($query)
 
 free_result ()
 
 count ($table, $where= '1')
 
get_row ($query, $type= 'object')
 
get_rows ($query, $type= 'object')
 
get_rows_cb ($function, $query, $type= 'object')
 
get_rows_cc ($class, $method, $query, $type= 'object')
 
 rows_selected ()
 
 rows_affected ()
 
 slash ($text= '')
 
 insert ($obj, $table, $auto_increment= '')
 
 update ($obj, $table, $key1, $val1, $key2= '', $val2= '', $key3= '', $val3= '', $existing_obj=false)
 

Data Fields

 $database = ''
 Database server selected database.
 
 $connected = false
 Is a database server connected?
 
 $db_ready = false
 Is a database selected?
 
 $last_query = false
 Last query performed.
 
 $result = false
 Result handle of last executed query.
 
 $error = ''
 Error message, if any.
 

Detailed Description

Titan SQL Database MySQLi Engine Class (deprecated: use \tl\io\pdo\mysql instead)

Class: \tl\io\mysql

Author
James E. Bush work@.nosp@m.bush.nosp@m..cc
Version
5.1.0
Deprecated:
Use \tl\io\pdo\mysql instead.

Constructor & Destructor Documentation

__construct (   $host,
  $user,
  $pass,
  $database = '' 
)

mysqli object constructor

Parameters
string$hostdatabase server hostname[:port]
string$userdatabase server credentials: username
string$passdatabase server credentials: password
string$database(optional) database server selected default database (default) '' = do not select a database
Returns
mysqli Database connector object

Member Function Documentation

connect (   $user = '',
  $pass = '',
  $host = '' 
)

Connect to the database server.

Parameters
string$userdatabase server credentials: username
string$passdatabase server credentials: password
string$hostdatabase server hostname[:port]
close ( )

Close the connection to the database server and reset this object's internal properties.

select (   $database = '')

Select a default database on the database server.

Parameters
string$databasedatabase server selected default database
Returns
bool success or failure
get_error ( )

Check for an error

Returns
string database error
& get_field_names (   $table)

Get all field names in a table

Parameters
string$tabletable name to check
Returns
array array of field names
& get_field_defs (   $table,
  $name_only = true 
)

Get all field definitions in a table

Parameters
string$tabletable name to check
bool$name_onlyresult set: true = names only, false = full field definitions
Returns
array array of field names or definitions
unquery (   $query)

Execute an query that does not return anything (e.g. insert, update, call). If you call this with a select query, you will not get a result set.

Parameters
string$queryThe SQL query to execute
free_result ( )

Free the result set from the database server's memory

count (   $table,
  $where = '1' 
)

Count the number of records in $table matching $where

Parameters
string$tableThe table to check
string$whereSQL "where" clause (WITHOUT the word "where")
Returns
int The number of matching rows
& get_row (   $query,
  $type = 'object' 
)

Get a single row from the database

Parameters
string$queryThe SQL query to execute
string$typeEither 'object' (default), 'array', or 'assoc'
Returns
mixed (by reference) The resulting row
& get_rows (   $query,
  $type = 'object' 
)

Get an array of rows from the database

Parameters
string$queryThe SQL query to execute
string$typeEither 'object' (default), 'array', or 'assoc'
Returns
array (by reference) An array of the resulting rows
& get_rows_cb (   $function,
  $query,
  $type = 'object' 
)

Get a set of rows from the database. Applies a callback function to each row before adding it to the result array. The callback funcion should accept the object (or array) as its first parameter by reference! Then, if the callback sets the object to boolean false, the result is not added to the result array.

Parameters
string$functionThe callback function to use for each result
string$queryThe SQL query to execute
string$typeEither 'object' (default), 'array', or 'assoc'
Returns
array (by reference) An array of the resulting rows
& get_rows_cc (   $class,
  $method,
  $query,
  $type = 'object' 
)

Get a set of rows from the database. Applies a callback method to each row before adding it to the result array. The callback method should accept the object (or array) as its first parameter by reference! Then, if the callback sets the object to boolean false, the result is not added to the result array.

Parameters
string$classThe callback class to use for each result
string$methodThe callback method to use for each result
string$queryThe SQL query to execute
string$typeEither 'object' (default), 'array', or 'assoc'
Returns
array (by reference) An array of the resulting rows
rows_selected ( )
Returns
integer The number of rows returned by a select query.
rows_affected ( )
Returns
integer The number of rows affected by a non-select query.
slash (   $text = '')

Determine the data type and add slashes as needed.

Parameters
string$textThe string to escape
Returns
string The escaped string
insert (   $obj,
  $table,
  $auto_increment = '' 
)

Insert a single record, (optional) skip the auto_increment field if one exists

Parameters
object$objObject whose properties will be used to fill the table's fields.
string$tableName of the table to insert into.
boolean$auto_incrementName of the table's auto-increment field
Returns
bool Success?
update (   $obj,
  $table,
  $key1,
  $val1,
  $key2 = '',
  $val2 = '',
  $key3 = '',
  $val3 = '',
  $existing_obj = false 
)

Update a single record with up to three simple key/val indexes.

Parameters
object$objObject whose properties will be used to fill the table's fields
string$tableName of the table to insert into
string$key1Name of the first index field
string$val1Value to look for in the $key1 field
string$key2Name of the second index field
string$val2Value to look for in the $key2 field
string$key3Name of the third index field
string$val3Value to look for in the $key3 field
object$existing_objUse this object instead of selecting from the database (ignore, leave false)
Returns
bool Success?

The documentation for this class was generated from the following file: