Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

   1  <?php
   2  /*
   3  @version   v5.21.0  2021-02-27
   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     // Modified to strip table names from returned fields
  39     function _fetch($ignore_fields=false)
  40     {
  41        $this->fields = array();
  42        $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode);
  43        if(is_array($fields))
  44           foreach($fields as $n => $v)
  45           {
  46              if(($p = strpos($n, ".")) !== false)
  47                 $n = substr($n, $p+1);
  48              $this->fields[$n] = $v;
  49           }
  50  
  51        return !empty($this->fields);
  52     }
  53  }