[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/adodb/drivers/ -> adodb-sqlitepo.inc.php (source)

   1  <?php
   2  /*
   3  @version   v5.20.3  01-Jan-2016
   4  @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   5  @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   6    Released under both BSD license and Lesser GPL library license.
   7    Whenever there is any discrepancy between the two licenses,
   8    the BSD license will take precedence.
   9  
  10    Portable version of sqlite driver, to make it more similar to other database drivers.
  11    The main differences are
  12  
  13     1. When selecting (joining) multiple tables, in assoc mode the table
  14           names are included in the assoc keys in the "sqlite" driver.
  15  
  16        In "sqlitepo" driver, the table names are stripped from the returned column names.
  17        When this results in a conflict,  the first field get preference.
  18  
  19      Contributed by Herman Kuiper  herman#ozuzo.net
  20  */
  21  
  22  if (!defined('ADODB_DIR')) die();
  23  
  24  include_once(ADODB_DIR.'/drivers/adodb-sqlite.inc.php');
  25  
  26  class ADODB_sqlitepo extends ADODB_sqlite {
  27     var $databaseType = 'sqlitepo';
  28  }
  29  
  30  /*--------------------------------------------------------------------------------------
  31         Class Name: Recordset
  32  --------------------------------------------------------------------------------------*/
  33  
  34  class ADORecordset_sqlitepo extends ADORecordset_sqlite {
  35  
  36     var $databaseType = 'sqlitepo';
  37  
  38     function __construct($queryID,$mode=false)
  39     {
  40        parent::__construct($queryID,$mode);
  41     }
  42  
  43     // Modified to strip table names from returned fields
  44     function _fetch($ignore_fields=false)
  45     {
  46        $this->fields = array();
  47        $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode);
  48        if(is_array($fields))
  49           foreach($fields as $n => $v)
  50           {
  51              if(($p = strpos($n, ".")) !== false)
  52                 $n = substr($n, $p+1);
  53              $this->fields[$n] = $v;
  54           }
  55  
  56        return !empty($this->fields);
  57     }
  58  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1