Variable Reference
There are a number of variables available to coders using the phpBB Database Abstraction Layer.
A summary of these variables and when they are available follows. All data in this section is based on phpBB 2.0.6 DBAL files (but is consistent across most phpBB 2.0 versions). Each variable is described in the following manner.
Supported Database Layers (The database types for which this variable is available.)
Description (What the variable stores, and what that can be used to accomplish.)
Also, please see these special notes about some variables.
Variable Index
These variables are available at all times after a database connection has been established.
The following variables are present in only some of the DBAL files. Since they are not supported for all databases, using them directly in code may produce incorrect results. Many of these correspond to DBAL functions that should be used instead.
- row
- rowset
- query_result
- in_transaction
- next_id
- result
- current_row
- field_names
- field_types
- num_rows
- result_rowset
- limit_offset
- row_index
The following variables are present in some DBAL files, but are not used.
About Oracle
Please note that references to the DBAL for Oracle databases are included, but official support for Oracle was removed in phpBB 2.0.14.
All
Stores a connection resource or link identifier associated with the database connection. This can be used in functions that access the database and to check for a valid database connection.
All
Stores the total number of queries that have been executed in the script at this point. Useful in "page generation time" type scripts.
MySQL 3, MySQL 4, MS SQL, PostgreSQL, Oracle, ODBC
An array holding a single result row from a query. Cannot be used until the sql_fetchrow function has been called, so it is better to use that function to store the row in your own variable.
MySQL 3, MySQL 4, MS SQL, PostgreSQL, Oracle, ODBC
An array used to hold a single result row from a query. The row is then added to an array of all the result rows. Internal use varies for some database types, so use the sql_fetchrowset function instead of accessing this variable directly.
MySQL 3, MySQL 4, PostgreSQL, Oracle, ODBC
Stores a resource link identifier associated with the result of an SQL query. Can be used in functions that access the result of a query or check for a valid result. See also: $db->result.
MySQL 4, MS SQL, Oracle, PostgreSQL
Used to indicate if an SQL transaction is in progress.
MS Access, MS SQL, MS SQL (ODBC), ODBC
Stores the ID number generated by a query. Examples would be user ID numbers. topic ID numbers, etc. This variable should not be used outside of the DBAL. Use the sql_nextid function instead.
MS Access, MS SQL, MS SQL (ODBC)
Stores a resource link identifier associated with the result of an SQL query. Can be used in functions that access the result of a query or check for a valid result. See also: $db->query_result.
MS Access, MS SQL (ODBC)
Holds the row number of the current row. Can be used in functions that change this number (e.g., for skipping or repeating rows).
MS Access, MS SQL (ODBC)
An array storing the names of fields contained in a result. Can be used for displaying this information, among other things. There are DBAL functions that could also be used for this purpose.
MS Access, MS SQL (ODBC)
An array storing the types of fields contained in a result. Can be used for displaying this information, among other things. There are DBAL functions that could also be used for this purpose.
MS Access, MS SQL (ODBC)
Stores the number of rows returned or affected by a query. Also used to determine the number of of rows to return when LIMIT is used in a query. This variable should not be used outside of the DBAL. Use the sql_numrows function instead.
MS Access, MS SQL (ODBC)
Stores a set of result rows from a query. Could be used to process an entire set of results at once. This variable should not be used outside of the DBAL. Use the sql_fetchrowset function instead.
MS SQL
Used to store the offset that should be used to limit results used. Use is not recommended.
ODBC
Holds the row number of the current row. Can be used in functions that change this number (e.g., for skipping or repeating rows).
MS Access
Unknown. It does not appear to be used anywhere in phpBB.
MS SQL
Unknown. It does not appear to be used anywhere in phpBB.
Oracle
Unknown.
ODBC
Unknown. It does not appear to be used anywhere in phpBB.
ODBC
Unknown. It does not appear to be used anywhere in phpBB.
