Location: PHPKode > scripts > ADODB_SQL > adodbsql/adodb-sql.html
<HTML>
	<HEAD>
		<TITLE>class.adodb_sql.php - v1.0.0</TITLE>
	</HEAD>
<BODY>
<!-- INDEX BEGIN -->
<UL>
	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#METHODS">METHODS</A>
	<UL>
		<LI><A HREF="#newconstructor">DB_Sql( [$query] )</A>
		<LI><A HREF="#query">query( $query_string )</A>
		<LI><A HREF="#next_record">next_record( )</A>
		<LI><A HREF="#num_rows">num_rows( ), nf( )</A>
		<LI><A HREF="#affected_rows">affected_rows( )</A>
		<LI><A HREF="#num_fields">num_fields( )</A>
		<LI><A HREF="#np">np( )</A>
		<LI><A HREF="#f">f( $field )</A>
		<LI><A HREF="#p">p( $field )</A>
		<LI><A HREF="#haltmsg">haltmsg( $msg )</A>
		<LI><A HREF="#seek">seek( $pos )</A>
		<LI><A HREF="#link_id">link_id( )</A>
		<LI><A HREF="#query_id">query_id( )</A>
		<LI><A HREF="#metadata">metadata( [$table] [,$full] )</A>
		<LI><A HREF="#table_names">table_names( )</A>
	</UL>
	<LI><A HREF="#INTERNAL_METHODS">INTERNAL METHODS</A>
	<UL>
		<LI><A HREF="#driver">driver( $dbengine )</A>
		<LI><A HREF="#connect">connect( )</A>
		<LI><A HREF="#halt">halt( $msg )</A>
		<LI><A HREF="#free">free( )</A>
	</UL>
	<LI><A HREF="#DOCUMENTATION">DOCUMENTATION</A>
	<LI><A HREF="#VERSION">VERSION</A>
	<LI><A HREF="#AUTHOR">AUTHOR</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
class.adodb_sql.php - v1.0.0 - PHPLIB's DB_Sql format using ADODB library
<P>


<HR>
<P>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
<PRE>
    include( &quot;./support/adodb.inc.php&quot; ); /* ADODB library */
    include( &quot;./support/class.adodb_sql.php&quot; );  /* ADODB_SQL library: THIS IS A CLASS THAT YOUR ARE READING */

    class MyDBSQL extends DB_Sql {
        var $classname = &quot;MyDBSQL&quot;;

        function MyDBSQL ( ) {
            $this-&gt;Host = &quot;localhost&quot;;
            $this-&gt;Database = &quot;test&quot;;
            $this-&gt;User = &quot;&quot;;
            $this-&gt;Password = &quot;&quot;;
            parent::driver( &quot;mysql&quot; );
        }
    }
</PRE>
<P>

<HR>
<P>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>class.adodb_sql.php</CODE> permits migrating your code using DB_Sql format (PHPLIB) to an another DB engine like ADODB.
<P>

<HR>
<P>
<H1><A NAME="METHODS">METHODS</A></H1>
<P>

<HR>
<P>
<H2><A NAME="newconstructor">DB_Sql( [$query] )</A></H2>
<P>
Constructor. When creating an instance, you may optionally supply a query string
<P>

<HR>
<P>
<H2><A NAME="query">query( $query_string )</A></H2>
<P>
<I>query_string</I> is a SQL statement that is sent to the database. After sending the statement, <U>Error</U> and <U>Errno</U> are updated.
<BR>If the query is syntactically incorrect (no valid result id is being produced), <CODE>halt()</CODE> is called with a meaningful error message. 
<P>

<HR>
<P>
<H2><A NAME="next_record">next_record( )</A></H2>
<P>
The method <CODE>next_record()</CODE> advances the cursor through the current query result and updates the <U>Record</U>, <U>Row</U>, <U>Errno</U> and <U>Error</U> instance variables
<P>

<HR>
<P>
<H2><A NAME="num_rows">num_rows( ), nf( )</A></H2>
<P>
The method <CODE>num_rows()</CODE> returns the number of rows returned by the current SELECT query.
<P>

<HR>
<P>
<H2><A NAME="affected_rows">affected_rows( )</A></H2>
<P>
The method <CODE>affected_rows()</CODE> returns the number of rows affected by the current INSERT, UPDATE or DELETE query. 
<P>

<HR>
<P>
<H2><A NAME="num_fields">num_fields( )</A></H2>
<P>
The method <CODE>num_fields()</CODE> returns the number of columns returned by the current query.
<P>

<HR>
<P>
<H2><A NAME="np">np( )</A></H2>
<P>
The method <CODE>np()</CODE> prints the number of rows returned by the current query.
<P>

<HR>
<P>
<H2><A NAME="f">f( $field )</A></H2>
<P>
Returns the variable <U>Record</U>[$field].
<P>

<HR>
<P>
<H2><A NAME="p">p( $field )</A></H2>
<P>
Prints the variable <U>Record</U>[$field].
<P>

<HR>
<P>
<H2><A NAME="haltmsg">haltmsg( $msg )</A></H2>
<P>
This function is called by <CODE>halt()</CODE> and will actually print the database error message. 
<P>

