files-shared-code-tce-db-dal-postgresql

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

tce_db_dal_postgresql.php

Tags
file

PostgreSQL driver for TCExam Database Abstraction Layer (DAL). This abstraction layer uses the same SQL syntax of MySQL.

author

Nicola Asuni

since
2004-12-21

Table of Contents

F_db_connect()  : PostgreSQL
Open a connection to a PostgreSQL Server and select a database.
F_db_close()  : bool
Closes the non-persistent connection to a database associated with the given connection resource.
F_db_error()  : string
Returns the text of the error message from previous database operation
F_db_query()  : false
Sends a query to the currently active database on the server that's associated with the specified link identifier.<br> NOTE: Convert MySQL RAND() function to PostgreSQL RANDOM() on ORDER BY clause of selection queries.
F_db_fetch_array()  : Returns
Fetch a result row as an associative and numeric array.
F_db_fetch_assoc()  : Returns
Fetch a result row as an associative array.
F_db_affected_rows()  : Number
Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.
F_db_num_rows()  : Number
Get number of rows in result.
F_db_insert_id()  : int
Get the ID generated from the previous INSERT operation
F_db_datetime_diff_seconds()  : SQL
Returns the SQL string to calculate the difference in seconds between to datetime fields.
F_escape_sql()  : string
Escape a string for insertion into a SQL text field (avoiding SQL injection).

Functions

F_db_connect()

Open a connection to a PostgreSQL Server and select a database.

F_db_connect([ $host = 'localhost' ][,  $port = '5432' ][,  $username = 'postgres' ][,  $password = '' ][,  $database = 'template1' ]) : PostgreSQL

If a second call is made to this function with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned.

Parameters
$host : = 'localhost'

(string) database server host name.

$port : = '5432'

(string) database connection port

$username : = 'postgres'

(string) Name of the user that owns the server process.

$password : = ''

(string) Password of the user that owns the server process.

$database : = 'template1'

(string) Database name.

Return values
PostgreSQL

link identifier on success, or FALSE on failure.

F_db_close()

Closes the non-persistent connection to a database associated with the given connection resource.

F_db_close( $link_identifier) : bool
Parameters
$link_identifier :

(resource) database link identifier.

Return values
bool

TRUE on success or FALSE on failure

F_db_error()

Returns the text of the error message from previous database operation

F_db_error([mixed $link_identifier = null ]) : string
Parameters
$link_identifier : mixed = null
Return values
string

error message.

F_db_query()

Sends a query to the currently active database on the server that's associated with the specified link identifier.<br> NOTE: Convert MySQL RAND() function to PostgreSQL RANDOM() on ORDER BY clause of selection queries.

F_db_query( $query,  $link_identifier) : false
Parameters
$query :

(string) The query tosend. The query string should not end with a semicolon.

$link_identifier :

(resource) database link identifier.

Return values
false

in case of error, TRUE or resource-identifier in case of success.

F_db_fetch_array()

Fetch a result row as an associative and numeric array.

F_db_fetch_array( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_fetch_assoc()

Fetch a result row as an associative array.

F_db_fetch_assoc( $result) : Returns

Note: This function sets NULL fields to PHP NULL value.

Parameters
$result :

(resource) result resource to the query result.

Return values
Returns

an array that corresponds to the fetched row, or FALSE if there are no more rows.

F_db_affected_rows()

Returns number of rows (tuples) affected by the last INSERT, UPDATE or DELETE query associated with link_identifier.

F_db_affected_rows( $link_identifier,  $result) : Number
Parameters
$link_identifier :

(resource) database link identifier [UNUSED].

$result :

(resource) result resource to the query result.

Return values
Number

of rows.

F_db_num_rows()

Get number of rows in result.

F_db_num_rows( $result) : Number
Parameters
$result :

(resource) result resource to the query result.

Return values
Number

of affected rows.

F_db_insert_id()

Get the ID generated from the previous INSERT operation

F_db_insert_id( $link_identifier[,  $tablename = '' ][,  $fieldname = '' ]) : int
Parameters
$link_identifier :

(resource) database link identifier.

$tablename : = ''

(string) Table name.

$fieldname : = ''

(string) Field name (column name).

Return values
int

ID generated from the last INSERT operation.

F_db_datetime_diff_seconds()

Returns the SQL string to calculate the difference in seconds between to datetime fields.

F_db_datetime_diff_seconds(mixed $start_date_field, mixed $end_date_field) : SQL
Parameters
$start_date_field : mixed
$end_date_field : mixed
Return values
SQL

query string

F_escape_sql()

Escape a string for insertion into a SQL text field (avoiding SQL injection).

F_escape_sql( $link_identifier,  $str[,  $stripslashes = true ]) : string
Parameters
$link_identifier :

(resource) database link identifier.

$str :

(string) The string that is to be escaped.

$stripslashes : = true

(boolean) if true strip slashes from string

Tags
since
5.0.005

2007-12-05

Return values
string

Returns the escaped string, or FALSE on error.

 

© 2004-2022 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy