Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / adodb / drivers / adodb-sqlitepo.inc.php
blob58e071d7f8695dde28d441e7d2c7c6e01909313c
1 <?php
2 /*
3 V4.98 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved.
4 Released under both BSD license and Lesser GPL library license.
5 Whenever there is any discrepancy between the two licenses,
6 the BSD license will take precedence.
8 Portable version of sqlite driver, to make it more similar to other database drivers.
9 The main differences are
11 1. When selecting (joining) multiple tables, in assoc mode the table
12 names are included in the assoc keys in the "sqlite" driver.
14 In "sqlitepo" driver, the table names are stripped from the returned column names.
15 When this results in a conflict, the first field get preference.
17 Contributed by Herman Kuiper herman#ozuzo.net
20 if (!defined('ADODB_DIR')) die();
22 include_once(ADODB_DIR.'/drivers/adodb-sqlite.inc.php');
24 class ADODB_sqlitepo extends ADODB_sqlite {
25 var $databaseType = 'sqlitepo';
27 function ADODB_sqlitepo()
29 $this->ADODB_sqlite();
33 /*--------------------------------------------------------------------------------------
34 Class Name: Recordset
35 --------------------------------------------------------------------------------------*/
37 class ADORecordset_sqlitepo extends ADORecordset_sqlite {
39 var $databaseType = 'sqlitepo';
41 function ADORecordset_sqlitepo($queryID,$mode=false)
43 $this->ADORecordset_sqlite($queryID,$mode);
46 // Modified to strip table names from returned fields
47 function _fetch($ignore_fields=false)
49 $this->fields = array();
50 $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode);
51 if(is_array($fields))
52 foreach($fields as $n => $v)
54 if(($p = strpos($n, ".")) !== false)
55 $n = substr($n, $p+1);
56 $this->fields[$n] = $v;
59 return !empty($this->fields);