Commit 85c7ff20 authored by yiwenshao's avatar yiwenshao

base version of debug/try_create.cc

parent 5897071d
CREATE TABLE child (id decimal)
create table table_UZWOBTPSXI (XBLMNJDKAGoPLAIN DECIMAL(11)) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id tinyint)
create table table_MKKYPGKZYU (UFTALGKMKNoEq BIGINT unsigned, IWYVUPDHOBoOrder BIGINT unsigned, DNWCZFPUTMoADD VARBINARY(256), cdb_saltZVXKJKTMVV BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id mediumint)
create table table_OAXOVUDBBT (JVSCHIGAKWoEq BIGINT unsigned, CAXBOUVTVYoOrder VARBINARY(32), OYEWZPHHMLoADD VARBINARY(256), cdb_saltCGIBIJGXDC BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id smallint)
create table table_FUACVRXTKU (SOBAUESJNKoEq BIGINT unsigned, JSEMVBDUUPoOrder BIGINT unsigned, OOQJOQEDZHoADD VARBINARY(256), cdb_saltRBSYZTPHDD BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id int)
create table table_XPXDBUFEOB (ARYYDTSTHXoEq BIGINT unsigned, YGMVMNQRTGoOrder VARBINARY(32), SPLKDZPJUYoADD VARBINARY(256), cdb_saltVFPMODESIF BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id bigint)
create table table_LNXYIJNACJ (UEMLSIFZWSoEq BIGINT unsigned, QJFNJPWZSYoOrder BIGINT unsigned, IBUKXDPTZFoADD VARBINARY(256), cdb_saltJWAUGFWWQQ BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (name varchar(100))
create table table_FWNMLYDJXX (NFFAEPHMCQoEq VARBINARY(144), RJMGXAFAJCoOrder VARBINARY(32), cdb_saltJFYERYJGTK BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (name varchar(1000))
create table table_UXZBAFQJTS (BASLZTMXDWoEq VARBINARY(1040), RXWQYYYOHRoOrder VARBINARY(32), cdb_saltZLBORYOWAZ BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (name varchar(10000))
create table table_KVMFINAVNE (MDEROBNCOJoEq VARBINARY(10048), QYFEFNSGKFoOrder VARBINARY(32), cdb_saltTEDPXCNVSX BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id decimal)
create table table_QQROWEUONI (IHYESFGSFPoPLAIN DECIMAL(11)) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id tinyint)
create table table_PGOMAQCGEB (RASZWEGVKZoEq BIGINT unsigned, IBHYOIOQQVoOrder BIGINT unsigned, SCIFQDIHFIoADD VARBINARY(256), cdb_saltMNLMTDRCXW BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id mediumint)
create table table_HMRPLFXZYP (PVQYVRFYXJoEq BIGINT unsigned, OFVIUGPTINoOrder VARBINARY(32), IEFBLCKVKCoADD VARBINARY(256), cdb_saltWSRGXJKHQP BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id smallint)
create table table_PJYLTURJPZ (QCUQFVMBCHoEq BIGINT unsigned, VTTTEMQYVFoOrder BIGINT unsigned, ZSFFWHYEUMoADD VARBINARY(256), cdb_saltWXGCARGMOS BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id int)
create table table_WTOROSEEQZ (IXJZSLWICWoEq BIGINT unsigned, FBRTSFNYMEoOrder VARBINARY(32), YYWTRTLRPLoADD VARBINARY(256), cdb_saltMQTRXRYWYU BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (id bigint)
create table table_VRQMKKUYJI (AGNKDOMOOZoEq BIGINT unsigned, DJQVYDFSDQoOrder BIGINT unsigned, AHZIJEJGTBoADD VARBINARY(256), cdb_saltEJIACZVPQL BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (name varchar(100))
create table table_SESKBQPHKS (HMSPTZCOSEoEq VARBINARY(144), ZMKTWMMOVWoOrder VARBINARY(32), cdb_saltZMBZWMDFTY BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (name varchar(1000))
create table table_XUCRLVSNLK (ORJZBFIADVoEq VARBINARY(1040), PCRRUCOOSZoOrder VARBINARY(32), cdb_saltTKYEDXSRLN BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
CREATE TABLE child (name varchar(10000))
create table table_AYDKZGPIGU (DKHPKCGIOQoEq VARBINARY(10048), SQPVAOBRWIoOrder VARBINARY(32), cdb_saltDWXVNTZEHT BIGINT(8) unsigned) AUTO_INCREMENT=0 ENGINE=InnoDB
...@@ -16,10 +16,51 @@ To make this work properly, you should at least make sure that the database tdb ...@@ -16,10 +16,51 @@ To make this work properly, you should at least make sure that the database tdb
static std::string embeddedDir="/t/cryt/shadow"; static std::string embeddedDir="/t/cryt/shadow";
static void myRewriteAndUpdate(Analysis &a, LEX *lex, std::string db,std::string table){ static
AbstractQueryExecutor *
myRewriteAndUpdate(Analysis &a, LEX *lex, std::string db,std::string table){
assert(a.deltas.size() == 0);
TEST_DatabaseDiscrepancy(db, a.getDatabaseName());
LEX *const new_lex = copyWithTHD(lex);
if (false == a.tableMetaExists(db, table)){
std::unique_ptr<TableMeta> tm(new TableMeta(true, true));
TEST_Text(1 == new_lex->select_lex.table_list.elements,
"we do not support multiple tables in a CREATE"
" TABLE queries");
// Take the table name straight from 'tm' as
// Analysis::getAnonTableName relies on SchemaInfo.
TABLE_LIST *const tbl =
rewrite_table_list(new_lex->select_lex.table_list.first,
tm->getAnonTableName());
//new table_list only contain one element
new_lex->select_lex.table_list =
*oneElemListWithTHD<TABLE_LIST>(tbl);
// collect the keys (and their types) as they may affect the onion
// layout we use
const auto &key_data = collectKeyData(*lex);
auto it =
List_iterator<Create_field>(lex->alter_info.create_list);
new_lex->alter_info.create_list =
accumList<Create_field>(it,
[&a, &tm, &key_data] (List<Create_field> out_list,
Create_field *const cf) {
return createAndRewriteField(a, cf, tm.get(),
true, key_data, out_list);
});
// -----------------------------
// Rewrite INDEX
// -----------------------------
highLevelRewriteKey(*tm.get(), *lex, new_lex, a);
a.deltas.push_back(std::unique_ptr<Delta>(
new CreateDelta(std::move(tm),
a.getDatabaseMeta(db),
IdentityMetaKey(table))));
}else{
std::cout<<"error"<<std::endl;
return NULL;
}
return new DDLQueryExecutor(*new_lex, std::move(a.deltas));
} }
...@@ -39,7 +80,8 @@ static void testCreateTableHandler(std::string query){ ...@@ -39,7 +80,8 @@ static void testCreateTableHandler(std::string query){
//load all metadata and then store it in schema //load all metadata and then store it in schema
loadChildren(schema.get()); loadChildren(schema.get());
const std::unique_ptr<AES_KEY> &TK = std::unique_ptr<AES_KEY>(getKey(std::string("113341234"))); const std::unique_ptr<AES_KEY> &TK =
std::unique_ptr<AES_KEY>(getKey(std::string("113341234")));
//just like what we do in Rewrite::rewrite,dispatchOnLex //just like what we do in Rewrite::rewrite,dispatchOnLex
Analysis analysis(std::string("tdb"),*schema,TK, Analysis analysis(std::string("tdb"),*schema,TK,
...@@ -48,14 +90,14 @@ static void testCreateTableHandler(std::string query){ ...@@ -48,14 +90,14 @@ static void testCreateTableHandler(std::string query){
assert(analysis.getMasterKey().get()!=NULL); assert(analysis.getMasterKey().get()!=NULL);
assert(getKey(std::string("113341234"))!=NULL); assert(getKey(std::string("113341234"))!=NULL);
//test_Analysis(analysis); //test_Analysis(analysis);
DDLHandler *h = new CreateTableHandler(); // DDLHandler *h = new CreateTableHandler();
std::unique_ptr<query_parse> p; std::unique_ptr<query_parse> p;
p = std::unique_ptr<query_parse>( p = std::unique_ptr<query_parse>(
new query_parse("tdb", query)); new query_parse("tdb", query));
LEX *const lex = p->lex(); LEX *const lex = p->lex();
myRewriteAndUpdate(analysis,lex,"tdb","student"); auto executor = myRewriteAndUpdate(analysis,lex,"tdb","child");
auto executor = h->transformLex(analysis,lex); // auto executor = h->transformLex(analysis,lex);
std::cout<< ((DDLQueryExecutor*)executor)->new_query<<std::endl; std::cout<< ((DDLQueryExecutor*)executor)->new_query<<std::endl;
} }
......
#comments
[onions for num]
oDET: DETJOIN DET RND
oOPE: OPE RND
oHOM: HOM
oASHE: ASHE
[end]
[onions for str]
oDET: DETJOIN DET RND
oOPE: OPE RND
oSWP: SEARCH
[end]
/* table_BARVVQXXXG */
CREATE TABLE `table_BARVVQXXXG` (
`HNSEGFOWDWoEq` bigint(20) unsigned DEFAULT NULL,
`PEWGZUYZRWoOrder` varbinary(32) DEFAULT NULL,
`FETULHJOAZoADD` varbinary(256) DEFAULT NULL,
`cdb_saltLVMFMPASNF` bigint(8) unsigned DEFAULT NULL,
`XFAWMBQMAJoEq` varbinary(48) DEFAULT NULL,
`IIPECDLNRLoOrder` varbinary(32) DEFAULT NULL,
`MKSYYFSQHJoSWP` blob,
`cdb_saltTHMLLSSBQV` bigint(8) unsigned DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
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