xpdodriver.class.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * Copyright 2010-2015 by MODX, LLC.
  4. *
  5. * This file is part of xPDO.
  6. *
  7. * xPDO is free software; you can redistribute it and/or modify it under the
  8. * terms of the GNU General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option) any later
  10. * version.
  11. *
  12. * xPDO is distributed in the hope that it will be useful, but WITHOUT ANY
  13. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  14. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * xPDO; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  18. * Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. /**
  21. * The sqlite implementation of the xPDODriver class.
  22. *
  23. * @package xpdo
  24. * @subpackage om.sqlite
  25. */
  26. /**
  27. * Include the parent {@link xPDODriver} class.
  28. */
  29. require_once (dirname(__DIR__) . '/xpdodriver.class.php');
  30. /**
  31. * Provides sqlite driver abstraction for an xPDO instance.
  32. *
  33. * This is baseline metadata and methods used throughout the framework. xPDODriver
  34. * class implementations are specific to a PDO driver and this instance is
  35. * implemented for sqlite.
  36. *
  37. * @package xpdo
  38. * @subpackage om.sqlite
  39. */
  40. class xPDODriver_sqlite extends xPDODriver {
  41. public $quoteChar = "'";
  42. public $escapeOpenChar = '"';
  43. public $escapeCloseChar = '"';
  44. public $_currentTimestamps= array(
  45. "CURRENT_TIMESTAMP"
  46. );
  47. public $_currentDates= array(
  48. "CURRENT_DATE"
  49. );
  50. public $_currentTimes= array(
  51. "CURRENT_TIME"
  52. );
  53. /**
  54. * Get a sqlite xPDODriver instance.
  55. *
  56. * @param xPDO &$xpdo A reference to a specific xPDO instance.
  57. */
  58. function __construct(xPDO &$xpdo) {
  59. parent :: __construct($xpdo);
  60. $this->dbtypes['integer']= array('/INT/i');
  61. $this->dbtypes['string']= array('/CHAR/i','/CLOB/i','/TEXT/i', '/ENUM/i');
  62. $this->dbtypes['float']= array('/REAL/i','/FLOA/i','/DOUB/i');
  63. $this->dbtypes['datetime']= array('/TIMESTAMP/i','/DATE/i');
  64. $this->dbtypes['binary']= array('/BLOB/i');
  65. }
  66. }