Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
/**
3
 * SQLite Portable driver.
4
 *
5
 * Make it more similar to other database drivers. The main differences are
6
 * - When selecting (joining) multiple tables, in assoc mode the table
7
 *   names are included in the assoc keys in the "sqlite" driver.
8
 *   In "sqlitepo" driver, the table names are stripped from the returned
9
 *   column names. When this results in a conflict,  the first field gets
10
 *   preference.
11
 *
12
 * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
13
 *
14
 * @package ADOdb
15
 * @link https://adodb.org Project's web site and documentation
16
 * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
17
 *
18
 * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
19
 * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
20
 * any later version. This means you can use it in proprietary products.
21
 * See the LICENSE.md file distributed with this source code for details.
22
 * @license BSD-3-Clause
23
 * @license LGPL-2.1-or-later
24
 *
25
 * @copyright 2000-2013 John Lim
26
 * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
27
 * @author Herman Kuiper <herman@ozuzo.net>
28
 */
29
 
30
if (!defined('ADODB_DIR')) die();
31
 
32
include_once(ADODB_DIR.'/drivers/adodb-sqlite.inc.php');
33
 
34
class ADODB_sqlitepo extends ADODB_sqlite {
35
   var $databaseType = 'sqlitepo';
36
}
37
 
38
/*--------------------------------------------------------------------------------------
39
       Class Name: Recordset
40
--------------------------------------------------------------------------------------*/
41
 
42
class ADORecordset_sqlitepo extends ADORecordset_sqlite {
43
 
44
   var $databaseType = 'sqlitepo';
45
 
46
   // Modified to strip table names from returned fields
47
   function _fetch($ignore_fields=false)
48
   {
49
      $this->fields = array();
50
      $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode);
51
      if(is_array($fields))
52
         foreach($fields as $n => $v)
53
         {
54
            if(($p = strpos($n, ".")) !== false)
55
               $n = substr($n, $p+1);
56
            $this->fields[$n] = $v;
57
         }
58
 
59
      return !empty($this->fields);
60
   }
61
}