MaxDB PHP Extension MaxDB
&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;
<classname>maxdb</classname> 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 modifications change_user - changes the user of the specified database connection character_set_name - returns the default character set for the database connection close - closes a previously opened connection commit - commits the current transaction connect - opens a new connection to MaxDB database server debug - performs debugging operations dump_debug_info - dumps debug information get_client_info - returns client version get_host_info - returns type of connection used get_server_info - returns version of the MaxDB server get_server_version - returns version of the MaxDB server init - initializes maxdb object info - retrieves information about the most recently executed query kill - asks the server to kill a MaxDB thread multi_query - performs multiple queries more_results - check if more results exist from currently executed multi-query next_result - reads next result from currently executed multi-query options - set options ping - pings a server connection or reconnects if there is no connection prepare - prepares a SQL query query - performs a query real_connect - attempts to open a connection to MaxDB database server escape_string - escapes special characters in a string for use in a SQL statement, taking into account the current charset of the connection rollback - rolls back the current transaction select_db - selects the default database ssl_set - sets ssl parameters stat - gets the current system status stmt_init- initializes a statement for use with maxdb_stmt_prepare store_result - transfers a resultset from last query use_result - transfers an unbuffered resultset from last query thread-safe - returns whether thread safety is given or not
&reftitle.properties; affected_rows - gets the number of affected rows in a previous MaxDB operation client_info - returns the MaxDB client version as a string client_version - returns the MaxDB client version as an integer errno - returns the error code for the most recent function call error - returns the error string for the most recent function call field_count - returns the number of columns for the most recent query host_info - returns a string representing the type of connection used info - retrieves information about the most recently executed query insert_id - returns the auto generated id used in the last query protocol_version - returns the version of the MaxDB protocol used sqlstate - returns a string containing the SQLSTATE error code for the last error thread_id - returns the thread ID for the current connection warning_count - returns the number of warnings generated during execution of the previous SQL statement
<classname>maxdb_stmt</classname> Represents a prepared statement.
&reftitle.methods; bind_param - binds variables to a prepared statement bind_result - binds variables to a prepared statement for result storage close - closes a prepared statement data-seek - seeks to an arbitrary row in a statement result set execute - executes a prepared statement fetch - fetches result from a prepared statement into bound variables free_result - frees stored result memory for the given statement handle result_metadata - retrieves a resultset from a prepared statement for metadata information prepare - prepares a SQL query send_long_data - sends data in chunks close_long_data - end sending long data reset - resets a prepared statement store_result - buffers complete resultset from a prepared statement
&reftitle.properties; affected_rows - returns affected rows from last statement execution errno - returns errorcode for last statement function errno - returns errormessage for last statement function param_count - returns number of parameter for a given prepare statement sqlstate - returns a string containing the SQLSTATE error code for the last statement function
<classname>maxdb_result</classname> Represents the result set obtained from a query against the database.
&reftitle.methods; close - closes resultset data_seek - moves internal result pointer fetch_field - gets column information from a resultset fetch_fields - gets information for all columns from a resulset fetch_field_direct - gets column information for specified column fetch_array - fetches a result row as an associative array, a numeric array, or both. fetch_assoc - fetches a result row as an associative array fetch_object - fetches a result row as an object fetch_row - gets a result row as an enumerated array close - frees result memory field_seek - set result pointer to a specified field offset
&reftitle.properties; current_field - returns offset of current fieldpointer field_count - returns number of fields in resultset lengths - returns an array of columnlengths num_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;