mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
4c798b42d3
mysql-test/include/have_ndb_extra.inc: New BitKeeper file ``mysql-test/include/have_ndb_extra.inc'' mysql-test/include/not_ndb.inc: New BitKeeper file ``mysql-test/include/not_ndb.inc'' mysql-test/r/have_ndb_extra.require: New BitKeeper file ``mysql-test/r/have_ndb_extra.require'' mysql-test/r/ndb_alter_table_row.result: New BitKeeper file ``mysql-test/r/ndb_alter_table_row.result'' mysql-test/r/ndb_alter_table_stm.result: New BitKeeper file ``mysql-test/r/ndb_alter_table_stm.result'' mysql-test/r/ndb_binlog_basic.result: New BitKeeper file ``mysql-test/r/ndb_binlog_basic.result'' mysql-test/r/ndb_binlog_multi.result: New BitKeeper file ``mysql-test/r/ndb_binlog_multi.result'' mysql-test/r/ndb_multi_row.result: New BitKeeper file ``mysql-test/r/ndb_multi_row.result'' mysql-test/r/not_ndb.require: New BitKeeper file ``mysql-test/r/not_ndb.require'' mysql-test/r/rpl_ndb_bank.result: New BitKeeper file ``mysql-test/r/rpl_ndb_bank.result'' mysql-test/r/rpl_ndb_basic.result: New BitKeeper file ``mysql-test/r/rpl_ndb_basic.result'' mysql-test/r/rpl_ndb_disk.result: New BitKeeper file ``mysql-test/r/rpl_ndb_disk.result'' mysql-test/r/rpl_ndb_idempotent.result: New BitKeeper file ``mysql-test/r/rpl_ndb_idempotent.result'' mysql-test/r/rpl_ndb_load.result: New BitKeeper file ``mysql-test/r/rpl_ndb_load.result'' mysql-test/r/rpl_ndb_multi.result: New BitKeeper file ``mysql-test/r/rpl_ndb_multi.result'' mysql-test/r/rpl_ndb_sync.result: New BitKeeper file ``mysql-test/r/rpl_ndb_sync.result'' mysql-test/r/rpl_row_basic_7ndb.result: New BitKeeper file ``mysql-test/r/rpl_row_basic_7ndb.result'' mysql-test/t/ndb_alter_table_row.test: New BitKeeper file ``mysql-test/t/ndb_alter_table_row.test'' mysql-test/t/ndb_alter_table_stm.test: New BitKeeper file ``mysql-test/t/ndb_alter_table_stm.test'' mysql-test/t/ndb_binlog_basic.test: New BitKeeper file ``mysql-test/t/ndb_binlog_basic.test'' mysql-test/t/ndb_binlog_multi.test: New BitKeeper file ``mysql-test/t/ndb_binlog_multi.test'' mysql-test/t/ndb_multi_row.test: New BitKeeper file ``mysql-test/t/ndb_multi_row.test'' mysql-test/t/rpl_ndb_bank.test: New BitKeeper file ``mysql-test/t/rpl_ndb_bank.test'' mysql-test/t/rpl_ndb_basic.test: New BitKeeper file ``mysql-test/t/rpl_ndb_basic.test'' mysql-test/t/rpl_ndb_disk.test: New BitKeeper file ``mysql-test/t/rpl_ndb_disk.test'' mysql-test/t/rpl_ndb_idempotent.test: New BitKeeper file ``mysql-test/t/rpl_ndb_idempotent.test'' mysql-test/t/rpl_ndb_load.test: New BitKeeper file ``mysql-test/t/rpl_ndb_load.test'' mysql-test/t/rpl_ndb_multi.test: New BitKeeper file ``mysql-test/t/rpl_ndb_multi.test'' mysql-test/t/rpl_ndb_sync.test: New BitKeeper file ``mysql-test/t/rpl_ndb_sync.test'' mysql-test/t/rpl_row_basic_7ndb.test: New BitKeeper file ``mysql-test/t/rpl_row_basic_7ndb.test'' sql/ha_ndbcluster_binlog.cc: New BitKeeper file ``sql/ha_ndbcluster_binlog.cc'' sql/ha_ndbcluster_binlog.h: New BitKeeper file ``sql/ha_ndbcluster_binlog.h'' sql/ha_ndbcluster_tables.h: New BitKeeper file ``sql/ha_ndbcluster_tables.h'' sql/rpl_injector.cc: New BitKeeper file ``sql/rpl_injector.cc'' sql/rpl_injector.h: New BitKeeper file ``sql/rpl_injector.h'' storage/ndb/include/kernel/signaldata/DihFragCount.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DihFragCount.hpp''
117 lines
3.8 KiB
C++
117 lines
3.8 KiB
C++
/* Copyright (C) 2003 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#include "consumer.hpp"
|
|
|
|
const char *Ndb_apply_table= NDB_APPLY_TABLE;
|
|
|
|
#ifdef USE_MYSQL
|
|
int
|
|
BackupConsumer::create_table_string(const TableS & table,
|
|
char * tableName,
|
|
char *buf){
|
|
int pos = 0;
|
|
int pos2 = 0;
|
|
char buf2[2048];
|
|
|
|
pos += sprintf(buf+pos, "%s%s", "CREATE TABLE ", tableName);
|
|
pos += sprintf(buf+pos, "%s", "(");
|
|
pos2 += sprintf(buf2+pos2, "%s", " primary key(");
|
|
|
|
for (int j = 0; j < table.getNoOfAttributes(); j++)
|
|
{
|
|
const AttributeDesc * desc = table[j];
|
|
// ndbout << desc->name << ": ";
|
|
pos += sprintf(buf+pos, "%s%s", desc->m_column->getName()," ");
|
|
switch(desc->m_column->getType()){
|
|
case NdbDictionary::Column::Int:
|
|
pos += sprintf(buf+pos, "%s", "int");
|
|
break;
|
|
case NdbDictionary::Column::Unsigned:
|
|
pos += sprintf(buf+pos, "%s", "int unsigned");
|
|
break;
|
|
case NdbDictionary::Column::Float:
|
|
pos += sprintf(buf+pos, "%s", "float");
|
|
break;
|
|
case NdbDictionary::Column::Olddecimal:
|
|
case NdbDictionary::Column::Decimal:
|
|
pos += sprintf(buf+pos, "%s", "decimal");
|
|
break;
|
|
case NdbDictionary::Column::Olddecimalunsigned:
|
|
case NdbDictionary::Column::Decimalunsigned:
|
|
pos += sprintf(buf+pos, "%s", "decimal unsigned");
|
|
break;
|
|
case NdbDictionary::Column::Char:
|
|
pos += sprintf(buf+pos, "%s", "char");
|
|
break;
|
|
case NdbDictionary::Column::Varchar:
|
|
pos += sprintf(buf+pos, "%s", "varchar");
|
|
break;
|
|
case NdbDictionary::Column::Binary:
|
|
pos += sprintf(buf+pos, "%s", "binary");
|
|
break;
|
|
case NdbDictionary::Column::Varbinary:
|
|
pos += sprintf(buf+pos, "%s", "varchar binary");
|
|
break;
|
|
case NdbDictionary::Column::Bigint:
|
|
pos += sprintf(buf+pos, "%s", "bigint");
|
|
break;
|
|
case NdbDictionary::Column::Bigunsigned:
|
|
pos += sprintf(buf+pos, "%s", "bigint unsigned");
|
|
break;
|
|
case NdbDictionary::Column::Double:
|
|
pos += sprintf(buf+pos, "%s", "double");
|
|
break;
|
|
case NdbDictionary::Column::Datetime:
|
|
pos += sprintf(buf+pos, "%s", "datetime");
|
|
break;
|
|
case NdbDictionary::Column::Date:
|
|
pos += sprintf(buf+pos, "%s", "date");
|
|
break;
|
|
case NdbDictionary::Column::Time:
|
|
pos += sprintf(buf+pos, "%s", "time");
|
|
break;
|
|
case NdbDictionary::Column::Undefined:
|
|
// pos += sprintf(buf+pos, "%s", "varchar binary");
|
|
return -1;
|
|
break;
|
|
default:
|
|
//pos += sprintf(buf+pos, "%s", "varchar binary");
|
|
return -1;
|
|
}
|
|
if (desc->arraySize > 1) {
|
|
int attrSize = desc->arraySize;
|
|
pos += sprintf(buf+pos, "%s%u%s",
|
|
"(",
|
|
attrSize,
|
|
")");
|
|
}
|
|
if (desc->m_column->getPrimaryKey()) {
|
|
pos += sprintf(buf+pos, "%s", " not null");
|
|
pos2 += sprintf(buf2+pos2, "%s%s", desc->m_column->getName(), ",");
|
|
}
|
|
pos += sprintf(buf+pos, "%s", ",");
|
|
} // for
|
|
pos2--; // remove trailing comma
|
|
pos2 += sprintf(buf2+pos2, "%s", ")");
|
|
// pos--; // remove trailing comma
|
|
|
|
pos += sprintf(buf+pos, "%s", buf2);
|
|
pos += sprintf(buf+pos, "%s", ") type=ndbcluster");
|
|
return 0;
|
|
}
|
|
|
|
#endif // USE_MYSQL
|