Commit fd0ed478 authored by unknown's avatar unknown

Add DROP TABLE before trying to create view (in mysqldump)

Cleaned up xxxx_gis.test's and made gis_generic.inc independent of ndb
(Note that archive_gis.test fails, but this is independent of this patch)


client/mysqldump.c:
  Add DROP TABLE to be able to re-run mysqldump if it fails after 'table-named-as-view' is created
mysql-test/include/gis_generic.inc:
  Remove dependency of ndb
mysql-test/include/have_archive.inc:
  Fix syntax
mysql-test/include/have_geometry.inc:
  Fix syntax
mysql-test/r/mysqldump.result:
  New test results after adding 'drop table'
mysql-test/t/archive_gis.test:
  gis_generic tests for have_geometry.inc
mysql-test/t/bdb_gis.test:
  gis_generic tests for have_geometry.inc
mysql-test/t/innodb_gis.test:
  gis_generic tests for have_geometry.inc
mysql-test/t/ndb_gis.test:
  gis_generic tests for have_geometry.inc
sql/item_func.cc:
  Simplify code (as signal_divide_by_null sets 'null_value')
parent 84d072dc
......@@ -1460,6 +1460,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
opt_quoted_table);
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n",
opt_quoted_table);
check_io(sql_file);
}
......@@ -1471,7 +1473,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
*/
row= mysql_fetch_row(result);
fprintf(sql_file, " %s %s", quote_name(row[0], name_buff, 0), row[1]);
fprintf(sql_file, " %s %s", quote_name(row[0], name_buff, 0),
row[1]);
while((row= mysql_fetch_row(result)))
{
......
source include/have_geometry.inc;
--source include/have_ndb.inc
--source include/have_geometry.inc
#
# Spatial objects
......
-- require r/have_archive.require
disable_query_log;
--require r/have_archive.require
--disable_query_log
show variables like "have_archive";
enable_query_log;
--enable_query_log
-- require r/have_geometry.require
disable_query_log;
--require r/have_geometry.require
--disable_query_log
show variables like "have_geometry";
enable_query_log;
--enable_query_log
......@@ -1458,6 +1458,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
......@@ -1701,6 +1702,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11)
) */;
......@@ -1756,6 +1758,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30)
) */;
......@@ -1845,6 +1848,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11),
`b` int(11),
......@@ -1852,11 +1856,13 @@ DROP TABLE IF EXISTS `v1`;
) */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` int(11)
) */;
DROP TABLE IF EXISTS `v3`;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 CREATE TABLE `v3` (
`a` int(11),
`b` int(11),
......@@ -2417,6 +2423,7 @@ UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `v0`;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 CREATE TABLE `v0` (
`a` int(11),
`b` varchar(32),
......@@ -2424,6 +2431,7 @@ DROP TABLE IF EXISTS `v0`;
) */;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 CREATE TABLE `v1` (
`a` int(11),
`b` varchar(32),
......@@ -2431,6 +2439,7 @@ DROP TABLE IF EXISTS `v1`;
) */;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 CREATE TABLE `v2` (
`a` int(11),
`b` varchar(32),
......
source include/have_geometry.inc;
source include/have_archive.inc;
--source include/have_archive.inc
SET storage_engine=archive;
-- source include/gis_generic.inc
--source include/gis_generic.inc
source include/have_geometry.inc;
-- source include/have_bdb.inc
SET storage_engine=bdb;
--source include/gis_generic.inc
source include/have_geometry.inc;
-- source include/have_innodb.inc
--source include/have_innodb.inc
SET storage_engine=innodb;
--source include/gis_generic.inc
source include/have_geometry.inc;
--source include/have_ndb.inc
SET storage_engine=ndbcluster;
--source include/gis_generic.inc
......
......@@ -1386,9 +1386,9 @@ double Item_func_ln::val_real()
{
DBUG_ASSERT(fixed == 1);
double value= args[0]->val_real();
if ((null_value=args[0]->null_value))
if ((null_value= args[0]->null_value))
return 0.0;
if ((null_value= value <=0.0))
if (value <= 0.0)
{
signal_divide_by_null();
return 0.0;
......@@ -1405,9 +1405,9 @@ double Item_func_log::val_real()
{
DBUG_ASSERT(fixed == 1);
double value= args[0]->val_real();
if ((null_value=args[0]->null_value))
if ((null_value= args[0]->null_value))
return 0.0;
if ((null_value= value <=0.0))
if (value <= 0.0)
{
signal_divide_by_null();
return 0.0;
......@@ -1415,9 +1415,9 @@ double Item_func_log::val_real()
if (arg_count == 2)
{
double value2= args[1]->val_real();
if ((null_value=args[1]->null_value))
if ((null_value= args[1]->null_value))
return 0.0;
if ((null_value= value2 <=0.0) || (value == 1.0))
if (value2 <= 0.0 || value == 1.0)
{
signal_divide_by_null();
return 0.0;
......@@ -1434,7 +1434,7 @@ double Item_func_log2::val_real()
if ((null_value=args[0]->null_value))
return 0.0;
if ((null_value= value <=0.0))
if (value <= 0.0)
{
signal_divide_by_null();
return 0.0;
......@@ -1446,9 +1446,9 @@ double Item_func_log10::val_real()
{
DBUG_ASSERT(fixed == 1);
double value= args[0]->val_real();
if ((null_value=args[0]->null_value))
if ((null_value= args[0]->null_value))
return 0.0;
if ((null_value= value <=0.0))
if (value <= 0.0)
{
signal_divide_by_null();
return 0.0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment