Giter Club home page Giter Club logo

adodb's Introduction

ADOdb Library for PHP

Join chat on Gitter SourceForge Downloads Shield Packagist Downloads Shield

(c) 2000-2013 John Lim ([email protected])
(c) 2014 Damien Regad, Mark Newnham and the ADOdb community

The ADOdb Library is dual-licensed, released under both the BSD 3-Clause and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, any later version. This means you can use it in proprietary products; see License for details.

Home page: https://adodb.org/

Introduction

PHP's database access functions are not standardized. This creates a need for a database class library to hide the differences between the different databases (encapsulate the differences) so we can easily switch databases.

The library currently supports MySQL, Firebird & Interbase, PostgreSQL, SQLite3, Oracle, Microsoft SQL Server, Foxpro ODBC, Access ODBC, Informix, DB2, Sybase, Sybase SQL Anywhere, generic ODBC and Microsoft's ADO.

We hope more people will contribute drivers to support other databases.

Installation

Unpack all the files into a directory accessible by your web server.

To test, try modifying some of the tutorial examples. Make sure you customize the connection settings correctly.

You can debug using:

<?php
include('adodb/adodb.inc.php');

$db = adoNewConnection($driver); # eg. 'mysqli' or 'oci8'
$db->debug = true;
$db->connect($server, $user, $password, $database);
$rs = $db->execute('select * from some_small_table');
print "<pre>";
print_r($rs->getRows());
print "</pre>";

Documentation and Examples

Refer to the ADOdb website for library documentation and examples. The documentation can also be downloaded for offline viewing.

There is also a tutorial that contrasts ADOdb code with PHP native MySQL code.

Files

  • adodb.inc.php is the library's main file. You only need to include this file.
  • adodb-*.inc.php are the database specific driver code.
  • adodb-session.php is the PHP4 session handling code.
  • test.php contains a list of test commands to exercise the class library.
  • testdatabases.inc.php contains the list of databases to apply the tests on.
  • Benchmark.php is a simple benchmark to test the throughput of a SELECT statement for databases described in testdatabases.inc.php. The benchmark tables are created in test.php.

Support

To discuss with the ADOdb development team and users, connect to our Gitter chatroom using your Github credentials.

Please report bugs, issues and feature requests on Github:

https://github.com/ADOdb/ADOdb/issues

You may also find legacy issues in

However, please note that they are not actively monitored and should only be used as reference.

adodb's People

Contributors

andreaskienast avatar dregad avatar dulaman avatar edgardmessias avatar evardsson avatar gohanman avatar greengiant avatar gu-colin-morris avatar haaseit avatar heyjohnlim avatar ioigoume avatar jane-lyndon avatar jmruiz84 avatar joebordes avatar jrfnl avatar laurent-n avatar marcelto avatar marinaglancy avatar merijnvdk avatar mezaof avatar mnewnham avatar muzcb avatar nathangibbs3 avatar nicoder avatar nirgal avatar obmsch avatar peterdd avatar reimuhakurei avatar secmyth avatar wixsl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adodb's Issues

connection to mssql with Port fails

Hi

Yesterday i tried to connect to an mssql (Microsoft Server 2005) with the following dsn string.
mssql://user:[email protected]:63341/database

I couldn't connect to the database because in the drivers/adodb-mssql.inc.php there is a function called

function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$newconnect=false)
{
    if (!function_exists('mssql_pconnect')) return null;
    $this->_connectionID = mssql_connect($argHostname,$argUsername,$argPassword,$newconnect);
    if ($this->_connectionID === false) return false;
    if ($argDatabasename) return $this->SelectDB($argDatabasename);
    return true;
}

The parameter $argHostname holds only the hostname (10.10.10.19) and ignore the port.
So it's not possible to connect to an mssql server with a port.

Can't connect with Sybase on non-standard port

Issue reported by @phadadi via e-mail


Our fix was the following (extending driver class instead modifying the original code):

/**
 * Custom Sybase connection
 *
 * @return \ADODB_sybase_custom
 */
function customSybaseConnection()
{
        $obj = new ADODB_sybase_custom();

        $tmp = parse_url($GLOBALS['SYBASE_DSN']);

        if (is_array($tmp) && count($tmp) && isset($tmp['port']) && (int)$tmp['port']) {
                $obj->port = (int)$tmp['port'];
        }
        return $obj;
}

require_once ADODB_DIR."/drivers/adodb-sybase.inc.php";

/**
 * Custom Sybase driver
 *
 */
class ADODB_sybase_custom extends ADODB_sybase
{
        public $port;

        function _connect($argHostname, $argUsername, $argPassword, $argDatabasename)
        {
                if ($this->port) {
                        $argHostname .= ':' . $this->port;
                }
                return parent::_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
        }

        function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename)
        {
                if ($this->port) {
                        $argHostname .= ':' . $this->port;
                }
                return parent::_pconnect($argHostname, $argUsername, $argPassword, $argDatabasename);
        }
}

Of course port identification must be placed in DSN section of ADONewConnection function.


Another way to fix

phadadi/ADOdb@3a77790

Call to a member function Execute() on a non-object when trying to execute an SQL statement in PHP

Hello,

I am getting the below error when I try to execute an SQL statement in PHP. Statement works without any issues in phpMyAdmin, only problem is in PHP with ADOdb connenction:

Error:
Call to a member function Execute() on a non-object

PHP Code:

$sql_query = "SELECT tbl_news_keywords.id, tbl_news_keywords.model_id
FROM tbl_news_keywords LEFT OUTER JOIN
tbl_vehicles
ON (tbl_news_keywords.model_id = tbl_vehicles.model)
WHERE tbl_news_keywords.type = '3'
GROUP BY tbl_news_keywords.keyword";

$rs_query = $db -> Prepare($sql_query);
$rs_query -> Execute();

Here is my DB connection statements:

if (ADODB_PHPVER >= 0x4300) $this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword, $this->forceNewConnect,$this->clientFlags);

$db = ADONewConnection('mysql'); $db->Connect(DBHOST,DBUSER,DBPASS,DBNAME) or die();

Any ideas of where the error might be coming from?

class ADODB_mssqlnative uses PHP error_log() function instead of ADOConnection::outp()

The class ADODB_mssqlnative uses the PHP error_log() function to write extensive debugging information (up to 3000 lines of messages and backtraces per request!) into the PHP error-log, when the debugging is activated.
I seems like someone has forgotten to replace error_log() by ADOConnection::outp(), as it's done in the other driver classes.

Greetings
Bill

LDAP driver - dn attribute missing issue

In an older version of the adodb library, there was 2 lines of code in the _fetch function (drivers/adodb-ldap.inc.php) that would "add" in the dn attribute.

$this->fields[] = 'dn';
$this->fields['dn'] = array("count" => 1,ldap_get_dn( $this->connection->_connectionID, $this->_entryID ));

In the newer versions of the adodb library, this code is missing, therefore the dn attribute is not apart of the array. I think this code should be added back in the main build unless there was some other reason why it was removed in the first place.

Also, as part of my debugging on this issue, I noticed that the php ldap function of ldap_get_entries will automatically bring the the dn attribute, but the function ldap_first_entry+ldap_get_attributes (as used by adodb), does not.

AutoExecute does not respect emtpy ResultSet in case of Update

Hi,
please be lenient with my English. Thank you.

In lines 1907ff you check for a "where" and do a query with the where.
If that where results in a no find the following update do break.
I found this with pdo sqlite while trying to update something which wasnt there any more.

I changed the lines 1907 ff ->

    $sql = 'SELECT * FROM '.$table;  

    if (($where===FALSE) && ($mode == 'UPDATE' || $mode == 2 /* DB_AUTOQUERY_UPDATE */)) {
        $this->outp_throw('AutoExecute: Illegal mode=UPDATE with empty WHERE clause','AutoExecute');
        return $false;
    }

    $rs = $this->SelectLimit($sql,1);
    if (!$rs) return $false; // table does not exist
    $rs->tableName = $table;
    if ($where!==FALSE) $sql .= ' WHERE '.$where;
    $rs->sql = $sql;

So you do an update with no hits.

yours
Sven

adodb-session2.php open method fails when it shouldn't

https://github.com/ADOdb/ADOdb/blob/master/session/adodb-session2.php#L586

variable $ok is only set if the connection id is empty - this caused problems for us in the last version (5.18) which we worked around in this way:

