Location: PHPKode > scripts > mysql_db class > mysql_db-class/README.txt
===== BASIC DOCUMENTATION FOR mysql_db DATABASE ACCESS CLASS =====
===== Release 1.1 - 06/08/2002
===== Released under GNU GPL Library (see LICENSE for details)

0.- INTRODUCTION

  This group of classes was developed to provide a full mysql_management package
  intended for a multiple result environment.  Base architecture for the group
  was ADODB classes from Microsoft ActiveX ADODB ODBC data interface.

  This classes are subject to continuous code evolution and will be kept up to
  date on php classes repository (http://phpclasses.upperdesign.com/mysql_db).

1.- INTERFACE

  Data interface is formed from three base objects:

  - mysql_conn : The connection object.  This object is used for database
    connection managing, logging operations and data connection initialization
    and destruction.

    Public interface:
    		
		mysql_conn($servername,$username,$password,$databasename,$debuglevel=0)
      -> constructor
    init()
      -> Initialize logging operations and opens the data connection
    destroy()
      -> Closses connection and ends logging operations

		NOTE debug_level is one of the following constants:
      · LOG_NONE or 0 : No logging for the database operations
      · LOG_ECHO or 1 : Echoes logging directly to HTML code
      · LOG_HIDE or 2 : Echoes silently (<!-- -->) to HTML code
      · LOG_FILE or 3 : Echoes to a file
      
  - mysql_recordset : The result handler object. This object is used to retrieve
    data from a database. Requires an active mysql_conn object to work and is
    intended for multiple result handling.

    Public interface:

    mysql_recordset($connobjname,$sqlcommand)
      -> Constructor requires the variable name for the connection object
    int query()
      -> Performs the execution of $sqlcommand and returns number of records in
      the result but result index IS NOT INITIALIZED (see movenext())
    int movenext()
      -> Advances result index (first execution points to first record) and
      returns true OR false for EOF (end of result, true no more records)
    field($fieldname)
      -> echo value of field $campo on screen (movenext() MUST HAVE BEEN
      SUCCESFULLY CALLED AT LEAST ONCE TO INITIALIZE ROW INFORMATION)
    var value($fieldname)
      -> returns the value for field $campo (movenext() MUST HAVE BEEN
      SUCCESFULLY CALLED AT LEAST ONCE TO INITIALIZE ROW INFORMATION)
    clear_recordset()
      -> clears $sqlcommand and frees result memory
    move_to($rnumber)
      -> moves the result pointer to row $rnumber, it is 0 aware so move_to(0)
      places result pointer on first row
    movefirst()
      -> executes move_to(0) so points first row
    movelast()
      -> executes move_to($this->recordcount-1) so points last row

  - mysql_command : The SQL commands interface.  This object is intended for database SQL operations that
    do not return any data (DELETE, UPDATE, etc) and requires an active mysql_conn object

    Public interface:
		
    mysql_command($connobjname,$sqlcommand)
      -> Constructor, requires variable name for the mysql_conn object		 		
    int execute()
      -> Performs the execution of $sqlcommand and returns affected rows count

  Additional TOOLS interface:
  
  - mysql_tools: The Tools interface allows for a basic mysql server information
    and table structures for the current dabase Rrequires an active connection
    object (mysql_connection).

    Public interface:
    
    mysql_tools($connobjname)
      -> Constructor, requires variable name for the mysql_conn object
    list_tables()
      -> Generates a very basic HTML table with the list for all the tables in
      the currently active database for the connection object
    describe_table($tblname)
      -> Generates a very basic HTML table with the structure for the table 
      $tblname IF IT EXISTS, or just says the table does not exist.
    server()
      -> Echoes basic information from the mysql server you are connected to
    analyze()
      -> Generates a very basic HTML formated block with the combined results
      for all the above methods (server, list_tables & describe_table for each
      table in the database)
      
2.- Future releases and WIP

  This class is provided as is, and is subject to changes.  New releases will be
  posted at http://www.phpclasses.org/mysql_db repository.
  
  Any suggestions and new feature requests are wellcome

3.- Contact information

  Carlos Falo Hervás
  hide@address.com
  http://www.bisinteractive.net

  C/Manila 54-56 Esc. A Ent. 4ª
  08034 Barcelona Spain

  Phone: +34 9 3 2063652
  Fax:	 +34 9 3 2063689
Return current item: mysql_db class