From a912b0202947ec6b60bb1666683ac5c5e98bd97d Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Mon, 12 Nov 2001 16:56:56 +0000 Subject: [PATCH] whitespace/indent git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@62135 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/sesam.xml | 1350 +++++++++++++++++++++---------------------- 1 file changed, 675 insertions(+), 675 deletions(-) diff --git a/functions/sesam.xml b/functions/sesam.xml index b6b375cba1..59bebea44d 100644 --- a/functions/sesam.xml +++ b/functions/sesam.xml @@ -1,5 +1,5 @@ - + SESAM database functions SESAM @@ -43,77 +43,77 @@ There is no standalone support for the PHP SESAM interface, it works only as an integrated Apache module. In the Apache PHP module, this SESAM interface is - configured using Apache directives. + configured using Apache directives. SESAM Configuration directives - Directive - Meaning + Directive + Meaning - php3_sesam_oml - - Name of BS2000 PLAM library containing the loadable SESAM - driver modules. Required for using SESAM functions. - - Example: - - -php3_sesam_oml $.SYSLNK.SESAM-SQL.030 - - - - - - - php3_sesam_configfile - - Name of SESAM application configuration file. Required for - using SESAM functions. - - Example: - - -php3_sesam_configfile $SESAM.SESAM.CONF.AW - - - It will usually contain a configuration like (see SESAM - reference manual): - - -CNF=B -NAM=K -NOTYPE - - - - - - - php3_sesam_messagecatalog - - Name of SESAM message catalog file. In most cases, this - directive is not neccessary. Only if the SESAM message file - is not installed in the system's BS2000 message file table, - it can be set with this directive. - - Example: - - -php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 - - - - - - - -
+ php3_sesam_oml + + Name of BS2000 PLAM library containing the loadable SESAM + driver modules. Required for using SESAM functions. + + Example: + + + php3_sesam_oml $.SYSLNK.SESAM-SQL.030 + + + + + + php3_sesam_configfile + + Name of SESAM application configuration file. Required for + using SESAM functions. + + Example: + + + php3_sesam_configfile $SESAM.SESAM.CONF.AW + + + It will usually contain a configuration like (see SESAM + reference manual): + + + CNF=B + NAM=K + NOTYPE + + + + + + + php3_sesam_messagecatalog + + Name of SESAM message catalog file. In most cases, this + directive is not neccessary. Only if the SESAM message file + is not installed in the system's BS2000 message file table, + it can be set with this directive. + + Example: + + + php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 + + + + + + + + + In addition to the configuration of the PHP/SESAM interface, you have to configure the SESAM-Database server itself on your @@ -121,12 +121,12 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 - starting the SESAM database handler (DBH), and + starting the SESAM database handler (DBH), and - connecting the databases with the SESAM database handler + connecting the databases with the SESAM database handler @@ -155,7 +155,7 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 Only a small stub loader (SESMOD) is linked with PHP, and the SESAM connection modules are pulled in from SESAM's OML PLAM library. In the configuration, you must tell PHP + linkend="ini.sect.sesam">configuration, you must tell PHP the name of this PLAM library, and the file link to use for the SESAM configuration file (As of SESAM V3.0, SQLSCI is available in the SESAM Tool Library, which is part of the standard @@ -166,9 +166,9 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 single quotes (as opposed to a single quote preceded by a backslash, used in some other databases), it is advisable to set the PHP configuration directives php3_magic_quotes_gpc + linkend="ini.magic-quotes-gpc">php3_magic_quotes_gpc and php3_magic_quotes_sybase + linkend="ini.magic-quotes-sybase">php3_magic_quotes_sybase to On for all PHP scripts using the SESAM interface. @@ -225,42 +225,42 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 - Scroll Type - Action + Scroll Type + Action - SESAM_SEEK_NEXT - none + SESAM_SEEK_NEXT + none - SESAM_SEEK_PRIOR - none + SESAM_SEEK_PRIOR + none - SESAM_SEEK_FIRST - - set scroll type to SESAM_SEEK_NEXT - + SESAM_SEEK_FIRST + + set scroll type to SESAM_SEEK_NEXT + - SESAM_SEEK_LAST - - set scroll type to SESAM_SEEK_PRIOR - + SESAM_SEEK_LAST + + set scroll type to SESAM_SEEK_PRIOR + - SESAM_SEEK_ABSOLUTE - Auto-Increment internal offset value + SESAM_SEEK_ABSOLUTE + Auto-Increment internal offset value - SESAM_SEEK_RELATIVE - none. (maintain global default - - offset value, which allows for, e.g., fetching - each 10th row backwards) - + SESAM_SEEK_RELATIVE + none. (maintain global default + + offset value, which allows for, e.g., fetching + each 10th row backwards) + @@ -310,87 +310,87 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 Vendor specific data types - Some vendor specific data types may have to be replaced by - standard SQL data types (e.g., TEXT could - be replaced by VARCHAR(max. size)). + Some vendor specific data types may have to be replaced by + standard SQL data types (e.g., TEXT could + be replaced by VARCHAR(max. size)). Keywords as SQL identifiers - In SESAM (as in standard SQL), such identifiers must be - enclosed in double quotes (or renamed). + In SESAM (as in standard SQL), such identifiers must be + enclosed in double quotes (or renamed). - Display length in data types + Display length in data types - SESAM data types have a precision, not a display - length. Instead of int(4) (intended use: - integers up to '9999'), SESAM requires simply - int for an implied size of 31 bits. Also, - the only datetime data types available in SESAM are: - DATE, TIME(3) and - TIMESTAMP(3). + SESAM data types have a precision, not a display + length. Instead of int(4) (intended use: + integers up to '9999'), SESAM requires simply + int for an implied size of 31 bits. Also, + the only datetime data types available in SESAM are: + DATE, TIME(3) and + TIMESTAMP(3). - SQL types with vendor-specific unsigned, - zerofill, or - auto_increment attributes + SQL types with vendor-specific unsigned, + zerofill, or + auto_increment attributes - Unsigned and zerofill - are not supported. Auto_increment is - automatic (use "INSERT ... VALUES(*, ...)" - instead of "... VALUES(0, ...)" to take - advantage of SESAM-implied auto-increment. + Unsigned and zerofill + are not supported. Auto_increment is + automatic (use "INSERT ... VALUES(*, ...)" + instead of "... VALUES(0, ...)" to take + advantage of SESAM-implied auto-increment. - int ... DEFAULT '0000' + int ... DEFAULT '0000' - Numeric variables must not be initialized with string - constants. Use DEFAULT 0 instead. To - initialize variables of the datetime SQL data types, the - initialization string must be prefixed with the respective - type keyword, as in: CREATE TABLE exmpl ( xtime - timestamp(3) DEFAULT TIMESTAMP '1970-01-01 00:00:00.000' NOT - &null; ); + Numeric variables must not be initialized with string + constants. Use DEFAULT 0 instead. To + initialize variables of the datetime SQL data types, the + initialization string must be prefixed with the respective + type keyword, as in: CREATE TABLE exmpl ( xtime + timestamp(3) DEFAULT TIMESTAMP '1970-01-01 00:00:00.000' NOT + &null; ); - $count = xxxx_num_rows(); + $count = xxxx_num_rows(); - Some databases promise to guess/estimate the number of the - rows in a query result, even though the returned value is - grossly incorrect. SESAM does not know the number of rows in - a query result before actually fetching them. If you REALLY - need the count, try SELECT COUNT(...) WHERE - ..., it will tell you the number of hits. A second - query will (hopefully) return the results. + Some databases promise to guess/estimate the number of the + rows in a query result, even though the returned value is + grossly incorrect. SESAM does not know the number of rows in + a query result before actually fetching them. If you REALLY + need the count, try SELECT COUNT(...) WHERE + ..., it will tell you the number of hits. A second + query will (hopefully) return the results. - DROP TABLE thename; + DROP TABLE thename; - In SESAM, in the DROP TABLE command, the - table name must be either followed by the keyword - RESTRICT or - CASCADE. When specifying - RESTRICT, an error is returned if there are - dependent objects (e.g., VIEWs), while with - CASCADE, dependent objects will be deleted - along with the specified table. + In SESAM, in the DROP TABLE command, the + table name must be either followed by the keyword + RESTRICT or + CASCADE. When specifying + RESTRICT, an error is returned if there are + dependent objects (e.g., VIEWs), while with + CASCADE, dependent objects will be deleted + along with the specified table. @@ -412,26 +412,26 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 - SQL Type - PHP Type + SQL Type + PHP Type - SMALLINT, INTEGER - integer + SMALLINT, INTEGER + integer - NUMERIC, DECIMAL, FLOAT, REAL, DOUBLE - float + NUMERIC, DECIMAL, FLOAT, REAL, DOUBLE + float - DATE, TIME, TIMESTAMP - string + DATE, TIME, TIMESTAMP + string - VARCHAR, CHARACTER - string + VARCHAR, CHARACTER + string @@ -454,18 +454,18 @@ php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030 Creating a "multiple field" column -CREATE TABLE multi_field_test ( - pkey CHAR(20) PRIMARY KEY, - multi(3) CHAR(12) -) + CREATE TABLE multi_field_test ( + pkey CHAR(20) PRIMARY KEY, + multi(3) CHAR(12) + ) and can be filled in using: Filling a "multiple field" column -INSERT INTO multi_field_test (pkey, multi(2..3) ) - VALUES ('Second', <'first_val', 'second_val'>) + INSERT INTO multi_field_test (pkey, multi(2..3) ) + VALUES ('Second', <'first_val', 'second_val'>) Note that (like in this case) leading empty sub-fields are @@ -482,9 +482,9 @@ INSERT INTO multi_field_test (pkey, multi(2..3) ) For specific SESAM details, please refer to the SESAM/SQL-Server documentation - (english) or the - SESAM/SQL-Server documentation (german), both available + url="&url.sesam.en;">the SESAM/SQL-Server documentation + (english) or the + SESAM/SQL-Server documentation (german), both available online, or use the respective manuals. @@ -520,7 +520,7 @@ INSERT INTO multi_field_test (pkey, multi(2..3) ) When creating a database, the "catalog" name is specified in the SESAM configuration directive //ADD-SQL-DATABASE-CATALOG-LIST ENTRY-1 = - *CATALOG(CATALOG-NAME = catalogname,...) + *CATALOG(CATALOG-NAME = catalogname,...) The "schema" references the desired @@ -540,10 +540,10 @@ INSERT INTO multi_field_test (pkey, multi(2..3) ) Connect to a SESAM database -<?php -if (!sesam_connect ("mycatalog", "myschema", "otto") - die("Unable to connect to SESAM"; -?> + <?php + if (!sesam_connect ("mycatalog", "myschema", "otto") + die("Unable to connect to SESAM"; + ?> @@ -590,10 +590,10 @@ if (!sesam_connect ("mycatalog", "myschema", "otto") Closing a SESAM connection -if (sesam_connect ("mycatalog", "myschema", "otto")) { - ... some queries and stuff ... - sesam_disconnect(); -} + if (sesam_connect ("mycatalog", "myschema", "otto")) { + ... some queries and stuff ... + sesam_disconnect(); + } @@ -617,7 +617,7 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { Returns: &true; if the values are valid, and the settransaction operation was successful, - &false; otherwise. + &false; otherwise. sesam_settransaction overrides the default @@ -644,31 +644,31 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { - Value - Constant - Meaning + Value + Constant + Meaning - 1 - SESAM_TXISOL_READ_UNCOMMITTED - Read Uncommitted + 1 + SESAM_TXISOL_READ_UNCOMMITTED + Read Uncommitted - 2 - SESAM_TXISOL_READ_COMMITTED - Read Committed + 2 + SESAM_TXISOL_READ_COMMITTED + Read Committed - 3 - SESAM_TXISOL_REPEATABLE_READ - Repeatable Read + 3 + SESAM_TXISOL_REPEATABLE_READ + Repeatable Read - 4 - SESAM_TXISOL_SERIALIZABLE - Serializable + 4 + SESAM_TXISOL_SERIALIZABLE + Serializable @@ -680,21 +680,21 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { - Value - Constant - Meaning + Value + Constant + Meaning - 0 - SESAM_TXREAD_READWRITE - Read/Write + 0 + SESAM_TXREAD_READWRITE + Read/Write - 1 - SESAM_TXREAD_READONLY - Read-Only + 1 + SESAM_TXREAD_READONLY + Read-Only @@ -703,16 +703,16 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { The values set by sesam_settransaction will override the default setting specified in the SESAM configuration file. + linkend="ini.sesam-configfile">SESAM configuration file. Setting SESAM transaction parameters -<?php -sesam_settransaction (SESAM_TXISOL_REPEATABLE_READ, - SESAM_TXREAD_READONLY); -?> + <?php + sesam_settransaction (SESAM_TXISOL_REPEATABLE_READ, + SESAM_TXREAD_READONLY); + ?> @@ -736,7 +736,7 @@ sesam_settransaction (SESAM_TXISOL_REPEATABLE_READ, Returns: &true; on success, - &false; on errors + &false; on errors sesam_commit commits any pending updates to @@ -756,14 +756,14 @@ sesam_settransaction (SESAM_TXISOL_REPEATABLE_READ, Committing an update to the SESAM database -<?php -if (sesam_connect ("mycatalog", "myschema", "otto")) { - if (!sesam_execimm ("INSERT INTO mytable VALUES (*, 'Small Test', <0, 8, 15>)")) - die("insert failed"); - if (!sesam_commit()) - die("commit failed"); -} -?> + <?php + if (sesam_connect ("mycatalog", "myschema", "otto")) { + if (!sesam_execimm ("INSERT INTO mytable VALUES (*, 'Small Test', <0, 8, 15>)")) + die("insert failed"); + if (!sesam_commit()) + die("commit failed"); + } + ?> @@ -787,7 +787,7 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { Returns: &true; on success, - &false; on errors + &false; on errors sesam_rollback discards any pending updates @@ -805,15 +805,15 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { Discarding an update to the SESAM database -<?php -if (sesam_connect ("mycatalog", "myschema", "otto")) { - if (sesam_execimm ("INSERT INTO mytable VALUES (*, 'Small Test', <0, 8, 15>)") - && sesam_execimm ("INSERT INTO othertable VALUES (*, 'Another Test', 1)")) - sesam_commit(); - else - sesam_rollback(); -} -?> + <?php + if (sesam_connect ("mycatalog", "myschema", "otto")) { + if (sesam_execimm ("INSERT INTO mytable VALUES (*, 'Small Test', <0, 8, 15>)") + && sesam_execimm ("INSERT INTO othertable VALUES (*, 'Another Test', 1)")) + sesam_commit(); + else + sesam_rollback(); + } + ?> @@ -835,7 +835,7 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { Returns: A SESAM "result identifier" on success, or - &false; on error. + &false; on error. sesam_execimm executes an "immediate" @@ -863,10 +863,10 @@ if (sesam_connect ("mycatalog", "myschema", "otto")) { -$stmt = "INSERT INTO mytable VALUES ('one', 'two')"; -$result = sesam_execimm ($stmt); -$err = sesam_diagnostic(); -print ("sqlstate = ".$err["sqlstate"]."\n". + $stmt = "INSERT INTO mytable VALUES ('one', 'two')"; + $result = sesam_execimm ($stmt); + $err = sesam_diagnostic(); + print ("sqlstate = ".$err["sqlstate"]."\n". "Affected rows = ".$err["rowcount"]." == ". sesam_affected_rows($result)."\n"); @@ -876,7 +876,7 @@ print ("sqlstate = ".$err["sqlstate"]."\n". - + sesam_query @@ -895,7 +895,7 @@ print ("sqlstate = ".$err["sqlstate"]."\n". Returns: A SESAM "result identifier" on success, or - &false; on error. + &false; on error. A "result_id" resource is used by other functions to retrieve the @@ -937,53 +937,53 @@ print ("sqlstate = ".$err["sqlstate"]."\n". Show all rows of the "phone" table as a html table -<?php -if (!sesam_connect ("phonedb", "demo", "otto")) - die ("cannot connect"); -$result = sesam_query ("select * from phone"); -if (!$result) { - $err = sesam_diagnostic(); - die ($err["errmsg"]); -} -echo "<TABLE BORDER>\n"; -// Add title header with column names above the result: -if ($cols = sesam_field_array ($result)) { - echo " <TR><TH COLSPAN=".$cols["count"].">Result:</TH></TR>\n"; - echo " <TR>\n"; - for ($col = 0; $col < $cols["count"]; ++$col) { - $colattr = $cols[$col]; - /* Span the table head over SESAM's "Multiple Fields": */ - if ($colattr["count"] > 1) { - echo " <TH COLSPAN=".$colattr["count"].">".$colattr["name"]. - "(1..".$colattr["count"].")</TH>\n"; - $col += $colattr["count"] - 1; - } else - echo " <TH>" . $colattr["name"] . "</TH>\n"; - } - echo " </TR>\n"; -} + <?php + if (!sesam_connect ("phonedb", "demo", "otto")) + die ("cannot connect"); + $result = sesam_query ("select * from phone"); + if (!$result) { + $err = sesam_diagnostic(); + die ($err["errmsg"]); + } + echo "<TABLE BORDER>\n"; + // Add title header with column names above the result: + if ($cols = sesam_field_array ($result)) { + echo " <TR><TH COLSPAN=".$cols["count"].">Result:</TH></TR>\n"; + echo " <TR>\n"; + for ($col = 0; $col < $cols["count"]; ++$col) { + $colattr = $cols[$col]; + /* Span the table head over SESAM's "Multiple Fields": */ + if ($colattr["count"] > 1) { + echo " <TH COLSPAN=".$colattr["count"].">".$colattr["name"]. + "(1..".$colattr["count"].")</TH>\n"; + $col += $colattr["count"] - 1; + } else + echo " <TH>" . $colattr["name"] . "</TH>\n"; + } + echo " </TR>\n"; + } -do { - // Fetch the result in chunks of 100 rows max. - $ok = sesam_fetch_result ($result, 100); - for ($row=0; $row < $ok["rows"]; ++$row) { - echo " <TR>\n"; - for ($col = 0; $col < $ok["cols"]; ++$col) { - if (isset($ok[$col][$row])) - echo " <TD>" . $ok[$col][$row] . "</TD>\n"; - } else { - echo " <TD>-empty-</TD>\n"; - } - } - echo " </TR>\n"; - } -} -while ($ok["truncated"]) { // while there may be more data - echo "</TABLE>\n"; -} -// free result id -sesam_free_result($result); -?> + do { + // Fetch the result in chunks of 100 rows max. + $ok = sesam_fetch_result ($result, 100); + for ($row=0; $row < $ok["rows"]; ++$row) { + echo " <TR>\n"; + for ($col = 0; $col < $ok["cols"]; ++$col) { + if (isset($ok[$col][$row])) + echo " <TD>" . $ok[$col][$row] . "</TD>\n"; + } else { + echo " <TD>-empty-</TD>\n"; + } + } + echo " </TR>\n"; + } + } + while ($ok["truncated"]) { // while there may be more data + echo "</TABLE>\n"; + } + // free result id + sesam_free_result($result); + ?> @@ -1011,7 +1011,7 @@ sesam_free_result($result); result. Returns an integer describing the total number of columns (aka. fields) in the current result_id result set or - &false; on error. + &false; on error. For "immediate" statements, the value zero is returned. The SESAM @@ -1025,7 +1025,7 @@ sesam_free_result($result); - + sesam_field_name @@ -1088,45 +1088,45 @@ sesam_free_result($result); - Element - Contents + Element + Contents - $array["sqlstate"] - - 5 digit SQL return code (see the SESAM manual for the - description of the possible values of SQLSTATE) - + $array["sqlstate"] + + 5 digit SQL return code (see the SESAM manual for the + description of the possible values of SQLSTATE) + - $array["rowcount"] - - number of affected rows in last update/insert/delete (set - after "immediate" statements only) - + $array["rowcount"] + + number of affected rows in last update/insert/delete (set + after "immediate" statements only) + - $array["errmsg"] - - "human readable" error message string (set after errors - only) - + $array["errmsg"] + + "human readable" error message string (set after errors + only) + - $array["errcol"] - - error column number of previous error (0-based; or -1 if - undefined. Set after errors only) - + $array["errcol"] + + error column number of previous error (0-based; or -1 if + undefined. Set after errors only) + - $array["errlin"] - - error line number of previous error (0-based; or -1 if - undefined. Set after errors only) - + $array["errlin"] + + error line number of previous error (0-based; or -1 if + undefined. Set after errors only) + @@ -1139,70 +1139,70 @@ sesam_free_result($result); Displaying SESAM error messages with error position -<?php -// Function which prints a formatted error message, -// displaying a pointer to the syntax error in the -// SQL statement -function PrintReturncode ($exec_str) { - $err = Sesam_Diagnostic(); - $colspan=4; // 4 cols for: sqlstate, errlin, errcol, rowcount - if ($err["errlin"] == -1) - --$colspan; - if ($err["errcol"] == -1) - --$colspan; - if ($err["rowcount"] == 0) - --$colspan; - echo "<TABLE BORDER>\n"; - echo "<TR><TH COLSPAN=".$colspan."><FONT COLOR=red>ERROR:</FONT> ". - htmlspecialchars($err["errmsg"])."</TH></TR>\n"; - if ($err["errcol"] >= 0) { - echo "<TR><TD COLSPAN=".$colspan."><PRE>\n"; - $errstmt = $exec_str."\n"; - for ($lin=0; $errstmt != ""; ++$lin) { - if ($lin != $err["errlin"]) { // $lin is less or greater than errlin - if (!($i = strchr ($errstmt, "\n"))) - $i = ""; - $line = substr ($errstmt, 0, strlen($errstmt)-strlen($i)+1); - $errstmt = substr($i, 1); - if ($line != "\n") - print htmlspecialchars ($line); - } else { - if (! ($i = strchr ($errstmt, "\n"))) - $i = ""; - $line = substr ($errstmt, 0, strlen ($errstmt)-strlen($i)+1); - $errstmt = substr($i, 1); - for ($col=0; $col < $err["errcol"]; ++$col) - echo (substr($line, $col, 1) == "\t") ? "\t" : "."; - echo "<FONT COLOR=RED><BLINK>\\</BLINK></FONT>\n"; - print "<FONT COLOR=\"#880000\">".htmlspecialchars($line)."</FONT>"; - for ($col=0; $col < $err["errcol"]; ++$col) - echo (substr ($line, $col, 1) == "\t") ? "\t" : "."; - echo "<FONT COLOR=RED><BLINK>/</BLINK></FONT>\n"; - } - } - echo "</PRE></TD></TR>\n"; - } - echo "<TR>\n"; - echo " <TD>sqlstate=" . $err["sqlstate"] . "</TD>\n"; - if ($err["errlin"] != -1) - echo " <TD>errlin=" . $err["errlin"] . "</TD>\n"; - if ($err["errcol"] != -1) - echo " <TD>errcol=" . $err["errcol"] . "</TD>\n"; - if ($err["rowcount"] != 0) - echo " <TD>rowcount=" . $err["rowcount"] . "</TD>\n"; - echo "</TR>\n"; - echo "</TABLE>\n"; -} + <?php + // Function which prints a formatted error message, + // displaying a pointer to the syntax error in the + // SQL statement + function PrintReturncode ($exec_str) { + $err = Sesam_Diagnostic(); + $colspan=4; // 4 cols for: sqlstate, errlin, errcol, rowcount + if ($err["errlin"] == -1) + --$colspan; + if ($err["errcol"] == -1) + --$colspan; + if ($err["rowcount"] == 0) + --$colspan; + echo "<TABLE BORDER>\n"; + echo "<TR><TH COLSPAN=".$colspan."><FONT COLOR=red>ERROR:</FONT> ". + htmlspecialchars($err["errmsg"])."</TH></TR>\n"; + if ($err["errcol"] >= 0) { + echo "<TR><TD COLSPAN=".$colspan."><PRE>\n"; + $errstmt = $exec_str."\n"; + for ($lin=0; $errstmt != ""; ++$lin) { + if ($lin != $err["errlin"]) { // $lin is less or greater than errlin + if (!($i = strchr ($errstmt, "\n"))) + $i = ""; + $line = substr ($errstmt, 0, strlen($errstmt)-strlen($i)+1); + $errstmt = substr($i, 1); + if ($line != "\n") + print htmlspecialchars ($line); + } else { + if (! ($i = strchr ($errstmt, "\n"))) + $i = ""; + $line = substr ($errstmt, 0, strlen ($errstmt)-strlen($i)+1); + $errstmt = substr($i, 1); + for ($col=0; $col < $err["errcol"]; ++$col) + echo (substr($line, $col, 1) == "\t") ? "\t" : "."; + echo "<FONT COLOR=RED><BLINK>\\</BLINK></FONT>\n"; + print "<FONT COLOR=\"#880000\">".htmlspecialchars($line)."</FONT>"; + for ($col=0; $col < $err["errcol"]; ++$col) + echo (substr ($line, $col, 1) == "\t") ? "\t" : "."; + echo "<FONT COLOR=RED><BLINK>/</BLINK></FONT>\n"; + } + } + echo "</PRE></TD></TR>\n"; + } + echo "<TR>\n"; + echo " <TD>sqlstate=" . $err["sqlstate"] . "</TD>\n"; + if ($err["errlin"] != -1) + echo " <TD>errlin=" . $err["errlin"] . "</TD>\n"; + if ($err["errcol"] != -1) + echo " <TD>errcol=" . $err["errcol"] . "</TD>\n"; + if ($err["rowcount"] != 0) + echo " <TD>rowcount=" . $err["rowcount"] . "</TD>\n"; + echo "</TR>\n"; + echo "</TABLE>\n"; + } -if (!sesam_connect ("mycatalog", "phoneno", "otto")) - die ("cannot connect"); + if (!sesam_connect ("mycatalog", "phoneno", "otto")) + die ("cannot connect"); -$stmt = "SELECT * FROM phone\n". - " WHERE@ LASTNAME='KRAEMER'\n". - " ORDER BY FIRSTNAME"; -if (!($result = sesam_query ($stmt))) - PrintReturncode ($stmt); -?> + $stmt = "SELECT * FROM phone\n". + " WHERE@ LASTNAME='KRAEMER'\n". + " ORDER BY FIRSTNAME"; + if (!($result = sesam_query ($stmt))) + PrintReturncode ($stmt); + ?> @@ -1242,54 +1242,54 @@ if (!($result = sesam_query ($stmt))) - Array Element - Contents + Array Element + Contents - int $arr["count"] - - number of columns in result set (or zero if this was an - "immediate" query) - + int $arr["count"] + + number of columns in result set (or zero if this was an + "immediate" query) + - int $arr["rows"] - - number of rows in result set (between zero and - max_rows) - + int $arr["rows"] + + number of rows in result set (between zero and + max_rows) + - boolean $arr["truncated"] - - &true; if the number of rows was at least - max_rows, &false; - otherwise. Note that even when this is - &true;, the next - sesam_fetch_result call may return zero - rows because there are no more result entries. - + boolean $arr["truncated"] + + &true; if the number of rows was at least + max_rows, &false; + otherwise. Note that even when this is + &true;, the next + sesam_fetch_result call may return zero + rows because there are no more result entries. + - mixed $arr[col][row] - - result data for all the fields at - row(row) and - column(col), (where the integer index - row is between 0 and - $arr["rows"]-1, and - col is between 0 and - $arr["count"]-1). Fields may be empty, so - you must check for the existence of a field by using the php - isset function. The type of the - returned fields depend on the respective SQL type declared - for its column (see SESAM - overview for the conversions applied). SESAM - "multiple fields" are "inlined" and treated like a sequence - of columns. - + mixed $arr[col][row] + + result data for all the fields at + row(row) and + column(col), (where the integer index + row is between 0 and + $arr["rows"]-1, and + col is between 0 and + $arr["count"]-1). Fields may be empty, so + you must check for the existence of a field by using the php + isset function. The type of the + returned fields depend on the respective SQL type declared + for its column (see SESAM + overview for the conversions applied). SESAM + "multiple fields" are "inlined" and treated like a sequence + of columns. + @@ -1350,12 +1350,12 @@ if (!($result = sesam_query ($stmt))) -$result = sesam_execimm ("DELETE FROM PHONE WHERE LASTNAME = '".strtoupper ($name)."'"); -if (!$result) { - ... error ... -} -print sesam_affected_rows ($result). - " entries with last name ".$name." deleted.\n" + $result = sesam_execimm ("DELETE FROM PHONE WHERE LASTNAME = '".strtoupper ($name)."'"); + if (!$result) { + ... error ... + } + print sesam_affected_rows ($result). + " entries with last name ".$name." deleted.\n" @@ -1380,8 +1380,8 @@ print sesam_affected_rows ($result). -if (!sesam_execimm ($stmt)) - printf ("%s<br>\n", sesam_errormsg()); + if (!sesam_execimm ($stmt)) + printf ("%s<br>\n", sesam_errormsg()); @@ -1424,158 +1424,158 @@ if (!sesam_execimm ($stmt)) - Array Element - Contents + Array Element + Contents - int $arr["count"] - - Total number of columns in result set (or zero if this was - an "immediate" query). SESAM "multiple fields" are - "inlined" and treated like the respective number of columns. - + int $arr["count"] + + Total number of columns in result set (or zero if this was + an "immediate" query). SESAM "multiple fields" are + "inlined" and treated like the respective number of columns. + - string $arr[col]["name"] - - column name for column(col), where - col is between 0 and - $arr["count"]-1. The returned value can - be the empty string (for dynamically computed - columns). SESAM "multiple fields" are "inlined" and treated - like the respective number of columns, each with the same - column name. - + string $arr[col]["name"] + + column name for column(col), where + col is between 0 and + $arr["count"]-1. The returned value can + be the empty string (for dynamically computed + columns). SESAM "multiple fields" are "inlined" and treated + like the respective number of columns, each with the same + column name. + - string $arr[col]["count"] - - The "count" attribute describes the repetition factor when - the column has been declared as a "multiple field". Usually, - the "count" attribute is 1. The first column of a "multiple - field" column however contains the number of repetitions - (the second and following column of the "multiple field" - contain a "count" attribute of 1). This can be used to - detect "multiple fields" in the result set. See the example - shown in the sesam_query description - for a sample use of the "count" attribute. - + string $arr[col]["count"] + + The "count" attribute describes the repetition factor when + the column has been declared as a "multiple field". Usually, + the "count" attribute is 1. The first column of a "multiple + field" column however contains the number of repetitions + (the second and following column of the "multiple field" + contain a "count" attribute of 1). This can be used to + detect "multiple fields" in the result set. See the example + shown in the sesam_query description + for a sample use of the "count" attribute. + - string $arr[col]["type"] - - php variable type of the data for - column(col), where col - is between 0 and $arr["count"]-1. The - returned value can be one of - - - integer - - - float - - - string - - - depending on the SQL type of the result. SESAM "multiple - fields" are "inlined" and treated like the respective number - of columns, each with the same php type. - - - - string $arr[col]["sqltype"] - - SQL variable type of the column data for - column(col), where col - is between 0 and $arr["count"]-1. The - returned value can be one of - - - "CHARACTER" - - - "VARCHAR" - - - "NUMERIC" - - - "DECIMAL" - - - "INTEGER" - - - "SMALLINT" - - - "FLOAT" - - - "REAL" - - - "DOUBLE" - - - "DATE" - - - "TIME" - - - "TIMESTAMP" - - - describing the SQL type of the result. SESAM "multiple - fields" are "inlined" and treated like the respective number - of columns, each with the same SQL type. - - - - string $arr[col]["length"] - - The SQL "length" attribute of the SQL variable in - column(col), where col - is between 0 and $arr["count"]-1. The - "length" attribute is used with "CHARACTER" and "VARCHAR" - SQL types to specify the (maximum) length of the string - variable. SESAM "multiple fields" are "inlined" and treated - like the respective number of columns, each with the same - length attribute. - - - - string $arr[col]["precision"] - - The "precision" attribute of the SQL variable in - column(col), where col - is between 0 and $arr["count"]-1. The - "precision" attribute is used with numeric and time data - types. SESAM "multiple fields" are "inlined" and treated - like the respective number of columns, each with the same - precision attribute. - - - - string $arr[col]["scale"] - - The "scale" attribute of the SQL variable in - column(col), where col - is between 0 and $arr["count"]-1. The - "scale" attribute is used with numeric data types. SESAM - "multiple fields" are "inlined" and treated like the - respective number of columns, each with the same scale - attribute. - - - - - + string $arr[col]["type"] + + php variable type of the data for + column(col), where col + is between 0 and $arr["count"]-1. The + returned value can be one of + + + integer + + + float + + + string + + + depending on the SQL type of the result. SESAM "multiple + fields" are "inlined" and treated like the respective number + of columns, each with the same php type. + + + + string $arr[col]["sqltype"] + + SQL variable type of the column data for + column(col), where col + is between 0 and $arr["count"]-1. The + returned value can be one of + + + "CHARACTER" + + + "VARCHAR" + + + "NUMERIC" + + + "DECIMAL" + + + "INTEGER" + + + "SMALLINT" + + + "FLOAT" + + + "REAL" + + + "DOUBLE" + + + "DATE" + + + "TIME" + + + "TIMESTAMP" + + + describing the SQL type of the result. SESAM "multiple + fields" are "inlined" and treated like the respective number + of columns, each with the same SQL type. + + + + string $arr[col]["length"] + + The SQL "length" attribute of the SQL variable in + column(col), where col + is between 0 and $arr["count"]-1. The + "length" attribute is used with "CHARACTER" and "VARCHAR" + SQL types to specify the (maximum) length of the string + variable. SESAM "multiple fields" are "inlined" and treated + like the respective number of columns, each with the same + length attribute. + + + + string $arr[col]["precision"] + + The "precision" attribute of the SQL variable in + column(col), where col + is between 0 and $arr["count"]-1. The + "precision" attribute is used with numeric and time data + types. SESAM "multiple fields" are "inlined" and treated + like the respective number of columns, each with the same + precision attribute. + + + + string $arr[col]["scale"] + + The "scale" attribute of the SQL variable in + column(col), where col + is between 0 and $arr["count"]-1. The + "scale" attribute is used with numeric data types. SESAM + "multiple fields" are "inlined" and treated like the + respective number of columns, each with the same scale + attribute. + + + + + See the sesam_query function for an example @@ -1605,7 +1605,7 @@ if (!sesam_execimm ($stmt)) Returns an array that corresponds to the fetched row, or - &false; if there are no more rows. + &false; if there are no more rows. The number of columns in the result set is returned in an @@ -1627,63 +1627,63 @@ if (!sesam_execimm ($stmt)) - Value - Constant - Meaning + Value + Constant + Meaning - 0 - SESAM_SEEK_NEXT - - read sequentially (after fetch, the internal default is set - to SESAM_SEEK_NEXT) - + 0 + SESAM_SEEK_NEXT + + read sequentially (after fetch, the internal default is set + to SESAM_SEEK_NEXT) + - 1 - SESAM_SEEK_PRIOR - - read sequentially backwards (after fetch, the internal - default is set to SESAM_SEEK_PRIOR) - + 1 + SESAM_SEEK_PRIOR + + read sequentially backwards (after fetch, the internal + default is set to SESAM_SEEK_PRIOR) + - 2 - SESAM_SEEK_FIRST - - rewind to first row (after fetch, the default is set to - SESAM_SEEK_NEXT) - + 2 + SESAM_SEEK_FIRST + + rewind to first row (after fetch, the default is set to + SESAM_SEEK_NEXT) + - 3 - SESAM_SEEK_LAST - - seek to last row (after fetch, the default is set to - SESAM_SEEK_PRIOR) - + 3 + SESAM_SEEK_LAST + + seek to last row (after fetch, the default is set to + SESAM_SEEK_PRIOR) + - 4 - SESAM_SEEK_ABSOLUTE - - seek to absolute row number given as - offset (Zero-based. After fetch, the - internal default is set to - SESAM_SEEK_ABSOLUTE, and the internal - offset value is auto-incremented) - + 4 + SESAM_SEEK_ABSOLUTE + + seek to absolute row number given as + offset (Zero-based. After fetch, the + internal default is set to + SESAM_SEEK_ABSOLUTE, and the internal + offset value is auto-incremented) + - 5 - SESAM_SEEK_RELATIVE - - seek relative to current scroll position, where - offset can be a positive or negative - offset value. - + 5 + SESAM_SEEK_RELATIVE + + seek relative to current scroll position, where + offset can be a positive or negative + offset value. + @@ -1717,40 +1717,40 @@ if (!sesam_execimm ($stmt)) field by using the php isset function. The type of the returned fields depend on the respective SQL type declared for its column (see SESAM - overview for the conversions applied). SESAM "multiple + overview for the conversions applied). SESAM "multiple fields" are "inlined" and treated like a sequence of columns. Subsequent calls to sesam_fetch_row would return the next (or prior, or n'th next/prior, depending on the scroll attributes) row in the result set, or - &false; if there are no more rows. + &false; if there are no more rows. SESAM fetch rows -<?php -$result = sesam_query ("SELECT * FROM phone\n". - " WHERE LASTNAME='".strtoupper($name)."'\n". - " ORDER BY FIRSTNAME", 1); -if (!$result) { - ... error ... -} -// print the table in backward order -print "<TABLE BORDER>\n"; -$row = sesam_fetch_row ($result, SESAM_SEEK_LAST); -while (is_array ($row)) { - print " <TR>\n"; - for ($col = 0; $col < $row["count"]; ++$col) { - print " <TD>".htmlspecialchars ($row[$col])."</TD>\n"; - } - print " </TR>\n"; - // use implied SESAM_SEEK_PRIOR - $row = sesam_fetch_row ($result); -} -print "</TABLE>\n"; -sesam_free_result ($result); -?> + <?php + $result = sesam_query ("SELECT * FROM phone\n". + " WHERE LASTNAME='".strtoupper($name)."'\n". + " ORDER BY FIRSTNAME", 1); + if (!$result) { + ... error ... + } + // print the table in backward order + print "<TABLE BORDER>\n"; + $row = sesam_fetch_row ($result, SESAM_SEEK_LAST); + while (is_array ($row)) { + print " <TR>\n"; + for ($col = 0; $col < $row["count"]; ++$col) { + print " <TD>".htmlspecialchars ($row[$col])."</TD>\n"; + } + print " </TR>\n"; + // use implied SESAM_SEEK_PRIOR + $row = sesam_fetch_row ($result); + } + print "</TABLE>\n"; + sesam_free_result ($result); + ?> @@ -1782,7 +1782,7 @@ sesam_free_result ($result); Returns an array that corresponds to the fetched row, or - &false; if there are no more rows. + &false; if there are no more rows. sesam_fetch_array is an alternative version @@ -1817,7 +1817,7 @@ sesam_free_result ($result); the column. -SELECT TBL1.COL AS FOO, TBL2.COL AS BAR FROM TBL1, TBL2 + SELECT TBL1.COL AS FOO, TBL2.COL AS BAR FROM TBL1, TBL2 @@ -1831,7 +1831,7 @@ SELECT TBL1.COL AS FOO, TBL2.COL AS BAR FROM TBL1, TBL2 declared as: -CREATE TABLE ... ( ... MULTI(3) INT ) + CREATE TABLE ... ( ... MULTI(3) INT ) the associative indices used for the individual "multiple field" @@ -1843,30 +1843,30 @@ CREATE TABLE ... ( ... MULTI(3) INT ) Subsequent calls to sesam_fetch_array would return the next (or prior, or n'th next/prior, depending on the scroll attributes) row in the result set, or - &false; if there are no more rows. + &false; if there are no more rows. SESAM fetch array -<?php -$result = sesam_query ("SELECT * FROM phone\n". - " WHERE LASTNAME='".strtoupper($name)."'\n". - " ORDER BY FIRSTNAME", 1); -if (!$result) { - ... error ... -} -// print the table: -print "<TABLE BORDER>\n"; -while (($row = sesam_fetch_array ($result)) && count ($row) > 0) { - print " <TR>\n"; - print " <TD>".htmlspecialchars ($row["firstname"])."</TD>\n"; - print " <TD>".htmlspecialchars ($row["lastname"])."</TD>\n"; - print " <TD>".htmlspecialchars ($row["phoneno"])."</TD>\n"; - print " </TR>\n"; -} -print "</TABLE>\n"; -sesam_free_result ($result); -?> + <?php + $result = sesam_query ("SELECT * FROM phone\n". + " WHERE LASTNAME='".strtoupper($name)."'\n". + " ORDER BY FIRSTNAME", 1); + if (!$result) { + ... error ... + } + // print the table: + print "<TABLE BORDER>\n"; + while (($row = sesam_fetch_array ($result)) && count ($row) > 0) { + print " <TR>\n"; + print " <TD>".htmlspecialchars ($row["firstname"])."</TD>\n"; + print " <TD>".htmlspecialchars ($row["lastname"])."</TD>\n"; + print " <TD>".htmlspecialchars ($row["phoneno"])."</TD>\n"; + print " </TR>\n"; + } + print "</TABLE>\n"; + sesam_free_result ($result); + ?> @@ -1910,59 +1910,59 @@ sesam_free_result ($result); - Value - Constant - Meaning + Value + Constant + Meaning - 0 - SESAM_SEEK_NEXT - read sequentially - + 0 + SESAM_SEEK_NEXT + read sequentially + - 1 - SESAM_SEEK_PRIOR - read sequentially backwards - + 1 + SESAM_SEEK_PRIOR + read sequentially backwards + - 2 - SESAM_SEEK_FIRST - - fetch first row (after fetch, the default is set to - SESAM_SEEK_NEXT) - + 2 + SESAM_SEEK_FIRST + + fetch first row (after fetch, the default is set to + SESAM_SEEK_NEXT) + - 3 - SESAM_SEEK_LAST - - fetch last row (after fetch, the default is set to - SESAM_SEEK_PRIOR) - + 3 + SESAM_SEEK_LAST + + fetch last row (after fetch, the default is set to + SESAM_SEEK_PRIOR) + - 4 - SESAM_SEEK_ABSOLUTE - - fetch absolute row number given as - offset (Zero-based. After fetch, the - default is set to SESAM_SEEK_ABSOLUTE, - and the offset value is auto-incremented) - + 4 + SESAM_SEEK_ABSOLUTE + + fetch absolute row number given as + offset (Zero-based. After fetch, the + default is set to SESAM_SEEK_ABSOLUTE, + and the offset value is auto-incremented) + - 5 - SESAM_SEEK_RELATIVE - - fetch relative to current scroll position, where - offset can be a positive or negative - offset value (this also sets the default "offset" value for - subsequent fetches). - + 5 + SESAM_SEEK_RELATIVE + + fetch relative to current scroll position, where + offset can be a positive or negative + offset value (this also sets the default "offset" value for + subsequent fetches). + @@ -1994,7 +1994,7 @@ sesam_free_result ($result); Releases resources for the query associated with result_id. Returns - &false; on error. + &false; on error.