https://github.com/evardsson/adodb-composer/blob/f7c69b0a6237e8a6209728c8a73ad23eeab41379/session/adodb-session2.php#L584

Essentially, if there is a connection id after the call to $conn = ADONewConnection($driver); on line 566 it doesn't matter, because $ok will not be set and the method will say that the connection failed, even though it hasn't.

SQL Server non-English collation

odbc_mssql driver works great with default Latin collation for MS SQL. However, if for foreign, non-English collation such as Hungarian_CI_AS, all the characters are not stored nor displayed correctly. Nothing but Gibberish. Any fix for this?

adodb-active-record.inc.php strict standards

I looked for another issue about this and didn't find one, so thought I'd report:

Running PHP 5.5 (PHP 5.5.9-1ubuntu4 to be exact), seeing the strict standards message "Only variables should be assigned by reference" repeatedly for adodb-active-record.inc.php

ADODB_Active_Record -> Reload() - Strict standards

Reload() function in ADODB_Active_Record (adodb-active-record.inc.php) throws
Strict Standards: Only variables should be assigned by reference in ... adodb-active-record.inc.php on line 561.
Issue is present also in current master branch on github.

Fix would be change from :

    function Reload()
    {
        $db =& $this->DB(); if (!$db) return false;
        $table =& $this->TableInfo();
        $where = $this->GenWhere($db, $table);
        return($this->Load($where));
    }

to:

    function Reload()
    {
        $db = $this->DB(); if (!$db) return false;
        $table = $this->TableInfo();
        $where = $this->GenWhere($db, $table);
        return($this->Load($where));
    }

We use this fix as local modification for years.

Best regards,
Bostjan

SQLite3 FetchField

On function function FetchField($fieldOffset = -1) of file adodb-sqlite3.inc.php the correct syntax to get the column name should be:

$fld->name = $this->_queryID->columnName($fieldOffset);

instead of:

$fld->name->columnName($this->_queryID, $fieldOffset);

mssqlnative / insert_ID() fails if server returns more than 1 row

okay, msssqlnative (5.19) driver's insert_id() mechanism has some issues if server returns
more than requested SELECT SCOPE_IDENTITY(). In my case, insert trigger outputs rows affected info.

Current code expects to get only one result -> error

// retrieve the last insert ID (where applicable)
sqlsrv_next_result($rez);
sqlsrv_fetch($rez);
$this->lastInsertID = sqlsrv_get_field($rez, 0);

Master broken

Just to let you know,

latest commit on master : 016dea3 is broken.

PHP Parse error: syntax error, unexpected '}' in /home/travis/build/vendor/adodb/adodb-php/adodb.inc.php on line 4785

ADO Driver Php 5.x Connection

Hi,

I am working on a data bridge project that will transfer data between SalesLogix (OLEDB), Sqlite 3 and Pick/D3. To complete the project, I am looking at ADODB. The vendor that we are dealing with wants me to use Visual Studio 2013 and a .NET language. Most of the business intelligence is already in Php.

Here is my test Php ADODB CLI program:

<?php
// ADO/OLEDB test using the Saleslogix provider.
require 'adodb/adodb-exceptions.inc.php';
require 'adodb/adodb.inc.php';

$crlf = "\r\n";

// connection string
$cs = 'Provider=SLXOLEDB.1;Password=**;Persist Security Info=True;';
$cs .= 'User ID=admin;Initial Catalog=PRIDE;Data Source=CRMAP;';
$cs .= "Extended Properties='PORT=1706;LOG=ON;CASEINSENSITIVEFIND=ON;";
$cs .= "AUTOINCBATCHSIZE=1;SVRCERT=;'";

try
   {
   $db = ADONewConnection('ado');
   $db->debug = true;
   }
catch(exception $e)
   {
   print "ADONewConnection failed$crlf";
   var_dump($e);
   adodb_backtrace($e->gettrace());
   }

try
   {
   $db->Connect($cs);
   }
catch(exception $e)
   {
   print "connect failed$crlf";
   var_dump($e);
   adodb_backtrace($e->gettrace());
   }
?>

I am running this on a Windows 7 PC with Php 5.3.10 installed and the most recent release of ADODB. I am trying to connect to the SalesLogix application server. SalesLogix has an OLE provider and I am attempting to use the ADO generic driver on top of that. I should also say that VB .NET is able to connect to the SalesLogix application server using the same connection string as above. When I run my Php program, I get:

