Source for file DibiConnection.php
Documentation is available at DibiConnection.php
- 1: <?php
- 3: /**
- 4: * dibi - tiny'n'smart database abstraction layer
- 5: * ----------------------------------------------
- 6: *
- 11: */
- 15: /**
- 16: * dibi connection.
- 17: *
- 20: *
- 28: */
- 30: {
- 48: /**
- 49: * Connection options: (see driver-specific options too)
- 50: * - lazy (bool) => if TRUE, connection will be established only when required
- 51: * - result (array) => result set options
- 52: * - detectTypes (bool) => detect the types of result set fields?
- 53: * - formatDateTime => date-time format (if empty, DateTime objects will be returned)
- 54: * - profiler (array or bool)
- 55: * - run (bool) => enable profiler?
- 56: * - class => profiler class name (default is DibiProfiler)
- 57: * - substitutes (array) => map of driver specific substitutes (under development)
- 62: */
- 64: {
- 65: // DSN string
- 73: }
- 78: }
- 88: }
- 97: }
- 98: }
- 105: // profiler
- 112: }
- 118: }
- 120: }
- 125: }
- 126: }
- 130: }
- 131: }
- 135: /**
- 136: * Automatically frees the resources allocated for this result set.
- 138: */
- 140: {
- 141: // disconnects and rolls back transaction - do not rely on auto-disconnect and rollback!
- 143: }
- 147: /**
- 148: * Connects to a database.
- 150: */
- 152: {
- 155: }
- 160: }
- 161: }
- 165: /**
- 166: * Disconnects from a database.
- 168: */
- 170: {
- 173: }
- 177: /**
- 178: * Returns TRUE when connection was established.
- 180: */
- 182: {
- 184: }
- 188: /**
- 189: * Returns configuration variable. If no $key is passed, returns the entire array.
- 194: */
- 196: {
- 205: }
- 206: }
- 210: /**
- 211: * Apply configuration alias or default values.
- 216: */
- 218: {
- 225: }
- 226: }
- 230: /**
- 231: * Returns the driver and connects to a database in lazy mode.
- 233: */
- 235: {
- 238: }
- 242: /**
- 243: * Generates (translates) and executes SQL query.
- 247: */
- 249: {
- 253: }
- 257: /**
- 258: * Generates and returns SQL query.
- 262: */
- 264: {
- 268: }
- 274: {
- 279: }
- 283: /**
- 284: * Generates and prints SQL query.
- 287: */
- 289: {
- 299: }
- 300: }
- 304: /**
- 305: * Generates (translates) and returns SQL query as DibiDataSource.
- 309: */
- 311: {
- 315: }
- 319: /**
- 320: * Executes the SQL query.
- 324: */
- 326: {
- 337: }
- 339: }
- 346: }
- 350: }
- 352: }
- 356: /**
- 357: * Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
- 358: * @return int number of rows
- 359: * @throws DibiException
- 360: */
- 362: {
- 365: if (!is_int($rows) || $rows < 0) throw new DibiException('Cannot retrieve number of affected rows.');
- 367: }
- 371: /**
- 372: * Gets the number of affected rows. Alias for getAffectedRows().
- 373: * @return int number of rows
- 374: * @throws DibiException
- 375: */
- 377: {
- 379: }
- 383: /**
- 384: * Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
- 385: * @param string optional sequence name
- 386: * @return int
- 387: * @throws DibiException
- 388: */
- 390: {
- 395: }
- 399: /**
- 400: * Retrieves the ID generated for an AUTO_INCREMENT column. Alias for getInsertId().
- 401: * @param string optional sequence name
- 402: * @return int
- 403: * @throws DibiException
- 404: */
- 406: {
- 408: }
- 412: /**
- 413: * Begins a transaction (if supported).
- 414: * @param string optional savepoint name
- 415: * @return void
- 416: */
- 418: {
- 422: }
- 426: }
- 427: }
- 431: /**
- 432: * Commits statements in a transaction.
- 433: * @param string optional savepoint name
- 434: * @return void
- 435: */
- 437: {
- 441: }
- 445: }
- 446: }
- 450: /**
- 451: * Rollback changes in a transaction.
- 452: * @param string optional savepoint name
- 453: * @return void
- 454: */
- 456: {
- 460: }
- 464: }
- 465: }
- 469: /********************* fluent SQL builders ****************d*g**/
- 473: /**
- 474: * @return DibiFluent
- 475: */
- 477: {
- 479: }
- 483: /**
- 484: * @param string column name
- 485: * @return DibiFluent
- 486: */
- 488: {
- 491: }
- 495: /**
- 496: * @param string table
- 497: * @param array
- 498: * @return DibiFluent
- 499: */
- 501: {
- 504: }
- 506: }
- 510: /**
- 511: * @param string table
- 512: * @param array
- 513: * @return DibiFluent
- 514: */
- 516: {
- 521: }
- 524: }
- 528: /**
- 529: * @param string table
- 530: * @return DibiFluent
- 531: */
- 533: {
- 535: }
- 539: /********************* profiler ****************d*g**/
- 543: /**
- 544: * @param IDibiProfiler
- 545: * @return DibiConnection provides a fluent interface
- 546: */
- 548: {
- 551: }
- 555: /**
- 556: * @return IDibiProfiler
- 557: */
- 559: {
- 561: }
- 565: /********************* shortcuts ****************d*g**/
- 569: /**
- 570: * Executes SQL query and fetch result - shortcut for query() & fetch().
- 571: * @param array|mixed one or more arguments
- 572: * @return DibiRow
- 573: * @throws DibiException
- 574: */
- 576: {
- 579: }
- 583: /**
- 584: * Executes SQL query and fetch results - shortcut for query() & fetchAll().
- 585: * @param array|mixed one or more arguments
- 586: * @return array of DibiRow
- 587: * @throws DibiException
- 588: */
- 590: {
- 593: }
- 597: /**
- 598: * Executes SQL query and fetch first column - shortcut for query() & fetchSingle().
- 599: * @param array|mixed one or more arguments
- 600: * @return string
- 601: * @throws DibiException
- 602: */
- 604: {
- 607: }
- 611: /**
- 612: * Executes SQL query and fetch pairs - shortcut for query() & fetchPairs().
- 613: * @param array|mixed one or more arguments
- 614: * @return string
- 615: * @throws DibiException
- 616: */
- 618: {
- 621: }
- 625: /********************* misc ****************d*g**/
- 629: /**
- 630: * Import SQL dump from file - extreme fast!
- 631: * @param string filename
- 632: * @return int count of sql commands
- 633: */
- 635: {
- 642: }
- 653: }
- 654: }
- 657: }
- 661: /**
- 662: * Gets a information about the current database.
- 663: * @return DibiDatabaseInfo
- 664: */
- 666: {
- 668: return new DibiDatabaseInfo($this->driver->getReflector(), isset($this->config['database']) ? $this->config['database'] : NULL);
- 669: }
- 673: /**
- 674: * Prevents unserialization.
- 675: */
- 677: {
- 678: throw new NotSupportedException('You cannot serialize or unserialize ' . $this->getClass() . ' instances.');
- 679: }
- 683: /**
- 684: * Prevents serialization.
- 685: */
- 687: {
- 688: throw new NotSupportedException('You cannot serialize or unserialize ' . $this->getClass() . ' instances.');
- 689: }
- 691: }