[Solar-svn] Revision 2694
pmjones at solarphp.com
pmjones at solarphp.com
Mon Aug 13 17:47:19 CDT 2007
Branch: Solar_Sql_Adapter_Mysql:
* [FIX] Native "timestamp" type now maps to Solar "int" type (vice "integer")
* [FIX] On table column discover, all integer columns now get NULL for their size
* [CHG] Methods dropTable() and dropSequence() now use DROP TABLE IF EXISTS to avoid notices from MySQL
Modified: branches/orm/Solar/Sql/Adapter/Mysql.php
===================================================================
--- branches/orm/Solar/Sql/Adapter/Mysql.php 2007-08-13 22:45:08 UTC (rev 2693)
+++ branches/orm/Solar/Sql/Adapter/Mysql.php 2007-08-13 22:47:19 UTC (rev 2694)
@@ -76,7 +76,7 @@
// date & time
'date' => 'date',
'datetime' => 'timestamp',
- 'timestamp' => 'integer',
+ 'timestamp' => 'int',
'time' => 'time',
// string
@@ -172,6 +172,11 @@
'primary' => (bool) ($val['key'] == 'PRI'),
'autoinc' => (bool) (strpos($val['extra'], 'auto_increment') !== false),
);
+
+ // don't keep "size" for integers
+ if (substr($type, -3) == 'int') {
+ $descr[$name]['size'] = null;
+ }
}
// done!
@@ -180,6 +185,22 @@
/**
*
+ * 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
@@ -265,7 +286,7 @@
*/
protected function _dropSequence($name)
{
- return $this->query("DROP TABLE $name");
+ return $this->query("DROP TABLE IF EXISTS $name");
}
/**
More information about the Solar-svn
mailing list