Host=Provider=SLXOLEDB.1;Password=**;Persist Security Info=True;User ID=admin;Initial Catalog=PRIDE;Data Source=CRMAP;Extended Properties='PORT=1706;LOG=ON;CASEINSENSITIVEFIND=ON;AUTOINCBATCHSIZE=1;SVRCERT=;'
 version=6.1
cs=Provider=SLXOLEDB.1;Password=**;Persist Security Info=True;User ID=admin;Initial Catalog=PRIDE;Data Source=CRMAP;Extended Properties='PORT=1706;LOG=ON;CASEINSENSITIVEFIND=ON;AUTOINCBATCHSIZE=1;SVRCERT=;'
<pre>Provider=SLXOLEDB.1;Password=password;Persist Security Info=True;User ID=admin;Initial Catalog=PRIDE;Data Source=CRMAP;Extended Properties='PORT=1706;LOG=ON;CASEINSENSITIVEFIND=ON;AUTOINCBATCHSIZE=1;SVRCERT=;'
exception 'com_exception' with message 'Source: Microsoft OLE DB Service Components
Description: Format of the initialization string does not conform to the OLE DB specification.' in C:\wamp\www\CRM\Php\adodb\drivers\adodb-ado5.inc.php:117
Stack trace:
#0 C:\wamp\www\CRM\Php\adodb\drivers\adodb-ado5.inc.php(117): com->Open('Provider=SLXOLE...')
#1 C:\wamp\www\CRM\Php\adodb\adodb.inc.php(550): ADODB_ado->_connect('Provider=SLXOLE...', '', '', '')
#2 C:\wamp\www\CRM\Php\crm-test1.php(28): ADOConnection->Connect('Provider=SLXOLE...')

My question is: What form does the ADODB connection string have to be in and how can I get this working?

TIA,
Rick

File moved to subfolder returns blank page in browser

Hello,

I have an issue with adodb that I am not able to resolve for days now. Maybe someone has experienced the same issue:
I need to move a file from the root directory to a subfolder. All code is correct and links to include files work without any issue. There are no php errors either.

However, when I run the file from the new location I just get a blank page.

Any ideas or suggestions?

Problems with adodb sessions , nothing in expireref

I am trying to save my userid in expireref. Is always empty. I read that if register globals is turn off you have to do it manually. So this is what I have. Can someone tell me what am I doing wrong? Except for this, the sessions are working great.

-----mysession.php
function mysession_notify()
{
//I am not going to use this. So I declared the function empty
}

function mysession_start()
{

    include_once("adodb/session/adodb-session2.php");
    ADOdb_Session::config($driver, $host, $user, $pwd, $database, $options=false); 
    $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','mysession_notify');
    session_start(); 

}

-----login.php
require_once 'mysession.php';
mysession_start();

if (isset($_POST['loginbtn']))
{
$_SESSION['USERID'] = 5;
//REDIRECT TO APP
}

I now changed the code to the following, still nothing on expireref column

function NotifyFn()
{
}

class AppSession
{
static function session_start()
{

    include_once("adodb/session/adodb-session2.php");
     ADOdb_Session::config($driver, $host, $user, $pwd, $database, $options=false);
    $GLOBALS['USERID'] =5; ////JUST TO SEE IF IT WORKED 
    $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');
    session_start(); 
}

}

Undefined constants called in ADOConnection::AutoExecute

Getting the following error:

Use of undefined constant DB_AUTOQUERY_UPDATE - assumed 'DB_AUTOQUERY_UPDATE'
On line 2033 in file /REDACTED_PATH/composer/vendors/adodb/adodb-php/adodb.inc.php

