[Solar-svn] Revision 3214
pmjones at solarphp.com
pmjones at solarphp.com
Tue Jun 10 19:29:35 CDT 2008
Solar_Sql_Adapter_Sqlite2: [FIX] SQLite2 does not recognize 'DROP TABLE IF EXISTS', so do a 'manual' check to see if the table exists, then drop it.
Modified: trunk/Solar/Sql/Adapter/Sqlite2.php
===================================================================
--- trunk/Solar/Sql/Adapter/Sqlite2.php 2008-06-10 16:17:35 UTC (rev 3213)
+++ trunk/Solar/Sql/Adapter/Sqlite2.php 2008-06-11 00:29:35 UTC (rev 3214)
@@ -24,4 +24,28 @@
*
*/
protected $_pdo_type = 'sqlite2';
+
+ /**
+ *
+ * Drops a table from the database, if it exists.
+ *
+ * @param string $table The table name.
+ *
+ * @return mixed
+ *
+ */
+ public function dropTable($table)
+ {
+ // get a fresh list of tables
+ $this->_cache->deleteAll();
+ $list = $this->fetchTableList();
+
+ // does the table exist?
+ if (in_array($table, $list)) {
+ // kill the cache again, then drop the table
+ $this->_cache->deleteAll();
+ $table = $this->quoteName($table);
+ return $this->query("DROP TABLE $table");
+ }
+ }
}
\ No newline at end of file
More information about the Solar-svn
mailing list