[Solar-svn] Revision 2716
pmjones at solarphp.com
pmjones at solarphp.com
Thu Aug 16 15:02:49 CDT 2007
Branch: Solar_Sql_Adapter*: [CHG] Recent versions of Mysql, Sqlite, and Pgsql all support DROP TABLE IF EXISTS, so that's the dropTable() command now. Also, Pgsql supports DROP SEQUENCE IF EXISTS, so using that now too. These changes are to suppress warnings when the entity doesn't exist.
Modified: branches/orm/Solar/Sql/Adapter/Mysql.php
===================================================================
--- branches/orm/Solar/Sql/Adapter/Mysql.php 2007-08-16 19:16:41 UTC (rev 2715)
+++ branches/orm/Solar/Sql/Adapter/Mysql.php 2007-08-16 20:02:49 UTC (rev 2716)
@@ -185,22 +185,6 @@
/**
*
- * Drops a table from the database.
- *
- * For MySQL, this is a "DROP TABLE IF EXISTS" command.
- *
- * @param string $table The table name.
- *
- * @return mixed
- *
- */
- public function dropTable($table)
- {
- return $this->query("DROP TABLE IF EXISTS $table");
- }
-
- /**
- *
* Given a native column SQL default value, finds a PHP literal value.
*
* SQL NULLs are converted to PHP nulls. Non-literal values (such as
Modified: branches/orm/Solar/Sql/Adapter/Pgsql.php
===================================================================
--- branches/orm/Solar/Sql/Adapter/Pgsql.php 2007-08-16 19:16:41 UTC (rev 2715)
+++ branches/orm/Solar/Sql/Adapter/Pgsql.php 2007-08-16 20:02:49 UTC (rev 2716)
@@ -276,7 +276,7 @@
*/
protected function _dropSequence($name)
{
- return $this->query("DROP SEQUENCE $name");
+ return $this->query("DROP SEQUENCE IF EXISTS $name");
}
/**
Modified: branches/orm/Solar/Sql/Adapter/Sqlite.php
===================================================================
--- branches/orm/Solar/Sql/Adapter/Sqlite.php 2007-08-16 19:16:41 UTC (rev 2715)
+++ branches/orm/Solar/Sql/Adapter/Sqlite.php 2007-08-16 20:02:49 UTC (rev 2716)
@@ -259,7 +259,7 @@
*/
protected function _dropSequence($name)
{
- return $this->query("DROP TABLE $name");
+ return $this->query("DROP TABLE IF EXISTS $name");
}
/**
Modified: branches/orm/Solar/Sql/Adapter.php
===================================================================
--- branches/orm/Solar/Sql/Adapter.php 2007-08-16 19:16:41 UTC (rev 2715)
+++ branches/orm/Solar/Sql/Adapter.php 2007-08-16 20:02:49 UTC (rev 2716)
@@ -1435,7 +1435,7 @@
/**
*
- * Drops a table from the database.
+ * Drops a table from the database, if it exists.
*
* @param string $table The table name.
*
@@ -1444,7 +1444,7 @@
*/
public function dropTable($table)
{
- return $this->query("DROP TABLE $table");
+ return $this->query("DROP TABLE IF EXISTS $table");
}
/**
More information about the Solar-svn
mailing list