Looking at the relevant method:

    /*
        Similar to PEAR DB's autoExecute(), except that
        $mode can be 'INSERT' or 'UPDATE' or DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
        If $mode == 'UPDATE', then $where is compulsory as a safety measure.

        $forceUpdate means that even if the data has not changed, perform update.
     */
    function AutoExecute($table, $fields_values, $mode = 'INSERT', $where = false, $forceUpdate = true, $magicq = false) {
        if ($where === false && ($mode == 'UPDATE' || $mode == 2 /* DB_AUTOQUERY_UPDATE */) ) {
            $this->outp_throw('AutoExecute: Illegal mode=UPDATE with empty WHERE clause', 'AutoExecute');
            return false;
        }

        $sql = "SELECT * FROM $table";
        $rs = $this->SelectLimit($sql, 1);
        if (!$rs) {
            return false; // table does not exist
        }

        $rs->tableName = $table;
        if ($where !== false) {
            $sql .= " WHERE $where";
        }
        $rs->sql = $sql;

        switch($mode) {
            case 'UPDATE':
            case DB_AUTOQUERY_UPDATE:
                $sql = $this->GetUpdateSQL($rs, $fields_values, $forceUpdate, $magicq);
                break;
            case 'INSERT':
            case DB_AUTOQUERY_INSERT:
                $sql = $this->GetInsertSQL($rs, $fields_values, $magicq);
                break;
            default:
                $this->outp_throw("AutoExecute: Unknown mode=$mode", 'AutoExecute');
                return false;
        }
        return $sql && $this->Execute($sql);
    }

The DB_AUTOQUERY_UPDATE and DB_AUTOQUERY_INSERT are defined in adodb-pear.inc.php

Not sure if you want to move the definitions to adodb.inc.php or work around them by using the primitive values in the switch statement.

SQLite3 wrong connection parameter

On version 5.19, in the driver sqlite3(adodb-sqlite3.inc.php), the function to connect "_connect" is opening the connection with the wrong parameter $argDatabasename. Should be $argHostname:
Wrong: $this->_connectionID = new SQLite3($argDatabasename);
Correct: $this->_connectionID = new SQLite3($argHostname);

Race condition creating/dropping sequences.

If multiple threads/processes are running, and a sequence table isn't created ahead of time, there is a race condition with the existing MySQLi driver, it can be resolved by adding "IF (NOT) EXISTS" to the genSeqSQL and dropSeqSQL as follows:

   var $_genSeqSQL = "create table if not exists %s (id int not null)";
    var $_dropSeqSQL = "drop table if exists %s";

This syntax seems to be available going back to at least MySQL v4.0 if not further.

However I believe this may push the race condition onto the $_genSeq2SQL query when inserting the first value into the sequence table. This could be fixed using something like:

var $_genSeq2SQL = "replace into %s values (%s)";

Which is also supported going back MySQL v4.0.

Our unit test suite would trigger this race condition consistently, the above seems to resolve it.

CacheFlush() not flushing

the $dbh->CacheFlush() function isn't flushing anything for me, with neither file cache or memcache.

If I replace:

if (empty($ADODB_CACHE)) {
return false;
}

with:

if (empty($ADODB_CACHE)) {
$this->_CreateCache();
}

in adodb.inc.php line 1840, it starts doing the right thing.

I don't know if that's the proper fix or whether I'm doing something wrong in the first place.

I'm running v5.19 via composer, but its the same result using dev-master.

Undefined variable $dir

found in function flushall line 297 of adodb.inc.php

function flushall($debug=false)
{
global $ADODB_CACHE_DIR;

    $rez = false;

        if (strlen($ADODB_CACHE_DIR) > 1) {
            $rez = $this->_dirFlush($ADODB_CACHE_DIR);
            if ($debug) ADOConnection::outp( "flushall: $dir<br><pre>\n". $rez."</pre>");
        }
        return $rez;
    }

Is CREATE PROC not yet supported for Microsoft Access database files (.accdb & .mdb)?

Is there anyone working on making the CREATE PROC clause work using PHP and adodb?

Using PHP, I'm not getting a "table" to be created when I use "CREATE PROC myProc AS ....",
but I can retrieve record-sets from previously stored PROCs that were created by other applications, including Microsoft Access.

I've been creating PROCs for over a decade now. They are a great way to squirrel away queries that I use repeatedly against actual tables.

Is there anyone working on this?

Thanks.
Abbas

Needless output in ADODB_mssqlnative with activated debugging

When debugging is activated, this class not only gives the sql-statements to the output handler, like the other drivers do. Also the returned values of a lot of print_r- and adodb_backtrace-calls are given.
I think, using the backtrace here might be useful while developing the ADOdb-driver-class, but it's completely absurd for debugging an application which only uses ADOdb. In this case only the processed statements are relevant.

