Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 2391

php-manual-es-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>sesam_diagnostic</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="SESAM database functions"
HREF="ref.sesam.html"><LINK
REL="PREVIOUS"
TITLE="sesam_connect"
HREF="function.sesam-connect.html"><LINK
REL="NEXT"
TITLE="sesam_disconnect"
HREF="function.sesam-disconnect.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual de PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.sesam-connect.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.sesam-disconnect.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.sesam-diagnostic"
></A
>sesam_diagnostic</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN69065"
></A
><P
>    (PHP 3 CVS only)</P
>sesam_diagnostic&nbsp;--&nbsp;
     Return status information for last SESAM call
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN69068"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>sesam_diagnostic</B
> ( void)<BR
></BR
><P
>&#13;     Returns an associative array of status and return codes for the
     last SQL query/statement/command.  Elements of the array are:
     <DIV
CLASS="table"
><A
NAME="AEN69075"
></A
><P
><B
>Tabla 1. 
       Status information returned by <B
CLASS="function"
>sesam_diagnostic()</B
>
      </B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Element</TH
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
>Contents</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$array["sqlstate"]</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	  5 digit SQL return code (see the SESAM manual for the
	  description of the possible values of SQLSTATE)
	 </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$array["rowcount"]</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	  number of affected rows in last update/insert/delete (set
	  after "immediate" statements only)
	 </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$array["errmsg"]</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	  "human readable" error message string (set after errors
	  only)
	 </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$array["errcol"]</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	  error column number of previous error (0-based; or -1 if
	  undefined. Set after errors only)
	 </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>$array["errlin"]</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;	  error line number of previous error (0-based; or -1 if
	  undefined. Set after errors only)
	 </TD
></TR
></TBODY
></TABLE
></DIV
>
    </P
><P
>&#13;     In the following example, a syntax error (E SEW42AE ILLEGAL
     CHARACTER) is displayed by including the offending SQL statement
     and pointing to the error location:
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN69100"
></A
><P
><B
>Ejemplo 1. Displaying SESAM error messages with error position</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?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 "&#60;TABLE BORDER&#62;\n";
    echo "&#60;TR&#62;&#60;TH COLSPAN=".$colspan."&#62;&#60;FONT COLOR=red&#62;ERROR:&#60;/FONT&#62; ".
	  	htmlspecialchars($err["errmsg"])."&#60;/TH&#62;&#60;/TR&#62;\n";
    if ($err["errcol"] &#62;= 0) {
        echo "&#60;TR&#62;&#60;TD COLSPAN=".$colspan."&#62;&#60;PRE&#62;\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 &#60; $err["errcol"]; ++$col)
                    echo (substr($line, $col, 1) == "\t") ? "\t" : ".";
                echo "&#60;FONT COLOR=RED&#62;&#60;BLINK&#62;\\&#60;/BLINK&#62;&#60;/FONT&#62;\n";
                print "&#60;FONT COLOR=\"#880000\"&#62;".htmlspecialchars($line)."&#60;/FONT&#62;";
                for ($col=0; $col &#60; $err["errcol"]; ++$col)
                    echo (substr ($line, $col, 1) == "\t") ? "\t" : ".";
                echo "&#60;FONT COLOR=RED&#62;&#60;BLINK&#62;/&#60;/BLINK&#62;&#60;/FONT&#62;\n";
            }
        }
        echo "&#60;/PRE&#62;&#60;/TD&#62;&#60;/TR&#62;\n";
    }
    echo "&#60;TR&#62;\n";
    echo " &#60;TD&#62;sqlstate=" . $err["sqlstate"] . "&#60;/TD&#62;\n";
    if ($err["errlin"] != -1)
        echo " &#60;TD&#62;errlin=" . $err["errlin"] . "&#60;/TD&#62;\n";
    if ($err["errcol"] != -1)
        echo " &#60;TD&#62;errcol=" . $err["errcol"] . "&#60;/TD&#62;\n";
    if ($err["rowcount"] != 0)
         echo " &#60;TD&#62;rowcount=" . $err["rowcount"] . "&#60;/TD&#62;\n";
    echo "&#60;/TR&#62;\n";
    echo "&#60;/TABLE&#62;\n";
}

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);
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     See also: <A
HREF="function.sesam-errormsg.html"
><B
CLASS="function"
>sesam_errormsg()</B
></A
> for simple access
     to the error string only
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.sesam-connect.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.sesam-disconnect.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>sesam_connect</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.sesam.html"
ACCESSKEY="U"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>sesam_disconnect</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>