tce_db_dal_mysql.php

MySQL driver for TCExam Database Abstraction Layer (DAL).

Source: shared/code/tce_db_dal_mysql.php

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

Functions

F_db_affected_rows()

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

function F_db_affected_rows(mixed $link_identifier, mixed $result): Number

Parameters:

  • $link_identifier (mixed): (resource) database link identifier.
  • $result (mixed): (resource) result resource to the query result [UNUSED].

Returns: Number: of rows.

Source: shared/code/tce_db_dal_mysql.php:122

F_db_close()

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

function F_db_close(mixed $link_identifier): bool

Parameters:

  • $link_identifier (mixed): (resource) database link identifier.

Returns: bool: TRUE on success or FALSE on failure

Source: shared/code/tce_db_dal_mysql.php:63

F_db_connect()

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

function F_db_connect(
    mixed $host = 'localhost',
    mixed $port = '3306',
    mixed $username = 'root',
    mixed $password = '',
    mixed $database = ''
): MySQL

Parameters:

  • $host (mixed): (string) database server host name.
  • $port (mixed): (string) database connection port
  • $username (mixed): (string) Name of the user that owns the server process.
  • $password (mixed): (string) Password of the user that owns the server process.
  • $database (mixed): (string) Database name.

Returns: MySQL: link identifier on success, or FALSE on failure.

Source: shared/code/tce_db_dal_mysql.php:36

F_db_datetime_diff_seconds()

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

function F_db_datetime_diff_seconds(mixed $start_date_field, mixed $end_date_field): SQL

Parameters:

  • $start_date_field (mixed)
  • $end_date_field (mixed)

Returns: SQL: query string

Source: shared/code/tce_db_dal_mysql.php:168

F_db_error()

Returns the text of the error message from previous database operation

function F_db_error(mixed $link_identifier = null): string

Parameters:

  • $link_identifier (mixed)

Returns: string: error message.

Source: shared/code/tce_db_dal_mysql.php:72

F_db_fetch_array()

Fetch a result row as an associative and numeric array.

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

function F_db_fetch_array(mixed $result): Returns

Parameters:

  • $result (mixed): (resource) result resource to the query result.

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

Source: shared/code/tce_db_dal_mysql.php:100

F_db_fetch_assoc()

Fetch a result row as an associative array.

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

function F_db_fetch_assoc(mixed $result): Returns

Parameters:

  • $result (mixed): (resource) result resource to the query result.

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

Source: shared/code/tce_db_dal_mysql.php:111

F_db_insert_id()

Get the ID generated from the previous INSERT operation

function F_db_insert_id(
    mixed $link_identifier,
    mixed $tablename = '',
    mixed $fieldname = ''
): int

Parameters:

  • $link_identifier (mixed): (resource) database link identifier.
  • $tablename (mixed): (string) Table name.
  • $fieldname (mixed): (string) Field name (column name).

Returns: int: ID generated from the last INSERT operation.

Source: shared/code/tce_db_dal_mysql.php:144

F_db_num_rows()

Get number of rows in result.

function F_db_num_rows(mixed $result): Number

Parameters:

  • $result (mixed): (resource) result resource to the query result.

Returns: Number: of affected rows.

Source: shared/code/tce_db_dal_mysql.php:132

F_db_query()

Sends a query to the currently active database on the server that’s associated with the specified link identifier.<br>

function F_db_query(mixed $query, mixed $link_identifier): false

Parameters:

  • $query (mixed): (string) The query tosend. The query string should not end with a semicolon.
  • $link_identifier (mixed): (resource) database link identifier.

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

Source: shared/code/tce_db_dal_mysql.php:87

F_escape_sql()

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

function F_escape_sql(mixed $link_identifier, mixed $str, mixed $stripslashes = true): string

Parameters:

  • $link_identifier (mixed): (resource) database link identifier.
  • $str (mixed): (string) The string that is to be escaped.
  • $stripslashes (mixed): (boolean) if true strip slashes from string

Returns: string: Returns the escaped string, or FALSE on error.

Source: shared/code/tce_db_dal_mysql.php:181