ZenphotoCMS 1.6.3

functions-db.php

Deprecated database core functions - Legacy backward compatibility wrapper for the active database handler class

Use the global object $_zp_db and its methods of the same name instead of these functions.

Within main object classes like album, image etc. the db handler object is generally also available via $this->db.

Tags
deprecated
2.0

Use the global database object variable $_zp_db and the class methods instead

since
1.6

Table of Contents

Functions

db_connect()  : true
Connect to the database server and select the database.
query()  : results
The main query function. Runs the SQL on the connection and handles errors.
query_single_row()  : results
Runs a SQL query and returns an associative array of the first row.
query_full_array()  : results
Runs a SQL query and returns an array of associative arrays of every row returned.
db_quote()  : string
mysqli_real_escape_string standin that insures the DB connection is passed.
db_insert_id()  : mixed
returns the insert id of the last database insert
db_fetch_assoc()  : mixed
Fetch a result row as an associative array
db_error()  : mixed
Returns the text of the error message from previous operation
db_affected_rows()  : mixed
Get number of affected rows in previous operation
db_fetch_row()  : mixed
Get a result row as an enumerated array
db_num_rows()  : mixed
Get number of rows in result
db_close()  : mixed
Closes the database
db_software()  : mixed
report the software of the database
db_create()  : mixed
create the database
db_permissions()  : mixed
Returns user's permissions on the database
db_setSQLmode()  : mixed
Sets the SQL session mode to empty
db_getSQLmode()  : mixed
Queries the SQL session mode
db_collation()  : mixed
db_create_table()  : mixed
db_table_update()  : mixed
db_show()  : mixed
db_list_fields()  : mixed
db_truncate_table()  : mixed
db_LIKE_escape()  : mixed
db_free_result()  : mixed
prefix()  : prefixed
Prefix a table name with a user-defined string to avoid conflicts.
getWhereClause()  : contructed
Constructs a WHERE clause ("WHERE uniqueid1='uniquevalue1' AND uniqueid2='uniquevalue2' ...") from an array (map) of variables and their values which identifies a unique record in the database table.
getSetClause()  : contructed
Constructs a SET clause ("SET uniqueid1='uniquevalue1', uniqueid2='uniquevalue2' ...") from an array (map) of variables and their values which identifies a unique record in the database table. Used to 'move' records. Note: does not check anything.
db_name()  : mixed
returns the connected database name
db_count()  : int
Counts entries in a db table
db_getServerInfo()  : string
Returns the server info
db_getClientInfo()  : string
Returns the client info
db_getVersion()  : int
Gets the plain version number

Functions

db_connect()

Connect to the database server and select the database.

db_connect(array<string|int, mixed> $config[, bool $errorstop = true ]) : true
Parameters
$config : array<string|int, mixed>

the db configuration parameters

$errorstop : bool = true

set to false to omit error messages

Tags
deprecated
2.0

Use the global object $_zp_db and the class method connect() instead.

since
1.6
Return values
true

if successful connection

query()

The main query function. Runs the SQL on the connection and handles errors.

query(string $sql[, bool $errorstop = true ]) : results
Parameters
$sql : string

sql code

$errorstop : bool = true

set to false to supress the error message

Tags
since
0.6
since
1.6
deprecated
2.0

Use the global object $_zp_db and the class method of the same name instead.

Return values
results

of the sql statements

query_single_row()

Runs a SQL query and returns an associative array of the first row.

query_single_row(string $sql[, bool $errorstop = true ]) : results

Doesn't handle multiple rows, so this should only be used for unique entries.

Parameters
$sql : string

sql code

$errorstop : bool = true

set to false to supress the error message

Tags
since
0.6
since
1.6
deprecated
2.0

Use the global object $_zp_db and the class method querySingleRow() instead.

Return values
results

of the sql statements

query_full_array()

Runs a SQL query and returns an array of associative arrays of every row returned.

query_full_array(string $sql[, bool $errorstop = true ][, string $key = NULL ]) : results
Parameters
$sql : string

sql code

$errorstop : bool = true

set to false to supress the error message

$key : string = NULL

optional array index key

Tags
since
0.6
since
1.6
deprecated
2.0

Use the global object $_zp_db and the class method queryFullArray() instead.

Return values
results

of the sql statements

db_quote()

mysqli_real_escape_string standin that insures the DB connection is passed.

db_quote(string $string[, mixed $addquotes = true ]) : string
Parameters
$string : string
$addquotes : mixed = true
Tags
deprecated
2.0

Use the global object $_zp_db and the class method quote() instead.

since
1.6
Return values
string

db_insert_id()

returns the insert id of the last database insert

db_insert_id() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method insertID() instead.

since
1.6

db_fetch_assoc()

Fetch a result row as an associative array

db_fetch_assoc(mixed $resource) : mixed
Parameters
$resource : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method fetchAssoc() instead.

since
1.6

db_error()

Returns the text of the error message from previous operation

db_error() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getError() instead.

since
1.6

db_affected_rows()

Get number of affected rows in previous operation

db_affected_rows() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getAffectedRows() instead.

since
1.6

db_fetch_row()

Get a result row as an enumerated array

db_fetch_row(mixed $result) : mixed
Parameters
$result : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method fetchRow() instead.

since
1.6

db_num_rows()

Get number of rows in result

db_num_rows(mixed $result) : mixed
Parameters
$result : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getNumRows() instead.

since
1.6

db_close()

Closes the database

db_close() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method close() instead.

since
1.6

db_software()

report the software of the database

db_software() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getSoftware() instead.

since
1.6

db_create()

create the database

db_create() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method create() instead

since
1.6

db_permissions()

Returns user's permissions on the database

db_permissions() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getPermissions() instead.

since
1.6

db_setSQLmode()

Sets the SQL session mode to empty

db_setSQLmode() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method setSQLmode() instead.

since
1.6

db_getSQLmode()

Queries the SQL session mode

db_getSQLmode() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getSQLmode() instead.

since
1.6

db_collation()

db_collation() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getCollation() instead.

since
1.6

db_create_table()

db_create_table(mixed $sql) : mixed
Parameters
$sql : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method createTable() instead.

since
1.6

db_table_update()

db_table_update(mixed $sql) : mixed
Parameters
$sql : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method tableUpdate() instead.

since
1.6

db_show()

db_show(mixed $what[, mixed $aux = '' ]) : mixed
Parameters
$what : mixed
$aux : mixed = ''
Tags
deprecated
2.0

Use the global object $_zp_db and the class method show() instead.

since
1.6

db_list_fields()

db_list_fields(mixed $table) : mixed
Parameters
$table : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method listFields() instead.

since
1.6

db_truncate_table()

db_truncate_table(mixed $table) : mixed
Parameters
$table : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method truncateTable() instead.

since
1.6

db_LIKE_escape()

db_LIKE_escape(mixed $str) : mixed
Parameters
$str : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method likeEscape() instead.

since
1.6

db_free_result()

db_free_result(mixed $result) : mixed
Parameters
$result : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method freeResult() instead.

since
1.6

prefix()

Prefix a table name with a user-defined string to avoid conflicts.

prefix([string $tablename = NULL ]) : prefixed

This MUST be used in all database queries.

Parameters
$tablename : string = NULL

name of the table

Tags
deprecated
2.0

Use the global object $_zp_db and the class method of the same name instead.

since
1.6
Return values
prefixed

table name

getWhereClause()

Constructs a WHERE clause ("WHERE uniqueid1='uniquevalue1' AND uniqueid2='uniquevalue2' ...") from an array (map) of variables and their values which identifies a unique record in the database table.

getWhereClause(string $unique_set) : contructed
Parameters
$unique_set : string

what to add to the WHERE clause

Tags
deprecated
2.0

Use the global object $_zp_db and the class method of the same name instead

since
1.6
Return values
contructed

WHERE cleause

getSetClause()

Constructs a SET clause ("SET uniqueid1='uniquevalue1', uniqueid2='uniquevalue2' ...") from an array (map) of variables and their values which identifies a unique record in the database table. Used to 'move' records. Note: does not check anything.

getSetClause(string $new_unique_set) : contructed
Parameters
$new_unique_set : string

what to add to the SET clause

Tags
since
0.6
since
1.6
deprecated
2.0

Use the global object $_zp_db and the class method of the same name instead

Return values
contructed

SET cleause

db_name()

returns the connected database name

db_name() : mixed
Tags
deprecated
2.0

Use the global object $_zp_db and the class method getDBName() instead.

since
1.6

db_count()

Counts entries in a db table

db_count(string $table[, string $clause = NULL ][, string $field = "id" ]) : int
Parameters
$table : string

Table name

$clause : string = NULL

Where clause for the count query

$field : string = "id"

Which fields to count (default: id)

Tags
deprecated
2.0

Use the global object $_zp_db and the class method count() instead.

since
1.6
Return values
int

db_getServerInfo()

Returns the server info

db_getServerInfo() : string
Tags
since
1.5.7
deprecated
2.0

Use the global object $_zp_db and the class method getServerInfo() instead.

Return values
string

db_getClientInfo()

Returns the client info

db_getClientInfo() : string
Tags
since
1.5.7
deprecated
2.0

Use the global object $_zp_db and the class method getClientInfo() instead.

Return values
string

db_getVersion()

Gets the plain version number

db_getVersion() : int
Tags
since
1.5.8
deprecate

ZenphotoCMS 2.0 Use the global object $_zp_db and the class method getVersion() instead.

Return values
int

        
On this page

Search results