/halogy/database/drivers/sqlite/sqlite_utility.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 141 lines · 39 code · 15 blank · 87 comment · 4 complexity · d6fee147022111b97c3d4f13f6faeae6 MD5 · raw file

  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * CodeIgniter
  4. *
  5. * An open source application development framework for PHP 4.3.2 or newer
  6. *
  7. * @package CodeIgniter
  8. * @author ExpressionEngine Dev Team
  9. * @copyright Copyright (c) 2008 - 2009, EllisLab, Inc.
  10. * @license http://codeigniter.com/user_guide/license.html
  11. * @link http://codeigniter.com
  12. * @since Version 1.0
  13. * @filesource
  14. */
  15. // ------------------------------------------------------------------------
  16. /**
  17. * SQLite Utility Class
  18. *
  19. * @category Database
  20. * @author ExpressionEngine Dev Team
  21. * @link http://codeigniter.com/user_guide/database/
  22. */
  23. class CI_DB_sqlite_utility extends CI_DB_utility {
  24. /**
  25. * List databases
  26. *
  27. * I don't believe you can do a database listing with SQLite
  28. * since each database is its own file. I suppose we could
  29. * try reading a directory looking for SQLite files, but
  30. * that doesn't seem like a terribly good idea
  31. *
  32. * @access private
  33. * @return bool
  34. */
  35. function _list_databases()
  36. {
  37. if ($this->db_debug)
  38. {
  39. return $this->display_error('db_unsuported_feature');
  40. }
  41. return array();
  42. }
  43. // --------------------------------------------------------------------
  44. /**
  45. * Optimize table query
  46. *
  47. * Is optimization even supported in SQLite?
  48. *
  49. * @access private
  50. * @param string the table name
  51. * @return object
  52. */
  53. function _optimize_table($table)
  54. {
  55. return FALSE;
  56. }
  57. // --------------------------------------------------------------------
  58. /**
  59. * Repair table query
  60. *
  61. * Are table repairs even supported in SQLite?
  62. *
  63. * @access private
  64. * @param string the table name
  65. * @return object
  66. */
  67. function _repair_table($table)
  68. {
  69. return FALSE;
  70. }
  71. // --------------------------------------------------------------------
  72. /**
  73. * SQLite Export
  74. *
  75. * @access private
  76. * @param array Preferences
  77. * @return mixed
  78. */
  79. function _backup($params = array())
  80. {
  81. // Currently unsupported
  82. return $this->db->display_error('db_unsuported_feature');
  83. }
  84. /**
  85. *
  86. * The functions below have been deprecated as of 1.6, and are only here for backwards
  87. * compatibility. They now reside in dbforge(). The use of dbutils for database manipulation
  88. * is STRONGLY discouraged in favour if using dbforge.
  89. *
  90. */
  91. /**
  92. * Create database
  93. *
  94. * @access public
  95. * @param string the database name
  96. * @return bool
  97. */
  98. function _create_database()
  99. {
  100. // In SQLite, a database is created when you connect to the database.
  101. // We'll return TRUE so that an error isn't generated
  102. return TRUE;
  103. }
  104. // --------------------------------------------------------------------
  105. /**
  106. * Drop database
  107. *
  108. * @access private
  109. * @param string the database name
  110. * @return bool
  111. */
  112. function _drop_database($name)
  113. {
  114. if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
  115. {
  116. if ($this->db->db_debug)
  117. {
  118. return $this->db->display_error('db_unable_to_drop');
  119. }
  120. return FALSE;
  121. }
  122. return TRUE;
  123. }
  124. }
  125. /* End of file sqlite_utility.php */
  126. /* Location: ./system/database/drivers/sqlite/sqlite_utility.php */