Fixed bug #14050: CleanUp - CGL format of t3lib files - t3lib_positionmap
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_sqlengine.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2004-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * PHP SQL engine
29 * EXPERIMENTAL!
30 *
31 * $Id$
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 * @deprecated since TYPO3 4.3, this class will be removed in TYPO3 4.5, it has been integrated to extension DBAL.
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 104: class t3lib_sqlengine extends t3lib_sqlparser
42 * 126: function init($config, &$pObj)
43 * 134: function resetStatusVars()
44 * 150: function processAccordingToConfig(&$value,$fInfo)
45 *
46 * SECTION: SQL queries
47 * 205: function exec_INSERTquery($table,$fields_values)
48 * 273: function exec_UPDATEquery($table,$where,$fields_values)
49 * 332: function exec_DELETEquery($table,$where)
50 * 383: function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit)
51 * 426: function sql_query($query)
52 * 437: function sql_error()
53 * 446: function sql_insert_id()
54 * 455: function sql_affected_rows()
55 * 465: function quoteStr($str)
56 *
57 * SECTION: SQL admin functions
58 * 490: function admin_get_tables()
59 * 501: function admin_get_fields($tableName)
60 * 512: function admin_get_keys($tableName)
61 * 523: function admin_query($query)
62 *
63 * SECTION: Data Source I/O
64 * 548: function readDataSource($table)
65 * 560: function saveDataSource($table)
66 *
67 * SECTION: SQL engine functions (PHP simulation of SQL) - still experimental
68 * 590: function selectFromData($table,$where)
69 * 628: function select_evalSingle($table,$config,&$itemKeys)
70 * 747: function getResultSet($keys, $table, $fieldList)
71 *
72 * SECTION: Debugging
73 * 790: function debug_printResultSet($array)
74 *
75 *
76 * 829: class t3lib_sqlengine_resultobj
77 * 843: function sql_num_rows()
78 * 852: function sql_fetch_assoc()
79 * 863: function sql_fetch_row()
80 * 881: function sql_data_seek($pointer)
81 * 894: function sql_field_type()
82 *
83 * TOTAL FUNCTIONS: 27
84 * (This index is automatically created/updated by the extension "extdeveval")
85 *
86 */
87
88
89
90
91
92
93
94
95 /**
96 * PHP SQL engine / server
97 * Basically this is trying to emulation SQL record selection by PHP, thus allowing SQL queries into alternative data storages managed by PHP.
98 * EXPERIMENTAL!
99 *
100 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
101 * @package TYPO3
102 * @subpackage t3lib
103 */
104 class t3lib_sqlengine extends t3lib_sqlparser {
105
106 // array with data records: [table name][num.index] = records
107 var $data = array(); // Data source storage
108
109
110 // Internal, SQL Status vars:
111 var $errorStatus = ''; // Set with error message of last operation
112 var $lastInsertedId = 0; // Set with last inserted unique ID
113 var $lastAffectedRows = 0; // Set with last number of affected rows.
114
115
116
117 /**
118 * Constrcutor
119 */
120 function __construct() {
121 t3lib_div::deprecationLog("Class t3lib_sqlengine is deprecated since TYPO3 4.3, will be removed in TYPO3 4.6, it has been integrated to extension DBAL.");
122 }
123
124
125 /**
126 * Dummy function for initializing SQL handler. Create you own in derived classes.
127 *
128 * @param array Configuration array from handler
129 * @param object Parent object
130 * @return void
131 */
132 function init($config, $pObj) {
133 }
134
135 /**
136 * Reset SQL engine status variables (insert id, affected rows, error status)
137 *
138 * @return void
139 */
140 function resetStatusVars() {
141 $this->errorStatus = '';
142 $this->lastInsertedId = 0;
143 $this->lastAffectedRows = 0;
144 }
145
146 /**
147 * Processing of update/insert values based on field type.
148 *
149 * The input value is typecast and trimmed/shortened according to the field
150 * type and the configuration options from the $fInfo parameter.
151 *
152 * @param mixed $value The input value to process
153 * @param array $fInfo Field configuration data
154 * @return mixed The processed input value
155 */
156 function processAccordingToConfig(&$value,$fInfo) {
157 $options = $this->parseFieldDef($fInfo['Type']);
158
159 switch(strtolower($options['fieldType'])) {
160 case 'int':
161 case 'smallint':
162 case 'tinyint':
163 case 'mediumint':
164 $value = intval($value);
165 if ($options['featureIndex']['UNSIGNED']) {
166 $value = t3lib_div::intInRange($value,0);
167 }
168 break;
169 case 'double':
170 $value = (double)$value;
171 break;
172 case 'varchar':
173 case 'char':
174 $value = substr($value,0,trim($options['value']));
175 break;
176 case 'text':
177 case 'blob':
178 $value = substr($value,0,65536);
179 break;
180 case 'tinytext':
181 case 'tinyblob':
182 $value = substr($value,0,256);
183 break;
184 case 'mediumtext':
185 case 'mediumblob':
186 // ??
187 break;
188 }
189 }
190
191
192
193
194
195
196
197 /********************************
198 *
199 * SQL queries
200 * This is the SQL access functions used when this class is instantiated as a SQL handler with DBAL. Override these in derived classes.
201 *
202 ********************************/
203
204 /**
205 * Execute an INSERT query
206 *
207 * @param string Table name
208 * @param array Field values as key=>value pairs.
209 * @return boolean TRUE on success and FALSE on failure (error is set internally)
210 */
211 function exec_INSERTquery($table,$fields_values) {
212
213 // Initialize
214 $this->resetStatusVars();
215
216 // Reading Data Source if not done already.
217 $this->readDataSource($table);
218
219 // If data source is set:
220 if (is_array($this->data[$table])) {
221
222 $fieldInformation = $this->admin_get_fields($table); // Should cache this...!
223
224 // Looking for unique keys:
225 $saveArray = array();
226 foreach($fieldInformation as $fInfo) {
227
228 // Field name:
229 $fN = $fInfo['Field'];
230
231 // Set value:
232 // FIXME $options not defined
233 $saveArray[$fN] = isset($fields_values[$fN]) ? $fields_values[$fN] : $options['Default'];
234
235 // Process value:
236 $this->processAccordingToConfig($saveArray[$fN], $fInfo);
237
238 // If an auto increment field is found, find the largest current uid:
239 if ($fInfo['Extra'] == 'auto_increment') {
240
241 // Get all UIDs:
242 $uidArray = array();
243 foreach($this->data[$table] as $r) {
244 $uidArray[] = $r[$fN];
245 }
246
247 // If current value is blank or already in array, we create a new:
248 if (!$saveArray[$fN] || in_array(intval($saveArray[$fN]), $uidArray)) {
249 if (count($uidArray)) {
250 $saveArray[$fN] = max($uidArray)+1;
251 } else $saveArray[$fN] = 1;
252 }
253
254 // Update "last inserted id":
255 $this->lastInsertedId = $saveArray[$fN];
256 }
257 }
258
259 // Insert row in table:
260 $this->data[$table][] = $saveArray;
261
262 // Save data source
263 $this->saveDataSource($table);
264
265 return TRUE;
266 } else $this->errorStatus = 'No data loaded.';
267
268 return FALSE;
269 }
270
271 /**
272 * Execute UPDATE query on table
273 *
274 * @param string Table name
275 * @param string WHERE clause
276 * @param array Field values as key=>value pairs.
277 * @return boolean TRUE on success and FALSE on failure (error is set internally)
278 */
279 function exec_UPDATEquery($table,$where,$fields_values) {
280
281 // Initialize:
282 $this->resetStatusVars();
283
284 // Reading Data Source if not done already.
285 $this->readDataSource($table);
286
287 // If anything is there:
288 if (is_array($this->data[$table])) {
289
290 // Parse WHERE clause:
291 $where = $this->parseWhereClause($where);
292
293 if (is_array($where)) {
294
295 // Field information
296 $fieldInformation = $this->admin_get_fields($table); // Should cache this...!
297
298 // Traverse fields to update:
299 foreach($fields_values as $fName => $fValue) {
300 $this->processAccordingToConfig($fields_values[$fName],$fieldInformation[$fName]);
301 }
302
303 // Do query, returns array with keys to the data array of the result:
304 $itemKeys = $this->selectFromData($table,$where);
305
306 // Set "last affected rows":
307 $this->lastAffectedRows = count($itemKeys);
308
309 // Update rows:
310 if ($this->lastAffectedRows) {
311 // Traverse result set here:
312 foreach($itemKeys as $dataArrayKey) {
313
314 // Traverse fields to update:
315 foreach($fields_values as $fName => $fValue) {
316 $this->data[$table][$dataArrayKey][$fName] = $fValue;
317 }
318 }
319
320 // Save data source
321 $this->saveDataSource($table);
322 }
323
324 return TRUE;
325 } else $this->errorStatus = 'WHERE clause contained errors: '.$where;
326 } else $this->errorStatus = 'No data loaded.';
327
328 return FALSE;
329 }
330
331 /**
332 * Execute DELETE query
333 *
334 * @param string Table to delete from
335 * @param string WHERE clause
336 * @return boolean TRUE on success and FALSE on failure (error is set internally)
337 */
338 function exec_DELETEquery($table,$where) {
339
340 // Initialize:
341 $this->resetStatusVars();
342
343 // Reading Data Source if not done already.
344 $this->readDataSource($table);
345
346 // If anything is there:
347 if (is_array($this->data[$table])) {
348
349 // Parse WHERE clause:
350 $where = $this->parseWhereClause($where);
351
352 if (is_array($where)) {
353
354 // Do query, returns array with keys to the data array of the result:
355 $itemKeys = $this->selectFromData($table,$where);
356
357 // Set "last affected rows":
358 $this->lastAffectedRows = count($itemKeys);
359
360 // Remove rows:
361 if ($this->lastAffectedRows) {
362 // Traverse result set:
363 foreach($itemKeys as $dataArrayKey) {
364 unset($this->data[$table][$dataArrayKey]);
365 }
366
367 // Saving data source
368 $this->saveDataSource($table);
369 }
370
371 return TRUE;
372 } else $this->errorStatus = 'WHERE clause contained errors: '.$where;
373 } else $this->errorStatus = 'No data loaded.';
374
375 return FALSE;
376 }
377
378 /**
379 * Execute SELECT query
380 *
381 * @param string List of fields to select from the table. This is what comes right after "SELECT ...". Required value.
382 * @param string Table(s) from which to select. This is what comes right after "FROM ...". Required value.
383 * @param string Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
384 * @param string Optional GROUP BY field(s), if none, supply blank string.
385 * @param string Optional ORDER BY field(s), if none, supply blank string.
386 * @param string Optional LIMIT value ([begin,]max), if none, supply blank string.
387 * @return object Returns result object, but if errors, returns false
388 */
389 function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit) {
390
391 // Initialize:
392 $this->resetStatusVars();
393
394 // Create result object
395 $sqlObj = t3lib_div::makeInstance('t3lib_sqlengine_resultobj');
396 $sqlObj->result = array(); // Empty result as a beginning
397
398 // Get table list:
399 $tableArray = $this->parseFromTables($from_table);
400 $table = $tableArray[0]['table'];
401
402 // Reading Data Source if not done already.
403 $this->readDataSource($table);
404
405 // If anything is there:
406 if (is_array($this->data[$table])) {
407
408 // Parse WHERE clause:
409 $where = $this->parseWhereClause($where_clause);
410 if (is_array($where)) {
411
412 // Do query, returns array with keys to the data array of the result:
413 $itemKeys = $this->selectFromData($table,$where);
414
415 // Finally, read the result rows into this variable:
416 $sqlObj->result = $this->getResultSet($itemKeys,$table,'*');
417 // Reset and return result:
418 reset($sqlObj->result);
419 return $sqlObj;
420 } else $this->errorStatus = 'WHERE clause contained errors: '.$where;
421 } else $this->errorStatus = 'No data loaded: '.$this->errorStatus;
422
423 return FALSE;
424 }
425
426 /**
427 * Performs an SQL query on the "database"
428 *
429 * @param string Query to execute
430 * @return object Result object or false if error
431 */
432 function sql_query($query) {
433 $res = t3lib_div::makeInstance('t3lib_sqlengine_resultobj');
434 $res->result = array();
435 return $res;
436 }
437
438 /**
439 * Returns most recent error
440 *
441 * @return string Error message, if any
442 */
443 function sql_error() {
444 return $this->errorStatus;
445 }
446
447 /**
448 * Returns most recently create unique ID (of INSERT queries)
449 *
450 * @return integer Last unique id created.
451 */
452 function sql_insert_id() {
453 return $this->lastInsertedId;
454 }
455
456 /**
457 * Returns affected rows (of UPDATE and DELETE queries)
458 *
459 * @return integer Last amount of affected rows.
460 */
461 function sql_affected_rows() {
462 return $this->lastAffectedRows;
463 }
464
465 /**
466 * Quoting strings for insertion in SQL queries
467 *
468 * @param string Input String
469 * @return string String, with quotes escaped
470 */
471 function quoteStr($str) {
472 return addslashes($str);
473 }
474
475
476
477
478
479
480
481
482
483
484 /**************************************
485 *
486 * SQL admin functions
487 * (For use in the Install Tool and Extension Manager)
488 *
489 **************************************/
490
491 /**
492 * (DUMMY) Returns the list of tables from the database
493 *
494 * @return array Tables in an array (tablename is in both key and value)
495 * @todo Should return table details in value! see t3lib_db::admin_get_tables()
496 */
497 function admin_get_tables() {
498 $whichTables = array();
499 return $whichTables;
500 }
501
502 /**
503 * (DUMMY) Returns information about each field in the $table
504 *
505 * @param string Table name
506 * @return array Field information in an associative array with fieldname => field row
507 */
508 function admin_get_fields($tableName) {
509 $output = array();
510 return $output;
511 }
512
513 /**
514 * (DUMMY) Returns information about each index key in the $table
515 *
516 * @param string Table name
517 * @return array Key information in a numeric array
518 */
519 function admin_get_keys($tableName) {
520 $output = array();
521 return $output;
522 }
523
524 /**
525 * (DUMMY) mysql() wrapper function, used by the Install Tool and EM for all queries regarding management of the database!
526 *
527 * @param string Query to execute
528 * @return pointer Result pointer
529 */
530 function admin_query($query) {
531 return $this->sql_query($query);
532 }
533
534
535
536
537
538
539
540
541 /********************************
542 *
543 * Data Source I/O
544 *
545 ********************************/
546
547 /**
548 * Dummy function for setting table data. Create your own.
549 * NOTICE: Handler to "table-locking" needs to be made probably!
550 *
551 * @param string Table name
552 * @return void
553 * @todo Table locking tools?
554 */
555 function readDataSource($table) {
556 $this->data[$table] = array();
557 }
558
559 /**
560 * Dummy function for setting table data. Create your own.
561 * NOTICE: Handler to "table-locking" needs to be made probably!
562 *
563 * @param string Table name
564 * @return void
565 * @todo Table locking tools?
566 */
567 function saveDataSource($table) {
568 debug($this->data[$table]);
569 }
570
571
572
573
574
575
576
577
578
579
580
581
582
583 /********************************
584 *
585 * SQL engine functions (PHP simulation of SQL) - still experimental
586 *
587 ********************************/
588
589 /**
590 * PHP simulation of SQL "SELECT"
591 * Yet EXPERIMENTAL!
592 *
593 * @param string Table name
594 * @param array Where clause parsed into array
595 * @return array Array of keys pointing to result rows in $this->data[$table]
596 */
597 function selectFromData($table,$where) {
598
599 $output = array();
600 if (is_array($this->data[$table])) {
601
602 // All keys:
603 $OR_index = 0;
604
605 foreach($where as $config) {
606
607 if (strtoupper($config['operator'])=='OR') {
608 $OR_index++;
609 }
610
611 if (!isset($itemKeys[$OR_index])) $itemKeys[$OR_index] = array_keys($this->data[$table]);
612
613 $this->select_evalSingle($table,$config,$itemKeys[$OR_index]);
614 }
615
616 foreach($itemKeys as $uidKeys) {
617 $output = array_merge($output, $uidKeys);
618 }
619 $output = array_unique($output);
620 }
621
622 return $output;
623 }
624
625 /**
626 * Evalutaion of a WHERE-clause-array.
627 * Yet EXPERIMENTAL
628 *
629 * @param string Tablename
630 * @param array WHERE-configuration array
631 * @param array Data array to work on.
632 * @return void Data array passed by reference
633 * @see selectFromData()
634 */
635 function select_evalSingle($table,$config,&$itemKeys) {
636 $neg = preg_match('/^AND[[:space:]]+NOT$/',trim($config['operator']));
637
638 if (is_array($config['sub'])) {
639 $subSelKeys = $this->selectFromData($table,$config['sub']);
640 if ($neg) {
641 foreach($itemKeys as $kk => $vv) {
642 if (in_array($vv,$subSelKeys)) {
643 unset($itemKeys[$kk]);
644 }
645 }
646 } else {
647 $itemKeys = array_intersect($itemKeys, $subSelKeys);
648 }
649 } else {
650 $comp = strtoupper(str_replace(array(' ',TAB,CR,LF),'',$config['comparator']));
651 $mod = strtoupper($config['modifier']);
652 switch($comp) {
653 case 'NOTLIKE':
654 case 'LIKE':
655 $like_value = strtolower($config['value'][0]);
656 if (substr($like_value,0,1)=='%') {
657 $wildCard_begin = TRUE;
658 $like_value = substr($like_value,1);
659 }
660 if (substr($like_value,-1)=='%') {
661 $wildCard_end = TRUE;
662 $like_value = substr($like_value,0,-1);
663 }
664 break;
665 case 'NOTIN':
666 case 'IN':
667 $in_valueArray = array();
668 foreach($config['value'] as $vParts) {
669 $in_valueArray[] = (string)$vParts[0];
670 }
671 break;
672 }
673
674 foreach($itemKeys as $kk => $v) {
675 $field_value = $this->data[$table][$v][$config['field']];
676
677 // Calculate it:
678 if ($config['calc']=='&') {
679 $field_value&=intval($config['calc_value']);
680 }
681
682 // Compare it:
683 switch($comp) {
684 case '<=':
685 $bool = $field_value <= $config['value'][0];
686 break;
687 case '>=':
688 $bool = $field_value >= $config['value'][0];
689 break;
690 case '<':
691 $bool = $field_value < $config['value'][0];
692 break;
693 case '>':
694 $bool = $field_value > $config['value'][0];
695 break;
696 case '=':
697 $bool = !strcmp($field_value,$config['value'][0]);
698 break;
699 case '!=':
700 $bool = strcmp($field_value,$config['value'][0]);
701 break;
702 case 'NOTIN':
703 case 'IN':
704 $bool = in_array((string)$field_value, $in_valueArray);
705 if ($comp=='NOTIN') $bool = !$bool;
706 break;
707 case 'NOTLIKE':
708 case 'LIKE':
709 if (!strlen($like_value)) {
710 $bool = TRUE;
711 } elseif ($wildCard_begin && !$wildCard_end) {
712 $bool = !strcmp(substr(strtolower($field_value),-strlen($like_value)),$like_value);
713 } elseif (!$wildCard_begin && $wildCard_end) {
714 $bool = !strcmp(substr(strtolower($field_value),0,strlen($like_value)),$like_value);
715 } elseif ($wildCard_begin && $wildCard_end) {
716 $bool = strstr($field_value,$like_value);
717 } else {
718 $bool = !strcmp(strtolower($field_value),$like_value);
719 }
720 if ($comp=='NOTLIKE') $bool = !$bool;
721 break;
722 default:
723 $bool = $field_value ? TRUE : FALSE;
724 break;
725 }
726
727 // General negation:
728 if ($neg) $bool = !$bool;
729
730 // Modify?
731 switch($mod) {
732 case 'NOT':
733 case '!':
734 $bool = !$bool;
735 break;
736 }
737
738 // Action:
739 if (!$bool) {
740 unset($itemKeys[$kk]);
741 }
742 }
743 }
744 }
745
746 /**
747 * Returning result set based on result keys, table and field list
748 *
749 * @param array Result keys
750 * @param string Tablename
751 * @param string Fieldlist (commaseparated)
752 * @return array Result array with "rows"
753 */
754 function getResultSet($keys, $table, $fieldList) {
755 $fields = t3lib_div::trimExplode(',',$fieldList);
756
757 $output = array();
758 foreach($keys as $kValue) {
759 if ($fieldList=='*') {
760 $output[$kValue] = $this->data[$table][$kValue];
761 } else {
762 foreach($fields as $fieldName) {
763 $output[$kValue][$fieldName] = $this->data[$table][$kValue][$fieldName];
764 }
765 }
766 }
767
768 return $output;
769 }
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785 /*************************
786 *
787 * Debugging
788 *
789 *************************/
790
791 /**
792 * Returns the result set (in array) as HTML table. For debugging.
793 *
794 * @param array Result set array (array of rows)
795 * @return string HTML table
796 */
797 function debug_printResultSet($array) {
798
799 if (count($array)) {
800 $tRows=array();
801 $fields = array_keys(current($array));
802 $tCell[]='
803 <td>IDX</td>';
804 foreach($fields as $fieldName) {
805 $tCell[]='
806 <td>'.htmlspecialchars($fieldName).'</td>';
807 }
808 $tRows[]='<tr>'.implode('',$tCell).'</tr>';
809
810
811 foreach($array as $index => $rec) {
812
813 $tCell=array();
814 $tCell[]='
815 <td>'.htmlspecialchars($index).'</td>';
816 foreach($fields as $fieldName) {
817 $tCell[]='
818 <td>'.htmlspecialchars($rec[$fieldName]).'</td>';
819 }
820 $tRows[]='<tr>'.implode('',$tCell).'</tr>';
821 }
822
823 return '<table border="1">'.implode('',$tRows).'</table>';
824 } else 'Empty resultset';
825 }
826 }
827
828
829 /**
830 * PHP SQL engine, result object
831 *
832 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
833 * @package TYPO3
834 * @subpackage t3lib
835 */
836 class t3lib_sqlengine_resultobj {
837
838 // Result array, must contain the fields in the order they were selected in the SQL statement (for sql_fetch_row())
839 var $result = array();
840
841 var $TYPO3_DBAL_handlerType = '';
842 var $TYPO3_DBAL_tableList = '';
843
844 /**
845 * Constrcutor
846 */
847 function __construct() {
848 t3lib_div::deprecationLog("Class t3lib_sqlengine_resultobj is deprecated since TYPO3 4.3, will be removed in TYPO3 4.6, it has been integrated to extension DBAL.");
849 }
850
851 /**
852 * Counting number of rows
853 *
854 * @return integer
855 */
856 function sql_num_rows() {
857 return count($this->result);
858 }
859
860 /**
861 * Fetching next row in result array
862 *
863 * @return array Associative array
864 */
865 function sql_fetch_assoc() {
866 $row = current($this->result);
867 next($this->result);
868 return $row;
869 }
870
871 /**
872 * Fetching next row, numerical indices
873 *
874 * @return array Numerical array
875 */
876 function sql_fetch_row() {
877 $resultRow = $this->sql_fetch_assoc();
878
879 if (is_array($resultRow)) {
880 $numArray = array();
881 foreach($resultRow as $value) {
882 $numArray[]=$value;
883 }
884 return $numArray;
885 }
886 }
887
888 /**
889 * Seeking position in result
890 *
891 * @param integer Position pointer.
892 * @return boolean Returns true on success
893 */
894 function sql_data_seek($pointer) {
895 reset($this->result);
896 for ($a=0;$a<$pointer;$a++) {
897 next($this->result);
898 }
899 return TRUE;
900 }
901
902 /**
903 * Returning SQL field type
904 *
905 * @return string Blank string, not supported (it seems)
906 */
907 function sql_field_type() {
908 return '';
909 }
910 }
911
912
913
914 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlengine.php']) {
915 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlengine.php']);
916 }
917
918 ?>