Source for file DibiResult.php
Documentation is available at DibiResult.php
- 1: <?php
- 3: /**
- 4: * dibi - tiny'n'smart database abstraction layer
- 5: * ----------------------------------------------
- 6: *
- 11: */
- 15: /**
- 16: * dibi result set.
- 17: *
- 18: * <code>
- 19: * $result = dibi::query('SELECT * FROM [table]');
- 20: *
- 21: * $row = $result->fetch();
- 22: * $value = $result->fetchSingle();
- 23: * $table = $result->fetchAll();
- 24: * $pairs = $result->fetchPairs();
- 25: * $assoc = $result->fetchAssoc('id');
- 26: * $assoc = $result->fetchAssoc('active,#,id');
- 27: *
- 28: * unset($result);
- 29: * </code>
- 30: *
- 33: *
- 40: */
- 42: {
- 63: /**
- 66: */
- 68: {
- 73: }
- 77: }
- 78: }
- 82: /**
- 83: * Automatically frees the resources allocated for this result set.
- 85: */
- 87: {
- 89: }
- 93: /**
- 94: * Returns the result set resource.
- 96: */
- 98: {
- 100: }
- 104: /**
- 105: * Frees the resources allocated for this result set.
- 107: */
- 109: {
- 113: }
- 114: }
- 118: /**
- 119: * Safe access to property $driver.
- 122: */
- 124: {
- 127: }
- 130: }
- 134: /********************* rows ****************d*g**/
- 138: /**
- 139: * Moves cursor position without fetching row.
- 143: */
- 145: {
- 147: }
- 151: /**
- 152: * Required by the Countable interface.
- 154: */
- 156: {
- 158: }
- 162: /**
- 163: * Returns the number of rows in a result set.
- 165: */
- 167: {
- 169: }
- 173: /**
- 174: * Returns the number of rows in a result set. Alias for getRowCount().
- 176: */
- 178: {
- 180: }
- 184: /**
- 185: * Required by the IteratorAggregate interface.
- 187: */
- 189: {
- 191: trigger_error(__METHOD__ . ' arguments $offset & $limit have been dropped; use SQL clauses instead.', E_USER_WARNING);
- 192: }
- 194: }
- 198: /********************* fetching rows ****************d*g**/
- 202: /**
- 203: * Set fetched object class. This class should extend the DibiRow class.
- 206: */
- 208: {
- 211: }
- 215: /**
- 216: * Returns fetched object class name.
- 218: */
- 220: {
- 222: }
- 226: /**
- 227: * Fetches the row at current position, process optional type conversion.
- 228: * and moves the internal cursor to the next position
- 230: */
- 232: {
- 238: // types-converting?
- 243: }
- 244: }
- 245: }
- 248: }
- 252: /**
- 253: * Like fetch(), but returns only first field.
- 255: */
- 257: {
- 263: // types-converting?
- 267: }
- 270: }
- 274: /**
- 275: * Fetches all records from table.
- 279: */
- 281: {
- 295: }
- 299: /**
- 300: * Fetches all records from table and returns associative tree.
- 301: * Examples:
- 302: * - associative descriptor: col1[]col2->col3
- 303: * builds a tree: $tree[$val1][$index][$val2]->col3[$val3] = {record}
- 304: * - associative descriptor: col1|col2->col3=col4
- 305: * builds a tree: $tree[$val1][$val2]->col3[$val3] = val4
- 309: */
- 311: {
- 314: }
- 321: $assoc = preg_split('#(\[\]|->|=|\|)#', $assoc, NULL, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
- 323: // check columns
- 325: // offsetExists ignores NULL in PHP 5.2.1, isset() surprisingly NULL accepts
- 326: if ($as !== '[]' && $as !== '=' && $as !== '->' && $as !== '|' && !property_exists($row, $as)) {
- 328: }
- 329: }
- 333: }
- 337: }
- 339: // make associative tree
- 343: // iterative deepening
- 359: }
- 363: }
- 364: }
- 368: }
- 374: }
- 378: /**
- 380: */
- 382: {
- 390: // strip leading = and @
- 401: }
- 402: }
- 418: }
- 427: }
- 432: }
- 433: }
- 440: }
- 441: }
- 447: }
- 451: /**
- 452: * Fetches all records from table like $key => $value pairs.
- 457: */
- 459: {
- 469: }
- 471: // autodetect
- 479: }
- 486: }
- 493: }
- 497: }
- 498: }
- 505: }
- 509: /********************* meta info ****************d*g**/
- 513: /**
- 514: * Define column type.
- 518: */
- 520: {
- 523: }
- 527: /**
- 528: * Autodetect column types.
- 530: */
- 532: {
- 535: }
- 536: }
- 540: /**
- 541: * Define multiple columns types.
- 545: */
- 547: {
- 550: }
- 554: /**
- 540: /**
- 541: * Returns column type.
- 557: */
- 559: {
- 561: }
- 565: /**
- 566: * Converts value to specified type and format.
- 570: */
- 572: {
- 575: }
- 607: }
- 612: default:
- 614: }
- 615: }
- 619: /**
- 620: * Returns a meta information about the current result set.
- 622: */
- 624: {
- 627: }
- 629: }
- 633: /**
- 635: */
- 637: {
- 639: }
- 643: /**
- 645: */
- 647: {
- 649: }
- 653: /********************* misc tools ****************d*g**/
- 657: /**
- 658: * Displays complete result set as HTML table for debug purposes.
- 660: */
- 662: {
- 671: }
- 674: }
- 678: //if (is_object($col)) $col = $col->__toString();
- 680: }
- 683: }
- 689: }
- 690: }
- 692: }