Class Sql

Description

The Sql class is a wrapper for the ADOdb or ADOdb Lite library.

This class loads all SQL queries from SQL_FILE (defined at the top). Several methods are defined that simplify making queries.

Located in /phpfw.php (line 3733)


	
			
Variable Summary
object ADOConnection $connection
object ADODB2_drivername $dictionary
array $queries
Method Summary
Sql Sql (string $adodb, string $type, string $host, string $user, string $pass, string $name, string $sql_file)
object ADORecordSet &execute_query (string $name, string $args)
array select_query ()
void test_update (string $name)
void update_query ()
Variables
object ADOConnection $connection (line 3747)
  • var: Connection to the server
object ADODB2_drivername $dictionary (line 3752)
  • var: Data dictionary for this table
array $queries (line 3742)
  • var:

    An associative array of queries.

    $queries['QUERY_NAME'] = "SQL query syntax".

    Queries are loaded from SQL_FILE. All instances of '%s' in the query string are replaced at run time with values specified in the _query() methods below.

Methods
Constructor Sql (line 3768)

Constructor for the Sql class

  • Loads queries from file
  • Load the ADOdb/ADOdb Lite library

Sql Sql (string $adodb, string $type, string $host, string $user, string $pass, string $name, string $sql_file)
  • string $adodb: Path to the ADOdb or ADOdb Lite library
  • string $type: Type of database being used
  • string $host: Hostname of server where database is running
  • string $user: User name to connect with
  • string $pass: Password to connect with
  • string $name: Name of the database to select
  • string $sql_file: Path to the SQL ini file
execute_query (line 3798)

Execute a query on this Sql connection.

Function creates query based on specified query name and parameters. It then executes the query and returns the result. This function is called by the other _query() functions below.

  • return: Returns an ADOdb result object
object ADORecordSet &execute_query (string $name, string $args)
  • string $name: Name of the query
  • string $args: Arguments for the query
get_last_inserted_id (line 3929)

Get the ID of the last inserted value

  • return: ID of the last value inserted
int get_last_inserted_id ()
select_query (line 3848)

Perform a select query

Function expects the first argument to be the name of the query to execute. Query is loaded from Sql::$queries[$query].

  • return: Returns an array of rows returned for the query or null if no rows.
array select_query ()
test_update (line 3835)

Check if an insert, update or delete succeeded

void test_update (string $name)
  • string $name: Name of the query executed
update_query (line 3893)

Perform an insert, update or delete query

Function expects the first argument to be the name of the query to execute. Query is loaded from Sql::$queries[$query].

Set the last argument to "nocheck" if not required to check if the update worked.

void update_query ()

Documentation generated on Sat, 23 Jun 2007 21:28:27 -0500 by phpDocumentor 1.3.2