Home
About INAN
About Glial
Downloads
Documentation
FAQ
Features
Join the Team

INAN Database Functionality

This is a brief outline of the current state of the database functionality implemented in INAN in the file database.inc. Only features that have actually been coded are listed. I have adopted the convention gDB$foo for assigning names to database functions, where $foo is derived from PHP function names for a given action.

I have ported, for the moment, the operations common to MS SQL, MySQL, and PostgreSQL. I am aware that there are far more MySQL operations supported by PHP than appear in this list, and there are some odd PostgreSQL bits dealing with large object support that are not here, either. Note also that there are a few MS SQL functions in PHP that I have not coded b/c their analogues do not appear in MySQL or PostgreSQL.

Function Description Platform
gDBClose() Close an open connection to a database. MY/MS/PG
gDBConnect() Open a connection to a database. MY/MS/PG
gDBDataSeek() Move to a specified row in a result set. (1) MY/MS/PG
gDBDumpTable() Write the contents of a database table to the screen. MY/MS/PG
gDBFetchArray() Fetch the next row from a result set as an array. MY/MS/PG
gDBFetchField() Fetch a specified field from a result set. (2) MY/MS
gDBFetchObject() Fetch the next row in a result set as an object. (3) MY/MS/PG
gDBFetchRow() Fetch the next row from a result set as an enumerated array. MY/MS/PG
gDBFieldLength() Return the length of a given field from a result set. MY/MS/PG
gDBFieldName() Return the name of a given field from a result set. MY/MS/PG
gDBFieldSeek() Move the database pointer to the specified field. If gDBFetchField() is called without a field offset after gDBFieldSeek() is invoked, the field under the pointer is the one that will be returned. MY/MS/PG
gDBFieldType() Determine the type of the specified field. MY/MS/PG
gDBFreeResult() Free the memory used by a result set. MY/MS/PG
gDBNumFields() Return the number of fields in a resultset. MY/MS/PG
gDBNumRows() Return the number of rows in a resultset. MY/MS/PG
gDBPConnect() Open a persistent connection to a database. MY/MS/PG
gDBQuery() Submit a query to a database. MY/MS/PG
gDBResult() Return the contents of a cell specified by a given row and field identifier. MY/MS/PG
gDBSelectDB() Set the currently open database to the database specified in the function call. (4) MY/MS

Key : MY = MySQL, MS = MS SQL Server, PG = PostgreSQL.

(1) The pg_Fetch_Row() function serves the same role for PostgreSQL databases that the _data_seek() functions perform for MS SQL and MySQL. gDBDataSeek will work correctly if you are using Postgres because it calls pg_Fetch_Row(). In short, gDBFetchRow() and gDBDataSeek() should return identical results when you are using Postgres.

(2) PostgreSQL does not have a statement equivalent to the _fetch_field() action supported by MS SQL and MySQL. If you forget and call gDBFetchField() with your database type set to pgsql, the function will return an error.

(3) The PHP function for MS SQL databases does not allow you to specify an object type for the return value from _fetch_object(). If you try and pass two arguments to gDBFetchObject() when your database type is mssql, the second argument will be ignored.

(4) PostgreSQL support in PHP 4.0.2 does not support a _select_db()-type function. If you forget this and call gDBSelectDB(), it will return a "nice" error message.

Questions? Comments? Flame to spit or venom to spew? Send e-mail to the author!