ADOdb allows you to define your own output and error handler. I use this feature to have the ability to write the errors and the output to separate logfiles, instead of sending them to the browser.
This is very useful while you are developing an application and it's also useful if you are searching for errors on a live-system. You can log all the "real-live" statements and errors without affecting the system.

Unfortunately the logfile gets flooded with debug-messages, by this driver.
Nearly 2500 lines for a simple script with only two insert- and one select-statement. And 10000 lines for a little bit more complex script. At every single request!
This not only bloats the output-log, it also slows down the application.

It would be nice if this class could behave like all the other driver-classes.

Greetings

Bill

Request: AutoExecute Delete Support

Hi:

I can update a content with this sql

$record = array('content_text' => $_REQUEST['content_text']);
$rs = $this->conn->AutoExecute(TABLE_CONTENT, $record, 'UPDATE', 'content_id=1');

Why I cant delete like this?
$rs = $this->conn->AutoExecute(TABLE_CONTENT, 'DELETE, 'content_id=1');

Is possible implement this spesification?

/Sorry, english is not my first language.

Create table cannot handle ENUM field type

in adodb-datadict.inc.php _GenFields and _GetSize functions not handle ENUM options.

When you create a new table, and declare fields like this:
id int(10) unsigned PRIMARY NOT NULL AUTO_INCREMENT,
...
status enum('active','inactive') NOT NULL DEFAULT 'active'

_GenFields functions reparse the SQL, and drop the parts next to enum:
ENUM NOT NULL DEFAULT 'active'

Fix workaround:
_GetSize add new parameter: $enumops
/**
GENERATE THE SIZE PART OF THE DATATYPE
$ftype is the actual type
$ty is the type defined originally in the DDL
*/
function _GetSize($ftype, $ty, $fsize, $fprec, $enumops)
{
if (strlen($fsize) && $ty != 'X' && $ty != 'B' && strpos($ftype,'(') === false) {
$ftype .= "(".$fsize;
if (strlen($fprec)) $ftype .= ",".$fprec;
$ftype .= ')';
}
//ENUM FIX
if(strtoupper($ftype) == 'ENUM'){
$ftype .= "({$enumops})";
}
return $ftype;
}

_GenFields modify like this: (line 663)

        //-----------------
        // Parse attributes
        foreach($fld as $attr => $v) {

            if ($attr == 2 && is_numeric($v)) $attr = 'SIZE';
            //ENUM FIX
            elseif ($attr == 2 && strtoupper($ftype) == 'ENUM') $attr = 'ENUM';
            elseif (is_numeric($attr) && $attr > 1 && !is_numeric($v)) $attr = strtoupper($v);

... and place this for the end of the switch (line 700):
// let INDEX keyword create a 'very standard' index on column
case 'INDEX': $findex = $v; break;
case 'UNIQUE': $funiqueindex = true; break;
//ENUM FIX
case 'ENUM': $fenumops = $v; break;

place the new extra parameter into _GetSize parameters (line 726)
$ftype = $this->_GetSize($ftype, $ty, $fsize, $fprec, $fenumops);

And all working correctly

Last inserted id support of PostgreSQL 9 disappeared

After updating the master branch of ADOdb last inserted id support of PostgreSQL 9 disappeared.

I found a commit which is maybe the origin of the problem: d01454c

In the updated code pg_getlastoid PHP method used to retrieve the last insert id but after PostgreSQL version 8.1 it is discouraged.(http://hu1.php.net/manual/en/function.pg-last-oid.php)

The replaced code was good and it presents in tag v5.18a.

Please check and modify master branch if it's possible.


This issue was reported by Péter Hadadi via e-mail to John Lim.

Int types don't get sanitized

We've gotten a report of an SQL injection that came because we expected adodb to sanitize our fields. It turns out the doQuote method ignores int types and doesn't do any validation on the sanity of those values.

Is this intentional? I understand that we should validate our own ints, I'm just wondering what the thought process is.

Inefficiency in adodb-mssqlnative.inc.php

I've noticed that the _FetchField() function in ADORecordset_mssqlnative repeatedly calls sqlsrv_field_metadata, and this function is called in a loop in _initrs()

storing the result of sqlsrv_field_metadata in a class property and reusing allowed great performance gains for me, especially when using result sets with many fields.

my snippet on line 938:
if(!isset($this->metaCache)) {
$fa = @sqlsrv_field_metadata($this->_queryID);
$this->metaCache = $fa;
} else $fa = $this->metaCache;

AutoExecute error when fields contain the character ':'

Hi All,

I think it may be a problem with method AutoExecute: when record fields contain unusual character like ':' you receve an SQL error.
I'm working with MySql and the autoexecute, debug string and the error are:

$DB_GN->AutoExecute('gn_tags', $record, 'INSERT')

Debug:


(mysqli): SELECT * FROM gn_tags LIMIT 1



(mysqli): INSERT INTO gn_tags ( ID_URLS, TITLE, DESCRIPTION, KEYWORDS, H1, IMG, OG:TITLE, OG:DESCRIPTION, OG:IMAGE, OG:URL ) VALUES ( 1465, 'A Ferrara confronto su CCSVI e Sclerosi Multipla', 'Il seminario si è svolto in un aula straboccante, presenti oltre 300 persone, con il Direttore generale, una folta rappresentanza di medici e ricercatori dell'Ateneo e un centinaio tra studenti, specializzandi e dottorandi di ricerca', 'CCSVI,Paolo Zamboni,sclerosi multipla,Insufficienza venosa cronica cerebrospinale,Ettaro', 'A Ferrara confronto su CCSVI e Sclerosi Multipla', 'http://imgs2.site.it/img/arrow_vert.jpg||/img/meteo/sereno.gif||http://imgs1.site.it/img/login.gif', 'A Ferrara confronto su CCSVI e Sclerosi Multipla', 'Il seminario si è svolto in un aula straboccante, presenti oltre 300 persone, con il Direttore generale, una folta rappresentanza di medici e ricercatori dell'Ateneo e un centinaio tra studenti, specializzandi e dottorandi di ricerca.', 'http://www.site.it/img/info_header_logo.gif', 'http://www.site.it/c/2E6745FC-1D2D-46C4-A0DC-30236F1C327F/A-Ferrara-confronto-su-CCSVI-e-Sclerosi-Multipla' )


Query: INSERT INTO gn_tags ( ID_URLS, TITLE, DESCRIPTION, KEYWORDS, H1, IMG, OG:TITLE, OG:DESCRIPTION, OG:IMAGE, OG:URL ) VALUES ( 1465, 'A Ferrara confronto su CCSVI e Sclerosi Multipla', 'Il seminario si è svolto in un aula straboccante, presenti oltre 300 persone, con il Direttore generale, una folta rappresentanza di medici e ricercatori dell'Ateneo e un centinaio tra studenti, specializzandi e dottorandi di ricerca', 'CCSVI,Paolo Zamboni,sclerosi multipla,Insufficienza venosa cronica cerebrospinale,Ettaro', 'A Ferrara confronto su CCSVI e Sclerosi Multipla', 'http ://imgs2.site.it/img/arrow_vert.jpg||/img/meteo/sereno.gif||http ://imgs1.site.it/img/login.gif', 'A Ferrara confronto su CCSVI e Sclerosi Multipla', 'Il seminario si è svolto in un aula straboccante, presenti oltre 300 persone, con il Direttore generale, una folta rappresentanza di medici e ricercatori dell'Ateneo e un centinaio tra studenti, specializzandi e dottorandi di ricerca.', 'http://www.site.it/img/info_header_logo.gif', 'http://www.site.it/c/2E6745FC-1D2D-46C4-A0DC-30236F1C327F/A-Ferrara-confronto-su-CCSVI-e-Sclerosi-Multipla' ) failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':TITLE, OG:DESCRIPTION, OG:IMAGE, OG:URL ) VALUES ( 1465, 'A Ferrara confronto s' at line 1

Error:
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':TITLE, OG:DESCRIPTION, OG:IMAGE, OG:URL ) VALUES ( 1465, 'A Ferrara confronto s' at line 1

Error inserting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':TITLE, OG:DESCRIPTION, OG:IMAGE, OG:URL ) VALUES ( 1465, 'A Ferrara confronto s'at line 1

Could you verify in same way? May I help you?

Thank you all!

L.

Possibly broken modification to Class ADORecordSet function GetAssocKeys V5.19 23-Apr-2014

Hi,

Many thanks to everybody who has made this such a brilliant piece of kit which I have used in numerous projects :-)

Please excuse me if this is a duplicate or if I have overlooked something.

A problem appears to have been introduced into adodb.inc.php V5.19 23-Apr-2014

Class ADORecordSet function GetAssocKeys

I've had to change line 3505 in my production system

/*Change by Chris Barnes 2014-05-07 after problems with GetRowAssoc and function _fetch() in adodb-ibase.inc.php
*Previously: $this->bind[$key] = $val;
*Now: $this->bind[$val] = $i;

  • This reflects the functionality of earlier versions of this function
  • Take special note of the comment: "# This should not happen... trigger error ?" in GetRowAssoc
    */

Many thanks

Chris

Improve compatibility of ADORecordSet_empty

Please improve the compatibility of ADORecordSet_Empty - adding the following methods means less hacking around empty record sets in code that uses ADOdb:

        function GetArray() {return array();}
        function GetAll() {return array();}
        function GetArrayLimit() {return array();}
        function GetRows() {return array();}
        function GetRowAssoc() {return array();}
        function MaxRecordCount() {return 0;}
        function NumRows() {return 0;}
        function NumCols() {return 0;}

And on a side-note: thanks guys for the fantastic db layer that I have enjoyed using for years!

Some files are not UTF-8

The following files are not in UTF-8:
adodb/adodb-lib.inc.php
adodb/adodb.inc.php

adodb/lang/adodb-ar.inc.php
adodb/lang/adodb-bg.inc.php
adodb/lang/adodb-ca.inc.php
adodb/lang/adodb-cn.inc.php
adodb/lang/adodb-cz.inc.php
adodb/lang/adodb-hu.inc.php
adodb/lang/adodb-pl.inc.php
adodb/lang/adodb-pt-br.inc.php
adodb/lang/adodb-ru1251.inc.php
adodb/lang/adodb-sv.inc.php
adodb/lang/adodb-uk1251.inc.php
adodb/lang/adodb_th.inc.php

Is there a reason not to convert them to UTF-8?

Strict standards compliance in oci8 datadict

PHP Strict Standards:  Declaration of ADODB2_oci8::MetaType() should be compatible with ADODB_DataDict::MetaType($t, $len = -1, $fieldobj = false) in /home/dregad/dev/adodb/datadict/datadict-oci8.inc.php on line 296
PHP Strict Standards:  Declaration of ADODB2_oci8::AlterColumnSQL() should be compatible with ADODB_DataDict::AlterColumnSQL($tabname, $flds, $tableflds = '', $tableoptions = '') in /home/dregad/dev/adodb/datadict/datadict-oci8.inc.php on line 296
PHP Strict Standards:  Declaration of ADODB2_oci8::DropColumnSQL() should be compatible with ADODB_DataDict::DropColumnSQL($tabname, $flds, $tableflds = '', $tableoptions = '') in /home/dregad/dev/adodb/datadict/datadict-oci8.inc.php on line 296

SQLite3 FetchField colum name

On function function FetchField($fieldOffset = -1) of file adodb-sqlite3.inc.php the correct syntax to get the column name should be:

$fld->name = $this->_queryID->columnName($fieldOffset);

instead of:

$fld->name->columnName($this->_queryID, $fieldOffset);

Sybase

Can anyone help with setting ADODB with Sybase ASE15.7 using CTLIB

ADODB_mssql_n : unable to execute stored procedure

Method _query in ADODB_mssql_n is unable to handle calls to stored procedures.

function _query($sql,$inputarr=false){
$sql = $this->_appendN($sql);
return ADODB_mssql::_query($sql,$inputarr);
}

It expects $sql to always be a string, but in case of a stored procedure it's an array.

The fix could be implemented in multiple ways. The simplest would be to call _appendN only if it's not an array:

function _query($sql,$inputarr=false){
if (! is_array($sql)) {
$sql = $this->_appendN($sql);
}
return ADODB_mssql::_query($sql,$inputarr);
}

or to change method _appendN to handle an array.

Support for composer

Hi,

Would want to know what do you think about adding composer support to the library and registering it into packagist.org. I think people could then install the lib easily through their composer.json file (which is the case of my company :).

Cheers,
Christian.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.