Public Method Details |
sqlStorage |
public void sqlStorage( )
|
|
Constructor of SQL Storage Class.
|
Returns |
void |
|
getServer |
public string getServer( )
|
|
Get SQL server connect to.
|
Returns |
string Type of the SQL server eg. "MySQL" |
|
debugOn |
public void debugOn( )
|
|
Turn on a SQL debugger.
|
Returns |
void |
|
debugOff |
public void debugOff( )
|
|
Turn off a SQL debugger.
|
Returns |
void |
|
connect |
public void connect( string $host, string $user, string $password, string $name )
|
|
Open a connection to a SQL Server.
Stop HTML output and display an error message on failure.
|
Parameter |
|
string |
$host |
|
|
The hostname string can also include a port number. eg. "hostname:port". |
|
|
|
|
string |
$password |
|
|
Password |
|
|
|
Returns |
void |
See Also |
close() |
|
close |
public void close( )
|
|
Close a SQL connection.
This isn't usually necessary, as non-persistent open links are automatically closedat the end of the script's execution.
|
Returns |
void |
See Also |
connect() |
|
select_db |
public void select_db( string $database )
|
|
Select a SQL database.
Set the current active database on the server.
|
Parameter |
|
|
Returns |
void |
See Also |
connect() |
|
list_dbs |
public array list_dbs( )
|
|
List databases available on a SQL server .
Return an array of the database names available from the current sql daemon.
|
Returns |
array |
See Also |
list_tables(), list_fields() |
|
list_tables |
public array list_tables( [ string $database ] )
|
|
List tables in a SQL database.
Take a database name and returns an array of table names.
|
Parameter |
|
string |
$database |
= >>""<< |
|
DB Name |
|
Returns |
array |
See Also |
list_dbs(), list_fields() |
|
list_fields |
public array list_fields( string $table, [ string $database ] )
|
|
List SQL result fields.
Take a table name and returns an array of field names.
|
Parameter |
|
|
|
string |
$database |
= >>""<< |
|
DB Name (optional) |
|
Returns |
array |
See Also |
list_dbs(), list_tables() |
|
error |
public string error( )
|
|
Return the text of the error message from previous SQL operation.
Return the empty string if no error occurred.
|
Returns |
string |
|
free_result |
public integer free_result( )
|
|
Free result memory.
Only need to be called if you are worried about using too much memorywhile your script is running. All associated result memoryfor the specified result identifier will automatically be freed.
|
Returns |
integer |
|
query |
public integer query( string $query )
|
|
Send a SQL query.
The query string should not end with a semicolon.Return TRUE (non-zero) or FALSE to indicate whether or not the query succeeded.
|
Parameter |
|
|
Returns |
integer |
See Also |
select(), update(), insert(), delete() |
|
affected_rows |
public integer affected_rows( )
|
|
Get number of affected rows in previous SQL operation.
Return the number of rows affected by the last INSERT, UPDATE or DELETE query.If the last query was a DELETE query with no WHERE clause,all of the records will have been deleted from the table but this function will return zero.This method is not effective for SELECT statements, only on statements which modify records.
|
Returns |
integer |
See Also |
num_rows() |
|
select |
public integer select( string $tables, [ string $fields, string $conditions ] )
|
|
Send a SQL SELECT query.
Return TRUE (non-zero) or FALSE to indicate whether or not the query succeeded.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$fields |
= >>"*"<< |
|
Field name(s), can be also an array. If no specified select all fields. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
integer |
See Also |
query(), select_count(), select_exists(), select_record(), select_row(), select_column(), select_result() |
|
update |
public integer update( string $table, array $values, [ string $conditions ] )
|
|
Send a SQL UPDATE query.
Return TRUE (non-zero) or FALSE to indicate whether or not the query succeeded.
|
Parameter |
|
string |
$table |
|
|
Table name. |
|
|
array |
$values |
|
|
An associative array contains field name(s) as key(s). |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
integer |
See Also |
query() |
|
insert |
public integer insert( string $table, array $values )
|
|
Send a SQL INSERT query.
Return TRUE (non-zero) or FALSE to indicate whether or not the query succeeded.
|
Parameter |
|
string |
$table |
|
|
Table name. |
|
|
array |
$values |
|
|
An associative array contains field name(s) as key(s). |
|
Returns |
integer |
See Also |
query(), insert_id() |
|
delete |
public integer delete( string $table, [ string $conditions ] )
|
|
Send a SQL DELETE query.
Return TRUE (non-zero) or FALSE to indicate whether or not the query succeeded.
|
Parameter |
|
string |
$table |
|
|
Table name. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
integer |
See Also |
query() |
|
result |
public integer result( [ integer $row, integer $field ] )
|
|
Get result data.
Return the contents of one cell from a SQL result set.The field argument can be the field's offset, or the field's name,or the field's table dot field's name (fieldname.tablename).If the column name has been aliased ('select foo as bar from...'),use the alias instead of the column name.
|
Parameter |
|
|
|
|
Returns |
integer |
See Also |
fetch_row(), fetch_array(), fetch_object(), fetch_field(), fetch_fields(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
num_rows |
public integer num_rows( )
|
|
Get number of rows in result.
This method is only valid for SELECT statements.
|
Returns |
integer |
See Also |
affected_rows(), num_fields() |
|
num_fields |
public integer num_fields( )
|
|
Get number of fields in result.
This method is only valid for SELECT statements.
|
Returns |
integer |
See Also |
num_rows() |
|
fetch_row |
public array fetch_row( )
|
|
Get a result row as an enumerated array.
Fetch one row of data from the result associated with the specified result identifier.The row is returned as an array. Each result column is stored in an array offset,starting at offset 0.
|
Returns |
array |
See Also |
result(), fetch_array(), fetch_object(), fetch_field(), fetch_fields(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
fetch_array |
public array fetch_array( )
|
|
Fetch a result row as an associative array.
In addition to storing the data in the numeric indices of the result array,it also stores the data in associative indices, using the field names as keys.
|
Returns |
array |
See Also |
result(), fetch_row(), fetch_object(), fetch_field(), fetch_fields(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
fetch_object |
public Object fetch_object( [ integer $type ] )
|
|
Fetch a result row as an object.
Return an object with properties that correspond to the fetched row,or false if there are no more rows.
|
Parameter |
|
|
Returns |
Object |
See Also |
result(), fetch_row(), fetch_array(), fetch_field(), fetch_fields(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
fetch_field |
public Object fetch_field( integer $offset )
|
|
Get column information from a result and return as an object .
Can be used in order to obtain information about fields in a certain query result.If the field offset isn't specified, the next field that wasn't yet retrievedby fetch_field() is retrieved.
|
Parameter |
|
|
Returns |
Object |
See Also |
result(), fetch_row(), fetch_array(), fetch_object(), fetch_fields(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
fetch_fields |
public array fetch_fields( )
|
|
Get column information from a result and return as array of objects.
Can be used in order to obtain information about fields in a certain query result.
|
Returns |
array |
See Also |
result(), fetch_row(), fetch_array(), fetch_object(), fetch_field(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
fetch_result |
public array fetch_result( [ string $format ] )
|
|
Fetch all rows of result data into an multi-dimensional array.
Return a multi-dimensional array[row][field] or array[row] of objects depending on $format parameter.
|
Parameter |
|
string |
$format |
= >>fmtRow<< |
|
Accept the following constants: fmtRow, fmtArr, fmtObj. |
|
Returns |
array |
See Also |
result(), fetch_row(), fetch_array(), fetch_object(), fetch_field(), fetch_fields(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
fetch_rows |
public array fetch_rows( )
|
|
Fetch all rows of result data into an multi-dimensional array.
Return a multi-dimensional array[row][field].
|
Returns |
array |
See Also |
result(), fetch_row(), fetch_array(), fetch_object(), fetch_field(), fetch_fields(), fetch_result(), fetch_arrays(), fetch_objects() |
|
fetch_arrays |
public array fetch_arrays( )
|
|
Fetch all rows of result data into an multi-dimensional array.
Return a multi-dimensional array[row][field].
|
Returns |
array |
See Also |
result(), fetch_row(), fetch_array(), fetch_object(), fetch_field(), fetch_fields(), fetch_result(), fetch_rows(), fetch_objects() |
|
fetch_objects |
public array fetch_objects( )
|
|
Fetch all rows of result data.
Return an array[row] of objects.
|
Returns |
array |
See Also |
result(), fetch_row(), fetch_array(), fetch_field(), fetch_fields(), fetch_result(), fetch_rows(), fetch_arrays(), fetch_objects() |
|
insert_id |
public integer insert_id( )
|
|
Get the id generated from the previous INSERT operation.
Return the ID generated for an AUTO_INCREMENTED field.
|
Returns |
integer |
See Also |
insert() |
|
queryresult_exists |
public boolean queryresult_exists( )
|
|
Check if the previous SELECT operation returns result data.
Return TRUE if the previous SELECT operation returns result data.
|
Returns |
boolean |
See Also |
queryresult_record(), queryresult_column() |
|
queryresult_record |
public integer queryresult_record( )
|
|
Fetch next row and return value of the first field.
|
Returns |
integer |
See Also |
queryresult_exists(), queryresult_column() |
|
queryresult_column |
public array queryresult_column( )
|
|
Fetch all rows of result data and return values of the first column.
|
Returns |
array |
See Also |
queryresult_record(), queryresult_exists() |
|
select_exists |
public boolean select_exists( string $tables, [ string $conditions ] )
|
|
Send a SELECT query and check if result data is not empty.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
boolean |
See Also |
select(), select_count(), select_record(), select_row(), select_column(), select_result() |
|
select_count |
public integer select_count( string $tables, [ string $conditions ] )
|
|
Prepare and send a SELECT query to count number of rows for the specified conditions.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
integer |
See Also |
select(), select_exists(), select_record(), select_row(), select_column(), select_result() |
|
select_record |
public integer select_record( string $tables, string $fields, [ string $conditions ] )
|
|
Send a SELECT query and return value of the first row and the first field.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$fields |
|
|
Field name(s), can be also an array. If no specified select all fields. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
integer |
See Also |
select(), select_count(), select_exists(), select_row(), select_column(), select_result() |
|
select_row |
public array select_row( string $tables, string $fields, [ string $conditions ] )
|
|
Send a SELECT query and return the first result row as an associative array.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$fields |
|
|
Field name(s), can be also an array. If no specified select all fields. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
array |
See Also |
select(), select_count(), select_exists(), select_record(), select_column(), select_result() |
|
select_column |
public array select_column( string $tables, string $fields, [ string $conditions ] )
|
|
Send a SELECT query and return values of the first column.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$fields |
|
|
Field name(s), can be also an array. If no specified select all fields. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
Returns |
array |
See Also |
select(), select_count(), select_exists(), select_record(), select_row(), select_result() |
|
select_result |
public array select_result( string $tables, string $fields, [ string $conditions, string $format ] )
|
|
Send a SELECT query and return all rows of result data into an multi-dimensional array.
|
Parameter |
|
string |
$tables |
|
|
Table name(s), can be also an array. |
|
|
string |
$fields |
|
|
Field name(s), can be also an array. If no specified select all fields. |
|
|
string |
$conditions |
= >>""<< |
|
Condition, can be also an array. |
|
|
string |
$format |
= >>fmtArr<< |
|
Accept the following constants: fmtRow, fmtArr, fmtObj |
|
Returns |
array |
See Also |
select(), select_count(), select_exists(), select_record(), select_row(), select_column() |
|
search |
public array search( string $expression, string $table, [ string $field, string $fields, string $type, integer $limit ] )
|
|
Prepare and send a SELECT query according specified espression.
Return all rows of result data into an multi-dimensional array.
|
Parameter |
|
string |
$expression |
|
|
Expression. |
|
|
string |
$table |
|
|
Table name. |
|
|
string |
$field |
= >>""<< |
|
Field name. |
|
|
string |
$fields |
= >>"*"<< |
|
Field name(s), can be also an array. If no specified select all fields. |
|
|
string |
$type |
= >>SQL_PATTERN,<< |
|
Accept the following constants: SQL_PATTERN, REGEXP_PATTERN |
|
|
integer |
$limit |
= >>0<< |
|
Limit of result data. |
|
Returns |
array |
|