<HR>
<P>
<H2><A NAME="seek">seek( [$pos] )</A></H2>
<P>
The method <CODE>seek()</CODE> positions the <U>Row</U> pointer within the result set. Useful for reading the same result set twice or otherwise jumping around within the result. $pos is not checked in any way for validity. 
<P>

<HR>
<P>
<H2><A NAME="link_id">link_id( )</A></H2>
<P>
This function will return the current link ID.
<P>

<HR>
<P>
<H2><A NAME="query_id">query_id( )</A></H2>
<P>
Returns the current result ID, as returned by the query() executed internally by the database class.
<P>

<HR>
<P>
<H2><A NAME="metadata">metadata( [$table] [,$full] )</A></H2>
<P>
<I>This method is under construction.</I> Not implemented yet.
<P>

<HR>
<P>
<H2><A NAME="table_names">table_names( )</A></H2>
<P>
Returns an array with table name and tablespace name.
<P>

<HR>
<P>
<H1><A NAME="INTERNAL_METHODS">INTERNAL METHODS</A></H1>
<P>

<HR>
<P>
<H2><A NAME="driver">driver( $dbengine )</A></H2>
<P>
This function selects the database to connect.
<P>
<TABLE BORDER="1">
<TR>
	<TH>Databases</TH>
	<TH>ADODB 1.2</TH>
	<TH>PHPLIB 7.2d</TH>
	<TH>class.adodb_sql.php 1.0.0</TH>
</TR>
<TR><TD>Microsoft Access</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">N</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>Generic ADO</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">N</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>Generic ODBC</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>Visual FoxPro</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">N</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>Interbase</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">N</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>Microsoft SQL Server</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>MySQL</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">T</TD></TR>
<TR><TD>Oracle 8</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>PostgreSQL</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>Sybase</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>DB2</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">N</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>mSQL</TD><TD ALIGN="center">N</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">-</TD></TR>
<TR><TD>FrontBase</TD><TD ALIGN="center">Y</TD><TD ALIGN="center">N</TD><TD ALIGN="center">-</TD></TR>
</TABLE>
<BR><U>Note</U>: (Y) supported, (N) not implemented, (T) tested, and (-) not tested.
<P>The parameter $dbengine is passed to <CODE>NewADOConnection()</CODE> function.
<P>

<HR>
<P>
<H2><A NAME="connect">connect( )</A></H2>
<P>
Used internally to generate a Link_ID, if necessary.
<P>

<HR>
<P>
<H2><A NAME="halt">halt( $msg )</A></H2>
<P>
Used by <CODE>query()</CODE> if the initial database connection cannot be made or the target database does not exist.<BR>
Depending on the setting of <U>Halt_On_Error</U>, this method will call <CODE>haltmsg()</CODE> to report the error. 
<P>

<HR>
<P>
<H2><A NAME="free">free( )</A></H2>
<P>
Used internally by <CODE>next_record()</CODE> to free the result set.
<P>


<HR>
<P>
<H1><A NAME="DOCUMENTATION">DOCUMENTATION</A></H1>
<P>
You're reading it.
<P>

<HR>
<P>
<H1><A NAME="VERSION">VERSION</A></H1>
<P>
<CODE>class.adodb_sql.php</CODE> 1.0.0 - Aug 11, 2002 &copy RFK Solutions &lt;<A HREF="mailto:hide@address.com">hide@address.com</A>&gt;
<P>

<HR>
<P>
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
CopyRight (c) 2001 RFK Solutions, <A HREF="mailto:hide@address.com">hide@address.com</A>. All Rights Reserved.
<P>The latest version of this class should be available from the following locations: 
<BR><A HREF="http://rfkmap.sourceforge.net">http://rfkmap.sourceforge.net</A>

<P>This program is free software; you can redistribute it and/or modify it under the GNU General Artistic License, with the following stipulations; 
<P>Changes or modifications must retain these Copyright statements. Changes or modifications <B>must</B> be submitted to the author.
<P>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Artistic License for more details. This software is distributed AS-IS. 
<P>Address Bug Reports or Comments to RFK Solutions, <A HREF="mailto:hide@address.com">hide@address.com</A>. 

<P><B>ADODB Library for PHP4</B>
<BR>V1.20 25 June 2001 (c) 2000-2001 John Lim (hide@address.com)
<BR><A HREF="http://php.weblogs.com/adodb">http://php.weblogs.com/adodb</A>
<P><B>ASPDB_SQL Library for ASP</B>
<BR><A HREF="http://rfkmap.sourceforge.net/download/aspdb-sql.html">http://rfkmap.sourceforge.net/download/aspdb-sql.html</A>
<P><B>PHP Base Library</B>
<BR>Release phplib_7_2 (c) 2000-2001 Boris Erdmann (hide@address.com), Kristian K&ouml;hntopp (hide@address.com) and Sascha Schumann (hide@address.com)
<BR><A HREF="http://phplib.netuse.de/">http://phplib.netuse.de/</A>
<P>

</DL>
</BODY>
</HTML>
Return current item: ADODB_SQL