mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
ndb - bitfields - more tests, now passes all api tests!!
ndb/include/kernel/ndb_limits.h: #define for max null bits ndb/include/kernel/signaldata/TupFrag.hpp: Error code for too many nullbits ndb/include/util/Bitmask.hpp: Cosmetic fix ndb/src/common/util/Bitmask.cpp: handle (pos % 32) == 0 more unit tests ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp: Check bitmask overflow ndb/src/ndbapi/ndberror.c: New error code ndb/test/ndbapi/testBitfield.cpp: Update test program ndb/test/run-test/daily-basic-tests.txt: Add testBitfield to autotest
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
|
||||
static const char* opt_connect_str= 0;
|
||||
static const char* _dbname = "TEST_DB";
|
||||
static int g_loops = 5;
|
||||
static int g_loops = 7;
|
||||
static struct my_option my_long_options[] =
|
||||
{
|
||||
NDB_STD_OPTS("ndb_desc"),
|
||||
@ -130,44 +130,48 @@ static
|
||||
const NdbDictionary::Table*
|
||||
create_random_table(Ndb* pNdb)
|
||||
{
|
||||
NdbDictionary::Table tab;
|
||||
Uint32 cols = 1 + (rand() % (NDB_MAX_ATTRIBUTES_IN_TABLE - 1));
|
||||
Uint32 keys = NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY;
|
||||
Uint32 length = 4096;
|
||||
Uint32 key_size = NDB_MAX_KEYSIZE_IN_WORDS;
|
||||
|
||||
BaseString name;
|
||||
name.assfmt("TAB_%d", rand() & 65535);
|
||||
tab.setName(name.c_str());
|
||||
for(int i = 0; i<cols && length > 0; i++)
|
||||
{
|
||||
NdbDictionary::Column col;
|
||||
name.assfmt("COL_%d", i);
|
||||
col.setName(name.c_str());
|
||||
if(i == 0 || i == 1)
|
||||
{
|
||||
col.setType(NdbDictionary::Column::Unsigned);
|
||||
col.setLength(1);
|
||||
col.setNullable(false);
|
||||
col.setPrimaryKey(i == 0);
|
||||
tab.addColumn(col);
|
||||
continue;
|
||||
}
|
||||
|
||||
col.setType(NdbDictionary::Column::Bit);
|
||||
do {
|
||||
NdbDictionary::Table tab;
|
||||
Uint32 cols = 1 + (rand() % (NDB_MAX_ATTRIBUTES_IN_TABLE - 1));
|
||||
Uint32 keys = NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY;
|
||||
Uint32 length = 4090;
|
||||
Uint32 key_size = NDB_MAX_KEYSIZE_IN_WORDS;
|
||||
|
||||
Uint32 len = 1 + (rand() % 128); //(length - 1));
|
||||
col.setLength(len); length -= len;
|
||||
col.setNullable((rand() >> 16) & 1);
|
||||
col.setPrimaryKey(false);
|
||||
tab.addColumn(col);
|
||||
}
|
||||
|
||||
ndbout << (NDBT_Table&)tab << endl;
|
||||
if(pNdb->getDictionary()->createTable(tab) == 0)
|
||||
{
|
||||
return pNdb->getDictionary()->getTable(tab.getName());
|
||||
}
|
||||
BaseString name;
|
||||
name.assfmt("TAB_%d", rand() & 65535);
|
||||
tab.setName(name.c_str());
|
||||
for(int i = 0; i<cols && length > 2; i++)
|
||||
{
|
||||
NdbDictionary::Column col;
|
||||
name.assfmt("COL_%d", i);
|
||||
col.setName(name.c_str());
|
||||
if(i == 0 || i == 1)
|
||||
{
|
||||
col.setType(NdbDictionary::Column::Unsigned);
|
||||
col.setLength(1);
|
||||
col.setNullable(false);
|
||||
col.setPrimaryKey(i == 0);
|
||||
tab.addColumn(col);
|
||||
continue;
|
||||
}
|
||||
|
||||
col.setType(NdbDictionary::Column::Bit);
|
||||
|
||||
Uint32 len = 1 + (rand() % (length - 1));
|
||||
col.setLength(len); length -= len;
|
||||
int nullable = (rand() >> 16) & 1;
|
||||
col.setNullable(nullable); length -= nullable;
|
||||
col.setPrimaryKey(false);
|
||||
tab.addColumn(col);
|
||||
}
|
||||
|
||||
pNdb->getDictionary()->dropTable(tab.getName());
|
||||
if(pNdb->getDictionary()->createTable(tab) == 0)
|
||||
{
|
||||
ndbout << (NDBT_Table&)tab << endl;
|
||||
return pNdb->getDictionary()->getTable(tab.getName());
|
||||
}
|
||||
} while(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user