Home / ADOdb4PHP 2009
Name Modified Size InfoDownloads / Week
Parent folder
ADOdb4PHP-2009r7.zip 2012-10-19 22.6 kB
ADOdb4PHP-2009r6.1.zip 2011-11-11 22.8 kB
ADOdb4PHP-2009r5.zip 2011-10-20 22.7 kB
ADOdb4PHP-2009r4.zip 2011-09-10 22.3 kB
ADOdb4PHP-2009r3.zip 2010-07-07 22.0 kB
ADOdb4PHP-2009r2.zip 2010-06-04 22.0 kB
ADOdb4PHP-2009.zip 2010-05-30 21.2 kB
Totals: 7 Items   155.7 kB 0
----------------------------------------------------------------
 ADOdb4PHP :  ADO for PHP
 Copyright (c) 2009 - 2016, Raul IONESCU <ionescu.raul@gmail.com>, 
 Bucharest, ROMANIA

 Licensed under The MIT License
 Redistributions of files must retain the above copyright notice.

 (requires PHP versions 5.1 or greater)
---------------------------------------------------------------- 
 
 
 
 
 
 
 
 

---------------------------------------------------------------- 
 I. LICENSE
----------------------------------------------------------------
 ADOdb4PHP is licensed under the terms of the MIT License 
 (http://www.opensource.org/licenses/mit-license.php)
 
 The MIT License

 Copyright (c) 2009 - 2011, Raul IONESCU <ionescu.raul@gmail.com>, 
 Bucharest, ROMANIA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.



----------------------------------------------------------------
 II. DESCRIPTION
----------------------------------------------------------------
 - ADOdb4PHP is a database abstraction layer with pagination support, for PHP 
running on Windows machines, witch can be easily extended.
 - ADOdb4PHP currently supports MSSQL, MySQL, FoxPro and Excel.
 - It is written in OOP PHP 5.1 style, providing exceptions support.
 
 
 
----------------------------------------------------------------
 III. REQUIREMENTS
----------------------------------------------------------------
  - PHP version greater than 5.1
  - 2007 Office System Driver: Data Connectivity Components (for Excel support).
  - Visual FoxPro ODBC Driver (for FoxPro support).
  - SQL Server ODBC Driver (for MSSQL support).
  - MySQL Connector/ODBC 5.1 (for MySQL support).
  - Teradata ODBC Driver (for Teradata support).
  
  
 
----------------------------------------------------------------
 IV. PROPERTIES AND METHODS
----------------------------------------------------------------
 Object: ADOdb4PHP_MSSQL
		 ADOdb4PHP_Teradata
         ADOdb4PHP_MySQL
         ADOdb4PHP_FoxPro
         ADOdb4PHP_Excel
----------------------------------------------------------------
 Properties (case insensitive):
        IsConnected             - boolean property for getting/setting connection status.
        Database                - string property for getting/setting current database name.
        Username                - string property for getting/setting user name.
        Password                - string property for getting/setting password.
        Server                  - string property for getting/setting server.
        Port                    - integer property for getting/setting port.
        ConnectionTimeout       - integer property for getting/setting connection timeout.
        CommandTimeout          - integer property for getting/setting query timeout.
        CursorLocation          - string property for getting/setting cursor.
        Tables                  - returns an aray with all table names found in database.
        Columns                 - returns the columns of tables (including views) defined in the database.                           
        CSV                     - returns contents of current database into CSV format; this is useful
                                  for file-based databases (Excel, FoxPro).
        Version                 - returns ADOdb4PHP version.    

 Methods (case sensitive):
        query($sqlQuery)        - returns an ADOdb4PHPQuery object.
        saveTableAsCSV($outputCsvFile, $overwriteExistingCSVFile = true, $tableName = NULL) - save table as CSV file.
        saveDatabaseAsCSV($outputCsvFile, $overwriteExistingCSVFile = true) - save database as CSV file.

        
Object: ADOdb4PHPQuery
----------------------------------------------------------------
Properties (case insensitive):
        EOF                     - boolean property returns True if the current record position is after the last record in the Recordset.
        BOF                     - boolean property returns True if the current record position is before the first record in the Recordset.
        Rows                    - returns number of records from Recordset.
        Columns                 - returns number of columns from Recordset.
        AffectedRows            - returns number of affected rows by the SQL query.
        LastInsertedID          - retuns last inserted ID.
        Recordsets              - returns number of returned recordsets;
        PageSize                - returns/sets page size for pagination.
        Page                    - returns/sets active page number.
        Pages                   - returns total number of pages.

 Methods (case sensitive):        
        prepareParameter($name=NULL, $value=NULL, $type=NULL, $direction=NULL, $size=NULL, $precision=NULL, $numericScale=NULL) - see "prepare" method for "ADOdb4PHPParameter" object.
        execute(ADOdb4PHPParameter &$p = NULL) - execute SQL query.
        fetchField($field)      - returns $field's value from current recordset's row. 
        fetchRecord()           - returns entire row.
        nextRecord()            - move to the next row.
        firstRecord()           - move to the first row.
        lastRecord()            - move to the last row.
        nextRecordset()         - switch to the next recordset.
        previousRecordset()     - switch to the previous recordset.
        firstRecordset()        - switch to the first recordset.
        lastRecordset()         - switch to the last recordset.
        
        
Object: ADOdb4PHPParameter
----------------------------------------------------------------
 Properties (case insensitive):
        Parameters                     - returns an array of all prepared parameters through "prepare" method.

 Methods (case sensitive): 
        prepare($name=NULL, $value=NULL, $type=NULL, $direction=NULL, $size=NULL, $precision=NULL, $numericScale=NULL)
                $name - parameter name.
                $value - parameter value.
                $type - see "/* Applies To: Append Method | CreateParameter Method | CreateRecordset Method (RDS) | Type Property */" section from "adodb4php_settings.php".
                $direction - see "/* Applies To: CreateParameter Method | Direction Property */" section from "adodb4php_settings.php".
                $size - sets the maximum size in bytes or characters of a value.
                $precision - sets the maximum number of digits allowed when representing numeric values.
                $numericScale - sets the number of digits stored to the right side of the decimal point for a numeric value.

        
---------------------------------------------------------------- 
 V. CODE SAMPLES
----------------------------------------------------------------

 a) Converting an Excel file into CSV
       <?php
       require_once('ADOdb4PHP/adodb4php_autoload.php');
       try { $csv = (string)new ADOdb4PHP_Excel($xlsFile); } catch(Exception $e) { var_dump($e); }
       ?>
       
 b) Simple MSSQL query
        <?php
        require_once('adodb4php_autoload.php');
        try {
                $sqlQuery = 'SELECT TOP 10 * FROM [tableName]';
                $server = '127.0.0.1';
                $database = 'database';
                $user = 'user';
                $password = 'password';

                $sql = new ADOdb4PHP_MSSQL($database, $user, $password, $server);
                $q = $sql->query($sqlQuery);
                $q->execute();

                while(!$q->EOF)
                        { 
                         print $q->fetchField(0).PHP_EOL;
                         $q->nextRecord();
                        } 
           }
        catch(Exception $e) { var_dump($e); }
        ?>

 c) MSSQL query with prepared parameters
        <?php
        require_once('adodb4php_autoload.php');
        try {
                $sqlQuery = 'SELECT TOP 10 * FROM [tableName] WHERE ([Column1] = ?) AND ([Column2] = ?)';
                
                $column1 = 'value';
                $column2 = 12.12;
                
                $server = '127.0.0.1';
                $database = 'database';
                $user = 'user';
                $password = 'password';
                

                $sql = new ADOdb4PHP_MSSQL($database, $user, $password, $server);
                $q = $sql->query($sqlQuery);
		$q->prepareParameter('@Column1', $column1, adVarChar, adParamInput, 12);
		$q->prepareParameter('@Column2', $column2, adDecimal, adParamInput, 6, 6, 0);
                $q->execute();

                while(!$q->EOF)
                        { 
                         print $q->fetchField(0).PHP_EOL;
                         $q->nextRecord();
                        } 
           }
        catch(Exception $e) { var_dump($e); }
        ?>
 
 d) Connect to MSSQL server with integrated windows authentication (use NULL value for $user)
         <?php
        require_once('adodb4php_autoload.php');
        try {
                $sqlQuery = 'SELECT TOP 10 * FROM [tableName] WHERE ([Column1] = ?) AND ([Column2] = ?)';
                
                $column1 = 'value';
                $column2 = 12.12;
                
                $server = '127.0.0.1';
                $database = 'database';
                $user = NULL;
                $password = NULL;
                

                $sql = new ADOdb4PHP_MSSQL($database, $user, $password, $server);
                $q = $sql->query($sqlQuery);
		$q->prepareParameter('@Column1', $column1, adVarChar, adParamInput, 12);
		$q->prepareParameter('@Column2', $column2, adDecimal, adParamInput, 6, 6, 0);
                $q->execute();

                while(!$q->EOF)
                        { 
                         print $q->fetchField(0).PHP_EOL;
                         $q->nextRecord();
                        } 
           }
        catch(Exception $e) { var_dump($e); }
        ?>
Source: README.TXT, updated 2016-02-01