OCI8 Database Class.
Located in /inc/oci8_class.php (line 101)
Class Constructor.
Whenever you instantiate this class the file dbdefs.inc.php will be included automatically. This file contains the default login data and other configuration options, see description inside this file for further informations. Since V0.72 you may optionally give an alternate file as configuration file. If no file is given inside the constructor the class still uses the file "dbdefs.inc.php" as default configuration file.
Returns count of affected rows.
Info is set in Query() and QueryResult() / FreeResult() and should return the amount of rows affected by previous DML command
Checks if we are already connected to our database.
If not terminates by calling Print_Error().
Clears the internal output hash array.
You are responsible to manage this yourself, the class only uses the variable!
Performs the connection to Oracle.
If anything goes wrong calls Print_Error(). Also an Oracle procedure is called to register the Application name as defined in dbdefs.inc.php, This helps DBAs to better fine tune their databases according to application needs.
Describes a table by returning an array with all table info.
Disconnects from Oracle.
You may optionally pass an external link identifier
Executes a prepare()d statement and returns the result.
You may then Fetch rows with FetchResult() or call FreeResult() to free your allocated result. V0.38: Execute() searches first our QueryCache before executing, this way we can use almost unlimited Queries at once in the Prepare/Execute pair
Executes a prepare()d statement and returns the result.
You may then fetch rows with FetchResult() or call FreeResult() to free your allocated result. This method is almost identical to "Execute()", however the bind variables used are passed as an associative array instead of "guessing" them from query and given parameter. This is now the prefered way to use bind variables!
Fetches next datarow.
Returns either numeric (OCI_NUM) or associative (OCI_ASSOC) array for one data row as pointed to by either internal or passed result var.
Frees result obtained by QueryResult().
You may optionally pass external Result handle, if you omit this parameter the internal handle is freed. This function also checks the built-in statement cache for the handle and removes it from cache, too.
Function extracts all bind vars out of given query.
To avoid wrong determined bind vars this function first kills out all TO_*() functions together with their (possible) format strings which results in a query containing only valid bind vars, format tags or other similar constructed tags are removed.
Returns current connection handle.
Returns either the internal connection socket or -1 if no active handle exists. Useful if you want to work with OCI* functions in parallel to this class.
Returns the number of retries in case of connection problems.
This value can be set globally inside the dbdefs.inc.php file via the OCIDB_CONNECT_RETRIES define but may be changed run-time also via the "setConnectRetries()" method.
This function tries to get the description for a given error message.
Simply pass the $err['message'] field to this function, it tries to extract the required informations and call $ORACLE_HOME/bin/oerr to get the error description. If either the exterr or the internal sqlerrmsg variables are empty this function returns: "No error found."
Returns microtime in format s.mmmmm.
Used to measure SQL execution time.
Returns amount of time spend on queries executed by this class.
Preparses a query but do not execute it (yet).
This allows to use a compiled query inside loops without having to parse it everytime Since 0.38 all prepared() queries will be put into our own QueryCache() so we can use the Prepare()/Execute()/ExecuteHash() pair for more than one query at once.
Handles debug output according to internal debug flag.
Prints out an Oracle error.
Tries to highlight the buggy SQL part of the query and dumps out as much informations as possible. This may lead however to security problems, in this case you can set DBOF_SHOW_NO_ERRORS and the Error informations are returned to the callee instead of being displayed on-screen. Since V0.64 the class is able to send an email error message, see dbdefs.inc.php
Performs a single row query with Bindvar support.
Resflag can be OCI_NUM or OCI_ASSOC depending on what kind of array you want to be returned. Remember to pass all required variables for all defined bind vars after the $no_exit parameter, else you will recieve errors because of wrong parameter count!
Performs a single row query with Bindvar support passed as associative hash.
Resflag can be OCI_NUM or OCI_ASSOC depending on what kind of array you want to be returned. Remember to pass all required variables for all defined bind vars after the $no_exit parameter as an assoc. array (Key = name of bindvar without ':', value = value to add).
Performs a multirow-query and returns result handle.
Required if you want to fetch many data rows. Does not return in case of error, so no further checking is required. Supports also binding, see Query() for further details.
Executes a query with parameters passed as hash values.
Also IN/OUT and RETURNING INTO <...> clauses are supported. You have to use FetchResult()/FreeResult() after using this function.
Removes query from cache.
Tries to remove a query from cache that was found by a previous call to SearchQueryCache().
Allows to save a file to a binary object field (BLOB).
Does not commit!
Searches internal query cache for given statement id.
Returns index of found statement id or -1 to indicate an error. This function is considered private and should NOT (!) be called from outside this class!
Sends an error email.
If OCIDB_SENTMAILONERROR is defined and != 0 the class sent out an error report to the configured email address in case of an error.
Allows to set internal socket to external value.
Note that the internal socket descriptor is only overriden if the class has no active connection stored! If already a connection was performed the class does not override it's internal handle to avoid problems!
Change the number of retries the class performs in case of connection problems.
This value is globally setable in the dbdefs.inc.php script (see define OCIDB_CONNECT_RETRIES) but can be set also run-time via this method.
Function allows debugging of SQL Queries.
$state can have these values:
Allows to set the handling of errors.
Use this function to pass output hash data to QueryHash() function.
This is only required if you are using RETURNING INTO clauses or OUT variables, if you only use the bind variables for input (IN) you do not need to set this. WARNING: You are responsible to clear the array by using clearOutputHash()!
Sets connection behavour.
If FALSE class uses oci_logon to connect. If TRUE class uses oci_plogon to connect (Persistant connection)
Allows to set the prefetch value when returning results.
Default is 1 which may lead to performance problems when data is transmitted via WAN.
Allows to en- or disable the SQL_TRACE feature of Oracle.
Pass TRUE to enable or FALSE to disable. When enabled all Statements of your session are saved in a tracefile stored in $ORACLE_BASE/admin/<DBNAME>/udump/*.trc After your session disconnects use the tkprof tool to generate Human-readable output from the tracefile, i.e.: $> tkprof oracle_ora_7527.trc out.txt Now read 'out.txt' and see what happen in Oracle!
Returns Oracle Server Version.
Opens an own connection if no active one exists.
Documentation generated on Tue, 22 Sep 2009 22:17:38 +0200 by phpDocumentor 1.4.2