[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 /** 3 * ADOdb Lite Extend Module for Mysqlt 4 * 5 */ 6 7 eval('class maxdb_extend_EXTENDER extends maxdb_'. $last_module . '_ADOConnection { }'); 8 9 class maxdb_extend_ADOConnection extends maxdb_extend_EXTENDER 10 { 11 function &GetAssoc($sql, $inputarr=false, $force_array = false, $first2cols = false) 12 { 13 $data = false; 14 $result =& $this->Execute($sql, $inputarr); 15 if ($result) { 16 $data =& $result->GetAssoc($force_array, $first2cols); 17 $result->Close(); 18 } 19 return $data; 20 } 21 22 /** 23 * Generates a sequence id and stores it in $this->genID; 24 * GenID is only available if $this->hasGenID = true; 25 * 26 * @param seqname name of sequence to use 27 * @param startID if sequence does not exist, start at this ID 28 * @return 0 if not supported, otherwise a sequence id 29 */ 30 31 var $genID = 0; 32 33 function GenID($seqname='adodbseq', $startID=1) 34 { 35 $getnext = sprintf($this->_genIDSQL, $seqname); 36 $holdtransOK = $this->transaction_status; 37 $save_handler = $this->raiseErrorFn; 38 $this->raiseErrorFn = ''; 39 @($result = $this->Execute($getnext)); 40 $this->raiseErrorFn = $save_handler; 41 42 if (!$result) { 43 $this->transaction_status = $holdtransOK; 44 $createseq = $this->Execute(sprintf($this->_genSeqSQL, $seqname, $startID)); 45 $result = $this->Execute($getnext); 46 } 47 if ($result && !$result->EOF) 48 $this->genID = reset($result->fields); 49 else $this->genID = 0; 50 51 if ($result) 52 $result->Close(); 53 54 return $this->genID; 55 } 56 } 57 58 eval('class maxdb_extend_resultset_EXTENDER extends maxdb_'. $last_module . '_ResultSet { }'); 59 60 class maxdb_extend_ResultSet extends maxdb_extend_resultset_EXTENDER 61 { 62 function &GetAssoc($force_array = false, $first2cols = false) 63 { 64 $results = false; 65 66 if ($this->_numOfFields > 1) { 67 $numIndex = isset($this->fields[0]); 68 $results = array(); 69 if (!$first2cols && ($this->_numOfFields > 2 || $force_array)) { 70 if ($numIndex) { 71 while (!$this->EOF) { 72 $results[trim($this->fields[0])] = array_slice($this->fields, 1); 73 $this->MoveNext(); 74 } 75 } else { 76 while (!$this->EOF) { 77 $results[trim(reset($this->fields))] = array_slice($this->fields, 1); 78 $this->MoveNext(); 79 } 80 } 81 } else { 82 if ($numIndex) { 83 while (!$this->EOF) { 84 $results[trim(($this->fields[0]))] = $this->fields[1]; 85 $this->MoveNext(); 86 } 87 } else { 88 while (!$this->EOF) { 89 $v1 = trim(reset($this->fields)); 90 $v2 = ''.next($this->fields); 91 $results[$v1] = $v2; 92 $this->MoveNext(); 93 } 94 } 95 } 96 } 97 return $results; 98 } 99 100 } 101 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |