Option | Type | Default | Description |
odbtp.interface_file | string | "/usr/local/share/odbtp.conf" | Path to ODBTP interface file. |
odbtp.datetime_format | string | "object" |
Format to use when returning data from datetime fields. One of the
following formats can be chosen:
|
odbtp.detach_default_queries | boolean | no | Automatically detach default queory resources prior to executing or preparing another query. |
odbtp.guid_format | string | "string" | Format to use when returning data from GUID (uniqueidentifier) fields. The choices are "object" or "string." |
odbtp.truncation_errors | boolean | yes | Generate errors if field or parameter data is truncated. |
odbtp.conf
, containing the below lines:
[global] type = mssql odbtp host = hostname or IP address of ODBTP server use row cache = yes right trim text = yes
[odbtp] odbtp.interface_file = "full path name of odbtp.conf file" odbtp.datetime_format = mdyhmsf odbtp.detach_default_queries = yes
Attribute | Type | Description |
ODB_ATTR_CACHEPROCS | Long | Determines if prepared procedure information should be cached. If the value is set to 0, then the cache will not be used. |
ODB_ATTR_DATABASENAME | String | Database name [read only]. |
ODB_ATTR_DBMSNAME | String | DBMS name [read only]. |
ODB_ATTR_DBMSVER | String | DBMS version [read only]. |
ODB_ATTR_DESCRIBEPARAMS | Long | Used to determine whether or not ODBTP server should try to describe parameters after preparing a query. If the value is set to 0, the server will not try to describe the parameters. |
ODB_ATTR_DRIVER | Long | Driver type [read only]. Valid types are: ODB_DRIVER_UNKNOWN |
ODB_ATTR_DRIVERNAME | String | Driver name [read only]. |
ODB_ATTR_DRIVERODBCVER | String | Driver ODBC version [read only]. |
ODB_ATTR_DRIVERVER | String | Driver version [read only]. |
ODB_ATTR_DSN | String | Data source name [read only]. |
ODB_ATTR_FETCHROWCOUNT | Long | Number of rows returned by the server per fetch row request. This attribute applies only to forward-only cursors, and is used to improve performance. Only one row per request is sent by the server for static, keyset and dynamic cursors. |
ODB_ATTR_FULLCOLINFO | Long | Used to determine whether or not full column info should be sent. If the value is set to 0, then minimal column info will be sent. |
ODB_ATTR_MAPCHARTOWCHAR | Long | Determines if character data types should be mapped to wide character. If the value is set to 0, then the mapping will not be performed. |
ODB_ATTR_OICLEVEL | Long | ODBC interface conformance level [read only]. Possible values are: ODB_OIC_CORE |
ODB_ATTR_QUERYTIMEOUT | Long | Query execution timeout in seconds. |
ODB_ATTR_RIGHTTRIMTEXT | Long | Used to determine whether or not trailing space characters should be removed from text data during retrieval. If the value is set to 0, text data will not be trimmed by the server. |
ODB_ATTR_SERVERNAME | String | Database server name [read only]. |
ODB_ATTR_TRANSACTIONS | Long | Transaction type used for queries. Valid types are: ODB_TXN_NONE |
ODB_ATTR_TXNCAPABLE | Long | Indicates whether or not ODBC driver supports transactions [read only]. 1 if yes, and 0 if no. |
ODB_ATTR_UNICODESQL | Long | Used to determine whether or not SQL query strings should be submitted using UTF8 encoded UNICODE characters. If the value is set to 0, then normal characters should be used. |
ODB_ATTR_USERNAME | String | Database user name [read only]. |
ODB_ATTR_VARDATASIZE | Long | Maximum size of buffer for variable length data if it is not explicitly specified when binding a column or parameter. |
Type | SQL Type | Default Type | PHP Type |
ODB_BINARY | binary, varbinary, image | ODB_BINARY | string (binary) |
ODB_BIGINT | bigint | ODB_BIGINT | string (numeric text) |
ODB_UBIGINT | string (numeric text) | ||
ODB_BIT | bit | ODB_BIT | bool |
ODB_CHAR | char, varchar, text | ODB_CHAR | string (text) |
ODB_DATE | string (binary) | ||
ODB_DATETIME | smalldatetime, datetime | ODB_DATETIME | object (datetime) |
ODB_DOUBLE | float | ODB_DOUBLE | double |
ODB_GUID | uniqueidentifier | ODB_GUID | object (guid) |
ODB_INT | int | ODB_INT | long |
ODB_UINT | long | ||
ODB_NUMERIC | decimal, numeric | ODB_CHAR | string (binary) |
ODB_REAL | real | ODB_REAL | double |
ODB_SMALLINT | smallint | ODB_SMALLINT | long |
ODB_USMALLINT | long | ||
ODB_TIME | string (binary) | ||
ODB_TINYINT | long | ||
ODB_UTINYINT | tinyint | ODB_UTINYINT | long |
ODB_WCHAR | nchar, nvarchar, ntext | ODB_WCHAR | string (UTF-8 text) |
Type | Description |
ODB_PARAM_NONE | Indicates that parameter is undefined. |
ODB_PARAM_INPUT | Indicates that parameter is used for input. |
ODB_PARAM_OUTPUT | Indicates that parameter is used for output. |
ODB_PARAM_INOUT | Indicates that parameter is used for input and output. |
ODB_PARAM_RETURNVAL | Indicates that parameter is a stored procedure's return value. |
ODB_PARAM_RESULTCOL | Indicates that parameter is a result column. |
Type | Description |
ODB_CURSOR_FORWARD | Forward-only cursor. This is the default cursor type, and does not support scrolling or row operations. |
ODB_CURSOR_STATIC | Static (read-only) cursor. This cursor supports scrolling, and row operations that do not modify the underlying data. |
ODB_CURSOR_KEYSET | Keyset cursor. This cursor supports scrolling, and all row operations. |
ODB_CURSOR_DYNAMIC | Dynamic cursor. This cursor supports scrolling, and all row operations. |
Type | Description |
ODB_CONCUR_DEFAULT | Use to specify default concurrency for a cursor. The default concurrency for forward-only and static cursors is read-only, and row version for keyset and dynamic cursors. |
ODB_CONCUR_READONLY | Use to specify read-only concurrency for a cursor. |
ODB_CONCUR_LOCK | Use to specify scroll lock concurrency for a cursor. |
ODB_CONCUR_ROWVER | Use to specify row version concurrency for a cursor. |
ODB_CONCUR_VALUES | Use to specify value-based concurrency for a cursor. |
Type | Description |
ODB_FETCH_DEFAULT | Fetch row using default method, which is a forward fetch. |
ODB_FETCH_FIRST | Fetch first row. |
ODB_FETCH_LAST | Fetch last row. |
ODB_FETCH_NEXT | Fetch next row. |
ODB_FETCH_PREV | Fetch previous row. |
ODB_FETCH_ABS | Fetch row absolutely. |
ODB_FETCH_REL | Fetch row relative to current row. |
ODB_FETCH_BOOKMARK | Fetch row relative to bookmarked row. |
ODB_FETCH_REREAD | Reread last fetched row. |
Status | Description |
ODB_ROWSTAT_ERROR | An error occurred for row. |
ODB_ROWSTAT_SUCCESS | Successfully fetched row. |
ODB_ROWSTAT_UPDATED | Row was updated. |
ODB_ROWSTAT_DELETED | Row was deleted. |
ODB_ROWSTAT_ADDED | Row was added. |
ODB_ROWSTAT_NOROW | Not a valid row. |
ODB_ROWSTAT_UNKNOWN | Status of row is unknown or could not be determined. |
odbtp_affected_rows -- get number of affected rows in last query
Description
long odbtp_affected_rows(resource odbtp_query)
Returns the number of rows affected for the current result of an odbtp_query.
odbtp_allocate_query
odbtp_allocate_query -- allocate query resource
Description
resource odbtp_allocate_query([resource odbtp_connection])
Allocates an ODBTP query resource for odbtp_connection. If odbtp_connection is not specified, then the default ODBTP connection resource will be used. The return value is the ODBTP query resource, or FALSE if the function fails.
If odbtp_connection was not used in a prior call to
odbtp_allocate_query,
odbtp_get_query,
odbtp_query or
odbtp_prepare,
then the returned resource
will be the primary ODBTP query resource for odbtp_connection.
The primary ODBTP query resource is used when calls to
odbtp_query or odbtp_prepare
are made with an ODBTP connection resource.
odbtp_attach_field
odbtp_attach_field -- attach result set field to variable
Description
bool odbtp_attach_field(resource odbtp_query, mixed field_id, mixed var[, long data_type[, long length]])
Attaches the odbtp_query result field field_id to the variable
referenced by var. The ODB data type
binding can be optionally changed with data_type.
If length is included with data_type,
then it will be used as the maximum size for the bound data buffer,
otherwise the server will try to determine it via the ODBC driver.
If data_type is a fixed length ODB data type,
the length is ignored.
The parameter field_id can either be the name or 0-based number
of the field.
The return value is FALSE if the function fails.
odbtp_attach_param
odbtp_attach_param -- attach prepared parameter to variable
Description
bool odbtp_attach_param(resource odbtp_query, mixed param_id, mixed var[, long data_type[, long length]])
Attaches the odbtp_query prepared parameter param_id to the variable
referenced by var. The ODB data type
binding can be optionally changed with data_type.
If length is included with data_type,
then it will be used as the maximum size for the bound data buffer,
otherwise the server will try to determine it via the ODBC driver.
If data_type is a fixed length ODB data type,
the length is ignored.
The value of param_id can either be the name or 1-based number
of the prepared parameter.
The return value is FALSE if the function fails.
odbtp_bind_field
odbtp_bind_field -- bind result set field to data type
Description
bool odbtp_bind_field(resource odbtp_query, mixed field_id, long data_type[, long length])
Binds the odbtp_query result field field_id to the ODB data type data_type.
If length is specified, then it will be used as the maximum size for the bound data buffer, otherwise the
server will try to determine it via the ODBC driver. If data_type is a fixed length ODB data type, the length is ignored.
The parameter field_id can either be the name or 0-based number of the field.
The return value is FALSE if the function fails.
odbtp_close
odbtp_close -- close ODBTP connection
Description
void odbtp_close([resource odbtp_connection[, bool disconnect_db]])
Closes the odbtp_connection. If odbtp_connection is not specified, then the default
ODBTP connection resource will be closed. Set disconnect_db to TRUE if it is no longer necessary
for the server to maintain its connection to the database for future use. The default for this parameter is FALSE.
disconnect_db should only be used with reserved database connections, Setting it
to TRUE for non-reserved database connections prevents them from being pooled.
odbtp_commit
odbtp_commit -- commit current transaction
Description
bool odbtp_commit([resource odbtp_connection])
Commits the database transactions since the last commit or rollback. If odbtp_connection
is not specified, then the default ODBTP connection resource will be used. This function is only applicable
if the ODB attribute ODB_ATTR_TRANSACTIONS is not set to ODB_TXN_NONE. The
return value is FALSE if the function fails.
odbtp_connect
odbtp_connect -- connect to ODBTP service
Description
resource odbtp_connect(string host, string dbconnect)
resource odbtp_connect(string interface[, string username[, string password[, string database]]])
Establishes a database connection via an ODBTP server, and returns the corresponding ODBTP connection resource or FALSE if it fails.
In the first version, the parameter host is used to specify the ODBTP server with the following format:
servname[:servport[:conntimeout[:readtimeout]]]
servname
is either the hostname or IP address of the server. servport
is the IP port used by
the server (default is 2799). conntimeout
is the maximum time in seconds to wait for a connection to be
establised with the server (default is 10 seconds). readtimeout
is the maximum time in seconds
to wait for data to be read from the server (default is 300 seconds). Examples:
odbtp.somewhere.com
odbtp.somewhere.com:6177
odbtp.somewhere.com:6177:30
odbtp.somewhere.com:6177:30:45
The parameter db_connect is the ODBC connect string corresponding to the database to which the server will establish a connection. Examples:
DRIVER={SQL Server};SERVER=(local);UID=myuid;PWD=mypwd;DATABASE=mydb;
DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\mydb.mdb;UID=admin;PWD=;
DRIVER={Oracle ODBC Driver};DBQ=MYDB;UID=myuid;PWD=mypwd;
DRIVER={Sybase ASE ODBC Driver};SRVR=MYSRVR;UID=myuid;PWD=mypwd;DATABASE=mydb;
In the second version, the parameter interface specifies the name of an interface defined in an interface file. The parameters username, password and database are optional parameters that can be used with the interface.
Note: The most recent ODBTP connection resource returned by either
odbtp_connect,
odbtp_rconnect or odbtp_sconnect
will become the default ODBTP connection resource. This resource is
used by functions that have an optional ODBTP connection resource parameter,
such as, odbtp_close.
odbtp_connect_id
odbtp_connect_id -- get connection id
Description
string odbtp_connect_id([resource odbtp_connection])
Returns the ODBTP connection ID for odbtp_connection. If
odbtp_connection is not specified, then the default ODBTP connection resource is
used. This function is typically called if odbtp_connection was established
with odbtp_rconnect. The returned ID string can then be
used to reestablish a connection to the corresponding reserved database connection.
The function returns FALSE if it fails.
odbtp_convert_all
odbtp_convert_all -- convert all field data to character format
Description
bool odbtp_convert_all([resource odbtp_connection[, bool convert]])
Convert all result field data to character format for subsequent queries
associated with odbtp_connection.
If odbtp_connection is not specified, then the default
ODBTP connection resource will be used.
Set convert to TRUE to enable the conversion, or FALSE to disable it.
If not specified, the default value for convert is TRUE.
The return value is FALSE if the function fails.
odbtp_convert_datetime
odbtp_convert_datetime -- convert datetime field data to character format
Description
bool odbtp_convert_datetime([resource odbtp_connection[, bool convert]])
Convert all datetime result field data to character format for subsequent queries
associated with odbtp_connection.
If odbtp_connection is not specified, then the default
ODBTP connection resource will be used.
Set convert to TRUE to enable the conversion, or FALSE to disable it.
If not specified, the default value for convert is TRUE.
The return value is FALSE if the function fails.
odbtp_convert_guid
odbtp_convert_guid -- convert GUID (uniqueidentifier) field data to character format
Description
bool odbtp_convert_guid([resource odbtp_connection[, bool convert]])
Convert all GUID result field data to character format for subsequent queries
associated with odbtp_connection.
If odbtp_connection is not specified, then the default
ODBTP connection resource will be used.
Set convert to TRUE to enable the conversion, or FALSE to disable it.
If not specified, the default value for convert is TRUE.
The return value is FALSE if the function fails.
odbtp_ctime2datetime
odbtp_ctime2datetime -- convert a C time value into a datetime object
Description
object odbtp_ctime2datetime(long ctime_val)
Returns the datetime object equivaluent of the C time value ctime_val.
See odbtp_new_datetime for a description of the datetime object.
odbtp_data_seek
odbtp_data_seek -- move to a specific row
Description
bool odbtp_data_seek(resource odbtp_query, long row)
If row caching has been enabled with odbtp_use_row_cache,
this function can be used to move to the specified row within
the cache associated with odbtp_query. The value for row is
0-based.
The function returns FALSE if it fails.
odbtp_datetime2ctime
odbtp_datetime2ctime -- convert a datetime object into a C time value
Description
long odbtp_datetime2ctime(object datetime_obj)
Returns the C time value equivaluent of the datetime object datetime_obj.
See odbtp_new_datetime for a description of the datetime object.
odbtp_detach
odbtp_detach -- detach query from connection
Description
bool odbtp_detach(resource odbtp_query)
Detaches the odbtp_query resource from the underlying
connection. When a query resouce is detached, its result set is retained
even if another query is executed with the same connection, or if the
connection is closed. odbtp_detach should only be used if row caching
has been enabled with odbtp_use_row_cache and
all of the result set's rows are in the cache.
The function returns FALSE if it fails.
odbtp_dont_pool_dbc
odbtp_dont_pool_dbc -- don't pool DB connection
Description
bool odbtp_dont_pool_dbc([resource odbtp_connection[, bool dont]])
Don't place the underlying database connection associated with
odbtp_connection into the pool.
If odbtp_connection is not specified, then the default
ODBTP connection resource will be used.
Set dont to TRUE to prevent pooling of DB connection, or FALSE to
allow it to be pooled.
If not specified, the default value for dont is TRUE.
The return value is FALSE if the function fails.
odbtp_execute
odbtp_execute -- execute previously prepared query
Description
bool odbtp_execute(resource odbtp_query)
Executes a previously prepared query for odbtp_query.
If the execution is successful, then odbtp_query can be used to obtain the results.
The function will return FALSE if it fails.
See alse odbtp_prepare.
odbtp_fetch
odbtp_fetch -- fetch row
Description
bool odbtp_fetch(resource odbtp_query[, long fetch_type[, long fetch_param]])
Fetches a row from the current resutl set associated with odbtp_query.
The fetched field data can be obtained with odbtp_field.
The fetch_type specifies the ODB fetch type,
fetch_param is the parameter for fetch_type, and is only required
for ODB fetch types ODB_FETCH_ABS, ODB_FETCH_REL and ODB_FETCH_BOOKMARK.
The default value for fetch_type is ODB_FETCH_FORWARD, and the default for
fetch_param is 0. The function returns FALSE if there are no more rows or it fails.
odbtp_fetch_array
odbtp_fetch_array -- fetch row as an array
Description
array odbtp_fetch_array(resource odbtp_query[, long fetch_type[, long fetch_param]])
Fetches a row from the current resutl set associated with odbtp_query, and returns it as an array. The function returns FALSE if there are no more rows or it fails. See odbtp_fetch for details about the optional parameters fetch_type and fetch_param.
odbtp_fetch_array is an extended version of odbtp_fetch_row. In addition
to storing the data in the numeric indices of the result array, it also stores the data
in associative indices, using the field names as keys.
odbtp_fetch_assoc
odbtp_fetch_assoc -- fetch row as an associative array
Description
array odbtp_fetch_assoc(resource odbtp_query[, long fetch_type[, long fetch_param]])
Fetches a row from the current resutl set associated with odbtp_query, and returns it as an associative array. The function returns FALSE if there are no more rows or it fails. See odbtp_fetch for details about the optional parameters fetch_type and fetch_param.
odbtp_fetch_assoc fetches one row of data from the result set
into an associative array. The data field names are used as the
keys for the array.
odbtp_fetch_batch
odbtp_fetch_batch -- fetch next batch of rows
Description
long odbtp_fetch_batch(resource odbtp_query)
Fetches the next batch of rows from the current result set
associated with odbtp_query into the row cache. This function is only
necessary if row caching has been enabled with
odbtp_use_row_cache and the total
number of rows in the result set is larger than the row cache size.
If successful, the function will return the number of
rows fetched into the cache, otherwise it returns FALSE.
odbtp_fetch_field
odbtp_fetch_field -- get field information
Description
object odbtp_fetch_field(resource odbtp_query[, mixed field_id])
Returns an object containing field information.
odbtp_fetch_field can be used in order to obtain information about fields in a certain query result. If the field_id isn't specified, the next field that wasn't yet retrieved by odbtp_fetch_field is retrieved.
The properties of the object are:
odbtp_fetch_object -- fetch row as an object
Description
object odbtp_fetch_object(resource odbtp_query[, long fetch_type[, long fetch_param]])
Fetches a row from the current resutl set associated with odbtp_query, and returns it as an object. The function returns FALSE if there are no more rows or it fails. See odbtp_fetch for details about the optional parameters fetch_type and fetch_param.
odbtp_fetch_object is similar to odbtp_fetch_array,
with one difference - an object is returned, instead of an array.
Indirectly, that means that you can only access the data by the field names,
and not by their offsets (numbers are illegal property names).
odbtp_fetch_output
odbtp_fetch_output -- fetch output parameters as an array
Description
array odbtp_fetch_output(resource odbtp_query)
Fetches output parameter data resulting from the execution of a
prepared query for odbtp_query. The data is returned as an
array whose keys correspond to the output parameter numbers. The return
value is FALSE if the function fails.
Output parameter data is usually not available until all query results have
been fetched.
odbtp_fetch_row
odbtp_fetch_row -- fetch row as an enumerated array
Description
array odbtp_fetch_row(resource odbtp_query[, long fetch_type[, long fetch_param]])
Fetches a row from the current resutl set associated with odbtp_query, and returns it as an enumerated array. The function returns FALSE if there are no more rows or it fails. See odbtp_fetch for details about the optional parameters fetch_type and fetch_param.
odbtp_fetch_row fetches one row of data from the result set.
Each result field is stored in an array offset, starting at offset 0.
odbtp_field
odbtp_field -- get/set current field value
Description
mixed odbtp_field(resource odbtp_query, mixed field_id[, mixed new_value])
If new_value is not specified, then the data value associated with the odbtp_query result field field_id will be returned. Otherwise, the field will be set to new_value and returns TRUE if it succeeds. If the function fails for either case, FALSE will be returned. The parameter field_id can either be the name or 0-based number of the field.
odbtp_fetch is used to obtain data from a row that was fetched with
odbtp_fetch. It can also be used to set the field
values for a row that will be updated with odbtp_row_update
or added with odbtp_row_add.
odbtp_field_basename
odbtp_field_basename -- get field base name
Description
string odbtp_field_basename(resource odbtp_query, mixed field_id)
Returns the base (actual) name of the odbtp_query result field field_id.
The parameter field_id is either the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_bindtype
odbtp_field_bindtype -- get field bind type
Description
long odbtp_field_bindtype(resource odbtp_query, mixed field_id)
Returns the ODB data type bound to the odbtp_query result field field_id.
The parameter field_id can either be the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_catalog
odbtp_field_catalog -- get field catalog
Description
string odbtp_field_catalog(resource odbtp_query, mixed field_id)
Returns the catalog (database) of the odbtp_query result field field_id.
The parameter field_id is either the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_flags
odbtp_field_flags -- get field flags
Description
string odbtp_field_flags(resource odbtp_query, mixed field_id)
Returns the flag settings of the odbtp_query result field field_id. The value is returned as a string containing one or more of the following substrings:
not_null
unsigned
auto_increment
numeric
blob
primary_key
hidden
The parameter field_id is either the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_ignore
odbtp_field_ignore -- ignore field
Description
bool odbtp_field_ignore(resource odbtp_query, mixed field_id)
Specifies that the odbtp_query result field field_id should
be ignored when executing odbtp_row_update or
odbtp_row_add. The function returns FALSE if it fails.
The parameter field_id can either be the name or 0-based number of the field.
odbtp_field_length
odbtp_field_length -- get field max char length
Description
long odbtp_field_length(resource odbtp_query, mixed field_id)
Returns the maximum character display length of the odbtp_query result field field_id.
The parameter field_id can either be the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_name
odbtp_field_name -- get field name
Description
string odbtp_field_name(resource odbtp_query, mixed field_id)
Returns the name of the odbtp_query result field field_id.
The parameter field_id is the 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_schema
odbtp_field_schema -- get field schema
Description
string odbtp_field_schema(resource odbtp_query, mixed field_id)
Returns the schema (owner) of the odbtp_query result field field_id.
The parameter field_id is either the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_seek
odbtp_field_seek -- move to specified field
Description
bool odbtp_field_seek(resource odbtp_query, mixed field_id)
Moves to the field specified by field_id. If the next call to
odbtp_fetch_field doesn't include a
field specification, this field would be returned.
The parameter field_id can either be the name or 0-based number
of the field. The function will return FALSE if it fails.
odbtp_field_table
odbtp_field_table -- get field table
Description
string odbtp_field_table(resource odbtp_query, mixed field_id)
Returns the table of the odbtp_query result field field_id.
The parameter field_id is either the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_field_type
odbtp_field_type -- get field data type
Description
string odbtp_field_type(resource odbtp_query, mixed field_id)
Returns the data type of the odbtp_query result field field_id.
The parameter field_id is either the name or 0-based number of the field.
The function returns FALSE if it fails.
odbtp_free_query
odbtp_free_query -- free query resource
Description
void odbtp_free_query(resource odbtp_query)
Frees the odbtp_query that was previously allocated by
odbtp_allocate_query,
odbtp_get_query,
odbtp_query or
odbtp_prepare.
odbtp_get
odbtp_get -- get parameter value
Description
mixed odbtp_get(resource odbtp_query, mixed param_id)
Returns the value of the prepared query parameter param_id for odbtp_query.
The return value is FALSE if the function fails.
odbtp_get_attr
odbtp_get_attr -- get attribute
Description
mixed odbtp_get_attr( long attrib[, resource odbtp_connection])
Gets the current value of the ODB attribute attrib for odbtp_connection.
The default ODBTP connection resource is used if odbtp_connection is not specified.
This function returns FALSE if it fails.
odbtp_get_error
odbtp_get_error -- get current error message
Description
string odbtp_get_error(resource odbtp_handle)
Returns the error text associated with the last error that occured for odbtp_handle.
The parameter odbtp_handle is either an ODBTP connection or query resource.
odbtp_get_message
odbtp_get_message -- get current message
Description
string odbtp_get_message(resource odbtp_handle)
Returns any message text that was returned by the server for odbtp_handle.
The parameter odbtp_handle is either an ODBTP connection or query resource.
odbtp_get_query
odbtp_get_query -- get query
Description
resource odbtp_get_query([resource odbtp_connection[, long query_id]])
Returns the ODBTP query resource corresponding to query_id for odbtp_connection. This function returns FALSE if it fails. The default ODBTP connectinn resource will be used if odbtp_connection is not specified. The default for query_id is 0.
odbtp_get_query is normally used to restrieve an ODBTP query resource that is being maintained by the server for a reserved connection. It is normally called after reestablishing a reserved connection with odbtp_rconnect. See also odbtp_query_id.
If odbtp_connection was not used in a prior call to
odbtp_allocate_query,
odbtp_get_query,
odbtp_query or
odbtp_prepare,
then the returned resource
will be the primary ODBTP query resource for odbtp_connection.
The primary ODBTP query resource is used when calls to
odbtp_query or odbtp_prepare
are made with an ODBTP connection resource.
odbtp_guid_string
odbtp_guid_string -- converts a GUID to its character string equivalent
Description
string odbtp_guid_string(mixed guid [,bool short_format])
Converts the GUID object or binary string guid into its character equivalent. The short character format will be returned if short_format is TRUE. The default for short_format is FALSE. A GUID object has the following structure:
class guid { var $data1; // 4-byte integer var $data2; // 2-byte integer var $data3; // 2-byte integer var $data4; // 8-byte binary string }
odbtp_inout -- define parameter as input/output
Description
bool odbtp_inout(resource odbtp_query, mixed param_id[, long data_type[, long length[, mixed sql_type[, long size[, long precision]]]]])
Defines parameter param_id of a query prepared for odbtp_query as an inout parameter, and binds it to the ODB data type data_type. The parameter's default ODB data type will be used if data_type is not specified. If length is specified, then it will be used as the maximum size for the bound data buffer, otherwise the server will try to determine it via the ODBC driver. If data_type is a fixed length ODB data type, the length is ignored.
The parameters sql_type, size and precision are only required if the ODBTP service did not or was unable to describe the parameter. sql_type specifies a type name that was previously loaded with odbtp_load_data_types
This function will return FALSE if it fails.
odbtp_input
odbtp_input -- define parameter as input
Description
bool odbtp_input(resource odbtp_query, mixed param_id[, long data_type[, long length[, mixed sql_type[, long size[, long precision]]]]])
Defines parameter param_id of a query prepared for odbtp_query as an input parameter, and binds it to the ODB data type data_type. The parameter's default ODB data type will be used if data_type is not specified. If length is specified, then it will be used as the maximum size for the bound data buffer, otherwise the server will try to determine it via the ODBC driver. If data_type is a fixed length ODB data type, the length is ignored.
The parameters sql_type, size and precision are only required if the ODBTP service did not or was unable to describe the parameter. sql_type specifies a type name that was previously loaded with odbtp_load_data_types
This function will return FALSE if it fails.
odbtp_is_detached
odbtp_is_detached -- determine if query is detached
Description
bool odbtp_is_detached(resource odbtp_query)
Determines if the odbtp_query resource is detached from the underlying
connection. When a query resouce is detached, its result set is retained
even if another query is executed with the same connection, or if the
connection is closed. The function returns TRUE if the specified query
resource is detached. See odbtp_detach for
details about detaching a query.
odbtp_last_error
odbtp_last_error -- get the last error message
Description
string odbtp_last_error([resource odbtp_connection])
Gets the the text of the last error that occurred for odbtp_connection.
If odbtp_connection is not specified, then the text of
the last odbtp function call error is returned.
odbtp_last_error_code
odbtp_last_error_code -- get the last error code
Description
long odbtp_last_error_code([resource odbtp_connection])
Gets the the code of the last error that occurred for odbtp_connection.
If odbtp_connection is not specified, then the code of
the last odbtp function call error is returned.
odbtp_last_error_state
odbtp_last_error_state -- get the last error state
Description
string odbtp_last_error_state([resource odbtp_connection])
Gets the the state of the last error that occurred for odbtp_connection.
If odbtp_connection is not specified, then the state of
the last odbtp function call error is returned.
odbtp_load_data_types
odbtp_load_data_types -- load data type information
Description
bool odbtp_load_data_types([resource odbtp_connection])
Loads data type information for use by functions
odbtp_input,
odbtp_inout,
odbtp_output,
odbtp_field_type, and
odbtp_param_type.
If odbtp_connection is not specified, then the default
ODBTP connection resource will be used.
The return value is FALSE if the function fails.
odbtp_new_datetime
odbtp_new_datetime -- create a new datetime object
Description
object odbtp_new_datetime()
Returns a new instance of a datetime object. A datetime object is used to represent data whose ODB data type is ODB_DATETIME. The datetime object has the following structure:
class datetime { var $year; var $month; var $day; var $hour; var $minute; var $second; var $fraction; }
odbtp_next_result -- get next query result
Description
bool odbtp_next_result(resource odbtp_query)
Gets the next result for a query executed with odbtp_query.
This function returns FALSE if there are no more results or it fails.
See also odbtp_query or odbtp_execute.
odbtp_num_fields
odbtp_num_fields -- get number of fields in query result
Description
long odbtp_num_fields(resource odbtp_query)
Returns the number of fields in the current result set associated with odbtp_query. The
function will return FALSE if it fails.
odbtp_num_params
odbtp_num_params -- get number of prepared parameters
Description
long odbtp_num_params(resource odbtp_query)
Returns the number of parameters in a query prepared for odbtp_query. The
function will return FALSE if it fails. See also odbtp_prepare.
odbtp_num_rows
odbtp_num_rows -- get number of fetched rows from query
Description
long odbtp_num_rows(resource odbtp_query)
Returns the number of rows fetched from the current result set
associated with odbtp_query. If row caching has been enabled with
odbtp_use_row_cache, then the total
number of rows in the cache will be returned.
odbtp_output
odbtp_output -- define parameter as output
Description
bool odbtp_output(resource odbtp_query, mixed param_id[, long data_type[, long length[, mixed sql_type[, long size[, long precision]]]]])
Defines parameter param_id of a query prepared for odbtp_query as an outout parameter, and binds it to the ODB data type data_type. The parameter's default ODB data type will be used if data_type is not specified. If length is specified, then it will be used as the maximum size for the bound data buffer, otherwise the server will try to determine it via the ODBC driver. If data_type is a fixed length ODB data type, the length is ignored.
The parameters sql_type, size and precision are only required if the ODBTP service did not or was unable to describe the parameter. sql_type specifies a type name that was previously loaded with odbtp_load_data_types
This function will return FALSE if it fails.
odbtp_param_bindtype
odbtp_param_bindtype -- get parameter bind type
Description
long odbtp_param_bindtype(resource odbtp_query, mixed param_id)
Returns the ODB data type bound to the odbtp_query prepared parameter param_id.
The parameter param_id can either be the name or 1-based number of the prepared parameter.
The function returns FALSE if it fails.
odbtp_param_length
odbtp_param_length -- get parameter max char length
Description
long odbtp_param_length(resource odbtp_query, mixed param_id)
Returns the maximum character display length of the odbtp_query prepared parameter param_id.
The parameter param_id can either be the name or 1-based number of the prepared parameter.
The function returns FALSE if it fails.
odbtp_param_name
odbtp_param_name -- get parameter name
Description
string odbtp_param_name(resource odbtp_query, mixed param_id)
Returns the name of the odbtp_query prepared parameter param_id.
The parameter param_id is the 1-based number of the prepared parameter.
The function returns FALSE if it fails.
odbtp_param_number
odbtp_param_number -- get parameter number
Description
long odbtp_param_number(resource odbtp_query, mixed param_id)
Returns the 1-based number of the odbtp_query prepared parameter param_id.
The parameter param_id is the name of the prepared parameter.
The function returns FALSE if it fails.
odbtp_param_type
odbtp_param_type -- get parameter data type
Description
string odbtp_param_type(resource odbtp_query, mixed param_id)
Returns the data type of the odbtp_query prepared parameter param_id.
Thed parameter param_id can either be the name or 1-based number of the prepared parameter.
The function returns FALSE if it fails.
odbtp_prepare
odbtp_prepare -- prepare a query for execution
Description
resource odbtp_prepare( string query[, resource odbtp_handle])
Prepares the query for odbtp_handle, and returns an ODBTP query resource that can be used to execute the query with odbtp_execute. The function will return FALSE if it fails.
The parameter odbtp_handle is either an ODBTP connection or query resource.
If it is an ODBTP query resource, then the function will return the same resource.
In this case it is not necessary to store the returned resource in another
variable, and only a test for failure is required.
If odbtp_handle is an ODBTP connection resource, then its primary
ODBTP query resource will be used and returned by the function. The
function will allocate a primary ODBTP query resource for odbtp_handle
if one has not been allocated.
odbtp_prepare_proc
odbtp_prepare_proc -- prepare a procedure for execution
Description
resource odbtp_prepare_proc( string procedure[, resource odbtp_handle])
Prepares the specified procedure for odbtp_handle, and returns an ODBTP query resource that can be used to execute the procedure with odbtp_execute. The function will return FALSE if it fails.
The parameter odbtp_handle is either an ODBTP connection or query resource. If it is an ODBTP query resource, then the function will return the same resource. In this case it is not necessary to store the returned resource in another variable, and only a test for failure is required. If odbtp_handle is an ODBTP connection resource, then its primary ODBTP query resource will be used and returned by the function. The function will allocate a primary ODBTP query resource for odbtp_handle if one has not been allocated.
After preparing the procedure,
odbtp_set and odbtp_get can be used
to set and retrieve specific procedure parameter data.
odbtp_attach_param can also be used for this
purpose.
odbtp_query
odbtp_query -- execute query
Description
resource odbtp_query( string query[, resource odbtp_handle])
Executes the query for odbtp_handle, and returns an ODBTP query resource that can be used to obtain the results. The function will return FALSE if it fails.
The parameter odbtp_handle is either an ODBTP connection or query resource.
If it is an ODBTP query resource, then the function will return the same resource.
In this case it is not necessary to store the returned resource in another
variable, and only a test for failure is required.
If odbtp_handle is an ODBTP connection resource, then its primary
ODBTP query resource will be used and returned by the function. The
function will allocate a primary ODBTP query resource for odbtp_handle
if one has not been allocated.
odbtp_query_id
odbtp_query_id -- get query id
Description
long odbtp_query_id(resource odbtp_query)
Returns the query ID for odbtp_query, or FALSE if it fails.
The query ID is used to identify an ODBTP query resource associated
with an ODBTP connection resource. When using a reserved connection, this
value can be used to restore the "pre-close" state of a query with
odbtp_get_query. This is typicall done after
reestablishing a reserved connection with odbtp_rconnect.
odbtp_rconnect
odbtp_rconnect -- reserved connect to ODBTP service
Description
resource odbtp_rconnect(string host, string dbconnect)
Establishes or reestablishes a database connection via an ODBTP server, and returns the corresponding ODBTP connection resource or FALSE if it fails.
odbtp_rconnect establishes a connection in the same manner as odbtp_connect. The only difference is that the server-side database connection is reserved, and assigned a unique connection ID that can be used to reestablish an ODBTP connection with the same database connection after calling odbtp_close. The states of any open queries are also maintained by the server. This allows the same database connection to be used across web pages,
The following steps should be used to reestablish a reserved connection:
odbtp_result -- get result data
Description
mixed odbtp_result(resource odbtp_query, long row, mixed field_id)
Retrieves the data stored in the result set cell identified by row
and field_id. The value for row is 0-based, and field_id
can either be the name or 0-based number of the field. This
function will only work if row caching has been enabled with
odbtp_use_row_cache,
odbtp_rollback
odbtp_rollback -- rollback current transaction
Description
bool odbtp_rollback([resource odbtp_connection])
Rollbacks the database transactions since the last commit or rollback. If odbtp_connection
is not specified, then the default ODBTP connection resource will be used. This function is only applicable
if the ODB attribute ODB_ATTR_TRANSACTIONS is not set to ODB_TXN_NONE. The
return value is FALSE if the function fails.
odbtp_row_add
odbtp_row_add -- add row
Description
bool odbtp_row_add(resource odbtp_query)
Adds a new row to the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_add is only applicable if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
Use odbtp_field to set the field values of the row
before it is added.
odbtp_row_bookmark
odbtp_row_bookmark -- bookmark row
Description
bool odbtp_row_bookmark(resource odbtp_query)
Bookmarks the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_bookmark is only applicable if bookmark support was enabled when a static, keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set. This function bookmarks
the row that will be used when performing a bookmark fetch
with
odbtp_fetch,
odbtp_fetch_row,
odbtp_fetch_array or
odbtp_fetch_object.
odbtp_row_cache_size
odbtp_row_cache_size -- get row cache size
Description
long odbtp_row_cache_size([resource odbtp_connection])
Returns the size of the row cache to use for query results generated with
odbtp_connection. If odbtp_connection is not
specified, then the default ODBTP connection resource is used.
The return value is -1, if row caching has not been enabled.
odbtp_row_delete
odbtp_row_delete -- delete row
Description
bool odbtp_row_delete(resource odbtp_query)
Deletes the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_delete is only applicable if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
odbtp_row_lock
odbtp_row_lock -- lock row
Description
bool odbtp_row_lock(resource odbtp_query)
Locks the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_lock is only applicable if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
Call odbtp_row_unlock to unlock the row.
odbtp_row_refresh
odbtp_row_refresh -- refresh row
Description
bool odbtp_row_refresh(resource odbtp_query)
Refreshes the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_refresh is applicable only if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
It is used to restore the row's field values to their original values if
they were changed with odbtp_field.
odbtp_row_status
odbtp_row_status -- get row status
Description
long odbtp_row_status(resource odbtp_query)
Returns the ODB row status of the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_status is only applicable if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
odbtp_row_unlock
odbtp_row_unlock -- unlock row
Description
bool odbtp_row_unlock(resource odbtp_query)
Unlocks the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_unlock is only applicable if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
This function is used to unlock a row that was locked with odbtp_row_lock.
odbtp_row_update
odbtp_row_update -- update row
Description
bool odbtp_row_update(resource odbtp_query)
Updates the current row fetched from the result set for odbtp_query. The return value is FALSE if the function fails.
odbtp_row_update is only applicable if a keyset or dynamic cursor was
enabled with odbtp_set_cursor prior to
eecuting a query that generates a result set.
Use odbtp_field to set the field values of the row
before it is updated.
odbtp_sconnect
odbtp_sconnect -- single process connect to ODBTP service
Description
resource odbtp_sconnect(string host, string dbconnect)
resource odbtp_sconnect(string interface[, string username[, string password[, string database]]])
Establishes a database connection via an ODBTP server, and returns the corresponding ODBTP connection resource or FALSE if it fails.
odbtp_sconnect establishes a connection in the same manner as odbtp_connect.
The only difference is that the server-side database connection is handled
by a separate process instead of a thread.
The purpose of the single process connection is to provide reliable access
for databases whose ODBC drivers are not thread safe.
odbtp_set
odbtp_set -- set parameter value
Description
bool odbtp_set(resource odbtp_query, mixed param_id[, mixed data])
Sets the value of the prepared query parameter param_id to data for odbtp_query. If data is not specified, then the default value for the prepared query parameter will be used. The return value is FALSE if the function fails.
odbtp_set should only be used for prepared query parameters that were defined
with odbtp_input or odbtp_inout.
odbtp_set_attr
odbtp_set_attr -- set attribute
Description
bool odbtp_set_attr(long attrib, mixed value[, resource odbtp_connection])
Sets the ODB attribute attrib to value for odbtp_connection.
The default ODBTP connection resource is used if odbtp_connection is not specified.
This function returns FALSE if it fails.
odbtp_set_cursor
odbtp_set_cursor -- set cursor type
Description
bool odbtp_set_cursor(resource odbtp_query[, long type[, long concurrency[, bool enable_bookmarks]]])
Sets the ODB cursor type to type and the ODB cursor concurrency type to concurrency for odbtp_query. The defaults for type and concurrency are ODB_CURSOR_FORWARD and ODB_CONCUR_DEFAULT respectively. The parameter enable_bookmark is used to determine whether or not bookmark support should be enabled. The default for this parameter is FALSE. The return value is FALSE if the function fails.
In order to use scrollable fetches or row-level operations, odbtp_set_cursor
must be called prior to executing queries that generate result sets. The
selected cursor type will remain in effect for all queries until it is changed
to a new type.
odbtp_type_param
odbtp_type_param -- get type of parameter
Description
long odbtp_type_param(resource odbtp_query, mixed param_id)
Returns the ODB parameter type of the odbtp_query prepared parameter param_id.
Thed parameter param_id can either be the name or 1-based number of the prepared parameter.
The function returns FALSE if it fails.
odbtp_use_row_cache
odbtp_use_row_cache -- enable row cache usage
Description
bool odbtp_use_row_cache([resource odbtp_connection[, bool use_cache[, long size]]])
Enable row cache usage for subsequent queries associated with odbtp_connection. If odbtp_connection is not specified, then the default ODBTP connection resource will be used. Set use_cache to TRUE to enable row caching, or FALSE to disable it. If not specified, the default value for use_cache is TRUE. Set size to the maximum number rows allowed in the cache. If size is not specified, then all rows will be placed in the cache. The return value is FALSE if the function fails.
Note: It is not necessary to call this function if row caching was
enabled vie an interface file.
odbtp_version
odbtp_version -- get protocol version
Description
string odbtp_version([resource odbtp_connection])
Returns the ODBTP protocol version of the connection
identified by odbtp_connection. If odbtp_connection is not
specified, then the default ODBTP connection resource is used.