Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  /*
   3  @version   v5.20.16  12-Jan-2020
   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  }