From c74d04f95b4eb78f8eb2b4f467a0863639a6eac7 Mon Sep 17 00:00:00 2001 From: Nikos Mavroyanopoulos Date: Tue, 17 Oct 2000 10:53:17 +0000 Subject: [PATCH] Added documentation for Ovrimos functions git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@33962 c90b9560-bf6c-de11-be94-00142212c4b1 --- chapters.ent | 1 + functions/ovrimos.xml | 778 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 779 insertions(+) create mode 100644 functions/ovrimos.xml diff --git a/chapters.ent b/chapters.ent index 4029b70680..6b32105c3d 100644 --- a/chapters.ent +++ b/chapters.ent @@ -75,6 +75,7 @@ + diff --git a/functions/ovrimos.xml b/functions/ovrimos.xml new file mode 100644 index 0000000000..45c0fc63d3 --- /dev/null +++ b/functions/ovrimos.xml @@ -0,0 +1,778 @@ + + Ovrimos SQL functions + OvrimosSQL + + + + Ovrimos SQL Server, is a client/server, transactional RDBMS combined with Web + capabilities and fast transactions. + + + Ovrimos SQL Server is available at www.ovrimos.com. + To enable ovrimos support in PHP just compile php with the '--with-ovrimos' parameter + to configure script. You'll need to install the sqlcli library available in the Ovrimos SQL Server + distribution. + + + + + Connect to Ovrimos SQL Server and select from a system table + +<?php +$conn = ovrimos_connect("server.domain.com","8001","admin","password"); +if($conn != 0) { + echo("Connection ok!"); + $res=ovrimos_exec($conn,"select table_id,table_name from sys.tables"); + if($res != 0) { + echo("Statement ok!"); + ovrimos_result_all($res); + ovrimos_free_result($res); + } + ovrimos_close($conn); +?> + + + This will just connect to SQL Server. + + + + + + ovrimos_connect + Connect to the specified database + + + Description + + + int ovrimos_connect + string host + string db + string user + string password + + + + ovrimos_connect is used to connect to the specified + database. + + + ovrimos_connect + Returns a connection id (greater than 0) or 0 for failure. The meaning of 'host' and 'port' + are those used everywhere in Ovrimos APIs. 'Host' is a host name or IP address + and 'db' is either a database name, or a string containing the port number. + + + + <function>ovrimos_connect</function> Example + +<?php +$conn = ovrimos_connect("server.domain.com","8001","admin","password"); +if($conn != 0) { + echo("Connection ok!"); + $res=ovrimos_exec($conn,"select table_id,table_name from sys.tables"); + if($res != 0) { + echo("Statement ok!"); + ovrimos_result_all($res); + ovrimos_free_result($res); + } + ovrimos_close($conn); +?> + + + The above example will connect to the database and print out the specified table. + + + + + + + + ovrimos_close + Closes the connection to ovrimos + + + Description + + + void ovrimos_close + int connection + + + + ovrimos_close is used to close the specified connection. + + + ovrimos_close + Closes a connection to Ovrimos. This has the effect of rolling back uncommitted + transactions. + + + + + + + ovrimos_close_all + Closes all the connections to ovrimos + + + Description + + + void ovrimos_close_all + void + + + + ovrimos_close_all is used to close all the connections. + + + ovrimos_close_all + Closes all connections to Ovrimos. This has the effect of rolling back uncommitted + transactions. + + + + + + + ovrimos_longreadlen + Specifies how many bytes are to be retrieved from long datatypes + + + Description + + + int ovrimos_longreadlen + int result_id + int length + + + + ovrimos_longreadlen is used to specify how many bytes are to be retrieved from long datatypes. + + + ovrimos_longreadlen +Specifies how many bytes are to be retrieved from long datatypes (long varchar +and long varbinary). Default is zero. Regardless of its taking a result_id as +an argument, it currently sets this parameter for all result sets. Returns true. + + + + + + + + ovrimos_prepare + Prepares an SQL statement + + + Description + + + int ovrimos_prepare + int connection_id + string query + + + + ovrimos_prepare is used to prepare an SQL statement. + + + ovrimos_prepare +Prepares an SQL statement and returns a result_id (or false on failure). + + + + Connect to Ovrimos SQL Server and prepare a statement + +<?php +$conn=ovrimos_connect("db_host","8001","admin","password"); +if($conn!=0) { + echo("Connection ok!"); + $res=ovrimos_prepare($conn,"select table_id,table_name from sys.tables where table_id=1"); + if($res!=0) { + echo("Prepare ok!"); + if(ovrimos_execute($res)) { + echo("Execute ok!\n"); + ovrimos_result_all($res); + } else { + echo("Execute not ok!"); + } + ovrimos_free_result($res); + } else { + echo("Prepare not ok!\n"); + } + ovrimos_close($conn); +} +?> + + + This will connect to Ovrimos SQL Server, prepare a statement and the execute it. + + + + + + + + ovrimos_execute + Executes a prepared SQL statement + + + Description + + + int ovrimos_execute + int result_id + [ array parameters_array] + + + + ovrimos_execute is used to execute an SQL statement. + + + ovrimos_execute +Executes a prepared statement. Returns true or false. If the prepared +statement contained parameters (question marks in the statement), the +correct number of parameters should be passed in an array. Notice that I don't +follow the PHP convention of placing just the name of the optional parameter +inside square brackets. I couldn't bring myself on liking it. + + + + + + + ovrimos_cursor + Returns the name of the cursor + + + Description + + + int ovrimos_cursor + int result_id + + + + ovrimos_cursor is used to get the name of the cursor. + + + ovrimos_cursor +Returns the name of the cursor. Useful when wishing to perform positioned +updates or deletes. + + + + + + + + ovrimos_exec + Executes an SQL statement + + + Description + + + int ovrimos_exec + int connection_id + string query + + + + ovrimos_exec is used to execute an SQL statement. + + + ovrimos_exec +Executes an SQL statement (query or update) and returns a result_id or false. +Evidently, the SQL statement should not contain parameters. + + + + + + + ovrimos_fetch_into + Fetches a row from the result set + + + Description + + + int ovrimos_fetch_into + int result_id + array result_array + [ string how + [int rownumber]] + + + + ovrimos_fetch_into is used to fetch a row from the result set. + + + ovrimos_fetch_into +Fetches a row from the result set into 'result_array', which should be passed +by reference. Which row is fetched is determined by the two last parameters. +'how' is one of 'Next' (default), 'Prev', 'First', 'Last', 'Absolute', +corresponding to forward direction from current position, backward direction +from current position, forward direction from the start, backward direction +from the end and absolute position from the start (essentially equivalent to +'first' but needs 'rownumber'). Case is not significant. 'Rownumber' is +optional except for absolute positioning. Returns true or false. + + + + A fetch into example + +<?php +$conn=ovrimos_connect("neptune","8001","admin","password"); +if($conn!=0) { + echo("Connection ok!"); + $res=ovrimos_exec($conn,"select table_id,table_name from sys.tables"); + if($res!=0) { + echo("Statement ok!"); + if(ovrimos_fetch_into($res,&$row)) { + list($table_id,$table_name)=$row; + echo("table_id=" . $table_id . ", table_name=" . $table_name . "\n"); + if(ovrimos_fetch_into($res,&$row)) { + list($table_id,$table_name)=$row; + echo("table_id=" . $table_id . ", table_name=" . $table_name . "\n"); + } else { + echo("Next: error\n"); + } + } else { + echo("First: error\n"); + } + ovrimos_free_result($res); + } + ovrimos_close($conn); +} +?> + + + This example will fetch a row. + + + + + + + ovrimos_fetch_row + Fetches a row from the result set. + + + Description + + + int ovrimos_fetch_row + int result_id + [int int how + [int int row_number]] + + + + ovrimos_fetch_row is used to fetch a row from the result set. + + + ovrimos_fetch_row +Fetches a row from the result set. Column values should be retrieved with +other calls. Returns true or false. + + + + A fetch row example + +<?php +$conn=ovrimos_connect("remote.host","8001","admin","password"); +if($conn!=0) { + echo("Connection ok!"); + $res=ovrimos_exec($conn,"select table_id,table_name from sys.tables"); + if($res!=0) { + echo("Statement ok!"); + if(ovrimos_fetch_row($res,"First")) { + $table_id=ovrimos_result($res,1); + $table_name=ovrimos_result($res,2); + echo("table_id=" . $table_id . ", table_name=" . $table_name . "\n"); + if(ovrimos_fetch_row($res,"Next")) { + $table_id=ovrimos_result($res,"table_id"); + $table_name=ovrimos_result($res,"table_name"); + echo("table_id=" . $table_id . ", table_name=" . $table_name . "\n"); + } else { + echo("Next: error\n"); + } + } else { + echo("First: error\n"); + } + ovrimos_free_result($res); + } + ovrimos_close($conn); +} +?> + + + This will fetch a row and print the result. + + + + + + + ovrimos_result + Retrieves the output column + + + Description + + + int ovrimos_result + int result_id + mixed field + + + + ovrimos_result is used to retrieve the output column. + + + ovrimos_result +Retrieves the output column specified by 'field', either as a string or +as an 1-based index. + + + + + + + ovrimos_result_all + Prints the whole result set as an HTML table + + + Description + + + int ovrimos_result_all + int result_id + [string format] + + + + ovrimos_result_all is used to print an HTML table containing the whole result set. + + + ovrimos_result_all +Prints the whole result set as an HTML table. Returns true or false. + + + + + Prepare a statement, execute, and view the result + +<?php +$conn=ovrimos_connect("db_host","8001","admin","password"); +if($conn!=0) { + echo("Connection ok!"); + $res=ovrimos_prepare($conn,"select table_id,table_name from sys.tables where table_id=?"); + if($res!=0) { + echo("Prepare ok!"); + if(ovrimos_execute($res,array(3))) { + echo("Execute ok!\n"); + ovrimos_result_all($res); + } else { + echo("Execute not ok!"); + } + ovrimos_free_result($res); + } else { + echo("Prepare not ok!\n"); + } + ovrimos_close($conn); +} +?> + + + This will execute an SQL statement and print the result in an HTML table. + + + + ovrimos_result_all with meta-information + +<?php +$conn=ovrimos_connect("db_host","8001","admin","password"); +if($conn!=0) { + echo("Connection ok!"); + $res=ovrimos_exec($conn,"select table_id,table_name from sys.tables where tabl + if($res!=0) { + echo("Statement ok! cursor=" . ovrimos_cursor($res) . "\n"); + $colnb=ovrimos_num_fields($res); + echo("Output columns=" . $colnb . "\n"); + for($i=1; $i<=$colnb; $i++) { + $name=ovrimos_field_name($res,$i); + $type=ovrimos_field_type($res,$i); + $len=ovrimos_field_len($res,$i); + echo("Column " . $i . " name=" . $name . " type=" . $type . " len=". $len . + } + ovrimos_result_all($res); + ovrimos_free_result($res); + } + ovrimos_close($conn); +} +?> + + + + + + + ovrimos_result_all example + +<?php +$conn=ovrimos_connect("db_host","8001","admin","password"); +if($conn!=0) { + echo("Connection ok!"); + $res=ovrimos_exec($conn,"update test set i=5"); + if($res!=0) { + echo("Statement ok!"); + echo(ovrimos_num_rows($res) . " rows affected\n"); + ovrimos_free_result($res); + } + ovrimos_close($conn); +} +?> + + + + + + + + + + ovrimos_num_rows + Returns the number of rows affected by update operations + + + Description + + + int ovrimos_num_rows + int result_id + + + + ovrimos_num_rows is used to get the number of rows affected by update operations. + + + ovrimos_num_rows +Returns the number of rows affected by update operations. + + + + + + + ovrimos_num_fields + Returns the number of columns + + + Description + + + int ovrimos_num_fields + int result_id + + + + ovrimos_num_fields is used to get the number of columns. + + + ovrimos_num_fields +Returns the number of columns in a result_id resulting from a query. + + + + + + + ovrimos_field_name + Returns the output column name + + + Description + + + int ovrimos_field_name + int result_id + int field_number + + + + ovrimos_field_name is used to get the output column name. + + + ovrimos_field_name +Returns the output column name at the (1-based) index specified. + + + + + + + ovrimos_field_type + Returns the (numeric) type of the output column + + + Description + + + int ovrimos_field_type + int result_id + int field_number + + + + ovrimos_field_type is used to get the (numeric) type of the output column. + + + ovrimos_field_type +Returns the (numeric) type of the output column at the (1-based) index +specified. + + + + + + + ovrimos_field_len + Returns the length of the output column + + + Description + + + int ovrimos_field_len + int result_id + int field_number + + + + ovrimos_field_len is used to get the length of the output column. + + + ovrimos_field_len +Returns the length of the output column at the (1-based) index specified. + + + + + + + ovrimos_field_num + Returns the (1-based) index of the output column + + + Description + + + int ovrimos_field_num + int result_id + string field_name + + + + ovrimos_field_num is used to get the (1-based) index of the output column. + + + ovrimos_field_num +Returns the (1-based) index of the output column specified by name, or false. + + + + + + + ovrimos_free_result + Frees the specified result_id + + + Description + + + int ovrimos_free_result + int result_id + + + + ovrimos_free_result is used to free the result_id. + + + ovrimos_free_result +Frees the specified result_id. Returns true. + + + + + + + ovrimos_commit + Commits the transaction + + + Description + + + int ovrimos_commit + int connection_id + + + + ovrimos_commit is used to commit the transaction + + + ovrimos_commit +Commits the transaction. + + + + + + + ovrimos_rollback + Rolls back the transaction + + + Description + + + int ovrimos_rollback + int connection_id + + + + ovrimos_rollback is used to roll back the transaction + + + ovrimos_rollback +Rolls back the transaction. + + + + + + + +