MaxDB PHP ExtensionMaxDB
&reftitle.intro;
The MaxDB PHP extension allows you to access the functionality provided by
MaxDB 7.5.0 and above. More information about the MaxDB Database server
can be found at &url.maxdb;.
The MaxDB PHP extension is compatible to the MySQL mysqli extension. There are only
minor differences in the behaviour of some functions due to the differences of the
underlying database servers, MaxDB and MySQL.
The main differences to mysqli are in the following functions:
maxdb_character_set_name - Returns only ascii or unicode.maxdb_get_client_info - Returns a different version string.maxdb_get_client_version - Returns a different version string.maxdb_get_host_info - Returns localhost or hostname.maxdb_get_server_info - Returns a different version string.maxdb_get_server_version - Returns a different version string.maxdb_kill - Only disconnects the session.maxdb_multi_query - Can not handle multiple SQL statements.maxdb_next_result - Function returns always false.maxdb_options - Supports a different set of options.maxdb_report - Supports a different report mode.maxdb_stat - Returns a different system status string.maxdb_stmt_store_result - Is not necessary for MaxDB.maxdb_store_result - Is not necessary for MaxDB.
Documentation for MaxDB can be found at
&url.maxdb.doc;.
&reftitle.required;
In order to have these functions available, you must compile PHP with
MaxDB support. Additionally, you must have the MaxDB SQLDBC runtime library
available to access the MaxDB server.
Documentation for MaxDB SQLDBC can be found at
&url.maxdb.doc;.
Download the MaxDB SQLDBC package from
&url.maxdb.sdbc;.
&reference.maxdb.configure;
&reference.maxdb.ini;
&reftitle.classes;
maxdb
Represents a connection between PHP and a MaxDB database.
&reftitle.constructor;
maxdb - construct a new maxdb object
&reftitle.methods;
autocommit - turns on or off auto-commiting database modificationschange_user - changes the user of the specified database connectioncharacter_set_name - returns the default character set for the database connectionclose - closes a previously opened connectioncommit - commits the current transactionconnect - opens a new connection to MaxDB database serverdebug - performs debugging operationsdump_debug_info - dumps debug informationget_client_info - returns client versionget_host_info - returns type of connection usedget_server_info - returns version of the MaxDB serverget_server_version - returns version of the MaxDB serverinit - initializes maxdb objectinfo - retrieves information about the most recently executed querykill - asks the server to kill a MaxDB threadmulti_query - performs multiple queriesmore_results - check if more results exist from currently executed multi-querynext_result - reads next result from currently executed multi-queryoptions - set optionsping - pings a server connection or reconnects if there is no connectionprepare - prepares a SQL queryquery - performs a queryreal_connect - attempts to open a connection to MaxDB database serverescape_string - escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connectionrollback - rolls back the current transactionselect_db - selects the default databasessl_set - sets ssl parametersstat - gets the current system statusstmt_init- initializes a statement for use with maxdb_stmt_preparestore_result - transfers a resultset from last queryuse_result - transfers an unbuffered resultset from last querythread-safe - returns whether thread safety is given or not
&reftitle.properties;
affected_rows - gets the number of affected rows in a previous MaxDB operationclient_info - returns the MaxDB client version as a stringclient_version - returns the MaxDB client version as an integererrno - returns the error code for the most recent function callerror - returns the error string for the most recent function callfield_count - returns the number of columns for the most recent queryhost_info - returns a string representing the type of connection usedinfo - retrieves information about the most recently executed queryinsert_id - returns the auto generated id used in the last queryprotocol_version - returns the version of the MaxDB protocol usedsqlstate - returns a string containing the SQLSTATE error code for the last errorthread_id - returns the thread ID for the current connectionwarning_count - returns the number of warnings generated during execution of the previous SQL statementmaxdb_stmt
Represents a prepared statement.
&reftitle.methods;
bind_param - binds variables to a prepared statementbind_result - binds variables to a prepared statement for result storageclose - closes a prepared statementdata-seek - seeks to an arbitrary row in a statement result setexecute - executes a prepared statementfetch - fetches result from a prepared statement into bound variablesfree_result - frees stored result memory for the given statement handleresult_metadata - retrieves a resultset from a prepared statement for metadata informationprepare - prepares a SQL querysend_long_data - sends data in chunksclose_long_data - end sending long datareset - resets a prepared statementstore_result - buffers complete resultset from a prepared statement
&reftitle.properties;
affected_rows - returns affected rows from last statement executionerrno - returns errorcode for last statement functionerrno - returns errormessage for last statement functionparam_count - returns number of parameter for a given prepare statementsqlstate - returns a string containing the SQLSTATE error code for the last statement functionmaxdb_result
Represents the result set obtained from a query against the database.
&reftitle.methods;
close - closes resultsetdata_seek - moves internal result pointerfetch_field - gets column information from a resultsetfetch_fields - gets information for all columns from a resulsetfetch_field_direct - gets column information for specified columnfetch_array - fetches a result row as an associative array, a numeric array, or both.fetch_assoc - fetches a result row as an associative arrayfetch_object - fetches a result row as an objectfetch_row - gets a result row as an enumerated arrayclose - frees result memoryfield_seek - set result pointer to a specified field offset
&reftitle.properties;
current_field - returns offset of current fieldpointerfield_count - returns number of fields in resultsetlengths - returns an array of columnlengthsnum_rows - returns number of rows in resultset
&reference.maxdb.constants;
&reftitle.examples;
All examples in the MaxDB PHP documentation use the HOTELDB demo database from MaxDB. More about this
database can be found at &url.maxdb.sampledb;.
To use the examples in the MaxDB PHP documentation, you have to load the tutorial data into your database.
Then you have to set maxdb.default_db in &php.ini; to the database that contains the tutorial data.
This simple example shows how to connect, execute a query, print
resulting rows and disconnect from a MaxDB database.
MaxDB extension overview example
\n";
while ($line = maxdb_fetch_array($result, MAXDB_ASSOC)) {
echo "
\n";
foreach ($line as $col_value) {
echo "
$col_value
\n";
}
echo "
\n";
}
echo "\n";
/* Free resultset */
maxdb_free_result($result);
/* Closing connection */
maxdb_close($link);
?>
]]>
The following example shows how to bind variables to a SELECT INTO statement.
Example for use of SELECT INTO statements
]]>
The following example shows how to use MaxDB database procedures.
Example fore using database procedures
]]>
&reference.maxdb.functions;