本文整理汇总了C++中createTable函数的典型用法代码示例。如果您正苦于以下问题:C++ createTable函数的具体用法?C++ createTable怎么用?C++ createTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createTable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: procTables
void procTables(QDomNode start, QTextStream &outstrm)
{
QString tableName;
tableName = start.toElement().attribute("name");
//qDebug() << "Creating table:" + tableName;
QDomNode node = start.firstChild();
QList<QDomNode> fields;
bool proc;
proc = false;
while (!node.isNull())
{
if (node.toElement().tagName() == "field")
fields.append(node);
if (node.toElement().tagName() == "table")
{
if (proc == false)
{
createTable(tableName,fields,outstrm); //Create the current table
fields.clear(); //Clear the fields
proc = true;
}
procTables(node,outstrm); //Recursive process the subtable
}
node = node.nextSibling();
}
if (fields.count() > 0)
{
createTable(tableName,fields,outstrm);
}
}
开发者ID:PIUSXIIWILSON,项目名称:odktools,代码行数:30,代码来源:main.cpp
示例2: perror
Organizer::Organizer()
{
if (!createDB())
{
perror("Open DB");
exit(errno);
}
createTable("CREATE TABLE fic(size integer,path varchar(1000) UNIQUE, md5 varchar(16));");
createTable("CREATE TABLE dir(empty bool,path varchar(1000) UNIQUE, modif datetime);");
}
开发者ID:relefebvre,项目名称:organizer,代码行数:12,代码来源:organizer.cpp
示例3: main
int main(int argc, char **argv)
{
srand(time(NULL));
pi = 4.0 * atan(1);
min_x = 0.0;
max_x = 3.0 * pi;
if (argc > 1) {
if (strcmp(argv[1], "-n") == 0) {
no_random = 1;
} else {
print_usage(argv[0]);
return 1;
}
}
Table my_table = createMyTable();
Table doubled_table = doubleTable(&my_table, min_x);
Table left_table = createTable(min_x, max_x, 0);
Table middle_table = createTable(min_x, max_x, numof_parts / 2);
Table right_table = createTable(min_x, max_x, numof_parts - 1);
printReport(&my_table, "Initial table");
printReport(&doubled_table, "Doubled table");
printReport(&left_table, "Left table");
printReport(&middle_table, "Middle table");
printReport(&right_table, "Right table");
resetFunction(&right_table, my_g);
resetFunction(&middle_table, my_g);
resetFunction(&left_table, my_g);
resetFunction(&doubled_table, my_g);
resetFunction(&my_table, my_g);
printReport(&my_table, "Initial table");
printReport(&doubled_table, "Doubled table");
printReport(&left_table, "Left table");
printReport(&middle_table, "Middle table");
printReport(&right_table, "Right table");
disposeTable(&right_table);
disposeTable(&middle_table);
disposeTable(&left_table);
disposeTable(&doubled_table);
disposeTable(&my_table);
reportMaxError();
return 0;
}
开发者ID:ramntry,项目名称:numerical_analysis,代码行数:49,代码来源:main.c
示例4: testStore
void testStore(void) {
// setup
struct Command* createDatabaseCommand = createCreateDatabaseCommand("test_store");
createDatabase(createDatabaseCommand);
char names[FIELD_SIZE][NAME_LIMIT] = { "name1", "name2", "name3", "name4", };
char values[FIELD_SIZE][VALUE_LIMIT] = { "1", "value2", "1/1/2015", "3", };
FieldType types[FIELD_SIZE][1] = { INTEGER, TEXT, DATE, INTEGER, };
struct Field* fields = createFieldList(names, values, types, 4);
struct Command* createTableCmd = createCreateTableCommand("table",
fields);
createTable(createTableCmd);
// test
struct Command* insertCmd = createInsertCommand("table", fields);
insertTuple(insertCmd);
values[0][0] = '2';
insertTuple(insertCmd);
// teardown
destroyCommand(createDatabaseCommand);
destroyCommand(createTableCmd);
}
开发者ID:SCostello84,项目名称:cop4710-sequel,代码行数:28,代码来源:test.c
示例5: testCreateTable
void testCreateTable(void) {
struct Command* createDBCommand = createCreateDatabaseCommand("foo");
createDatabase(createDBCommand);
assert(strcmp(currentDatabase, "foo") == 0, "currentDatabase should be set!");
char tableFolderPath[PATH_SIZE];
char names[FIELD_SIZE][NAME_LIMIT] = { "name1", "name2", "name3", "name4", };
char values[FIELD_SIZE][VALUE_LIMIT] = { "1", "value2", "1/1/2015", "3", };
FieldType types[FIELD_SIZE][1] = { INTEGER, TEXT, DATE, INTEGER, };
struct Field* fields = createFieldList(names, values, types, 4);
struct Command* createTableCmd = createCreateTableCommand("bar", fields);
createTable(createTableCmd);
sprintf(tableFolderPath, "%s/foo/bar", DATABASE_DIR);
assert(access(tableFolderPath, F_OK) != -1, "Table file was not constructed!");
char fileContents[RECORD_SIZE];
FILE* file = fopen(tableFolderPath, "r");
fgets(fileContents, RECORD_SIZE, file);
char* header = "name1[I]|name2[T]|name3[D]|name4[I]\n";
assert(strcmp(fileContents, header) == 0, "Table was not written correctly!");
// cleanup garbage
fclose(file);
destroyCommand(createDBCommand);
destroyCommand(createTableCmd);
}
开发者ID:SCostello84,项目名称:cop4710-sequel,代码行数:31,代码来源:test.c
示例6: main
int main(int argc, char *argv[])
/* Read ContigInfo into hash. */
/* Filter ContigLocusId and write to ContigLocusIdFilter. */
{
if (argc != 3)
usage();
snpDb = argv[1];
contigGroup = argv[2];
hSetDb(snpDb);
/* check for needed tables */
if(!hTableExistsDb(snpDb, "ContigLocusId"))
errAbort("no ContigLocusId table in %s\n", snpDb);
if(!hTableExistsDb(snpDb, "ContigInfo"))
errAbort("no ContigInfo table in %s\n", snpDb);
contigHash = loadContigs(contigGroup);
if (contigHash == NULL)
{
verbose(1, "couldn't get ContigInfo hash\n");
return 1;
}
filterSNPs();
createTable();
loadDatabase();
return 0;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:32,代码来源:snpContigLocusIdFilter125.c
示例7: lua_gettop
/**
* Adds a set of constants to the Lua library
* @param L A pointer to the Lua VM
* @param LibName The name of the library.
* If this is an empty string, the functions will be added to the global namespace.
* @param Constants An array of the constant values along with their names.
* The array must be terminated with the enry (0, 0)
* @return Returns true if successful, otherwise false.
*/
bool LuaBindhelper::addConstantsToLib(lua_State *L, const Common::String &libName, const lua_constant_reg *constants) {
#ifdef DEBUG
int __startStackDepth = lua_gettop(L);
#endif
// If the table is empty, the constants are added to the global namespace
if (libName.size() == 0) {
for (; constants->Name; ++constants) {
lua_pushstring(L, constants->Name);
lua_pushnumber(L, constants->Value);
lua_settable(L, LUA_GLOBALSINDEX);
}
}
// If the table name is nto empty, the constants are added to that table
else {
// Ensure that the library table exists
if (!createTable(L, libName)) return false;
// Register each constant in the table
for (; constants->Name; ++constants) {
lua_pushstring(L, constants->Name);
lua_pushnumber(L, constants->Value);
lua_settable(L, -3);
}
// Remove the library table from the Lua stack
lua_pop(L, 1);
}
#ifdef DEBUG
assert(__startStackDepth == lua_gettop(L));
#endif
return true;
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:44,代码来源:luabindhelper.cpp
示例8: QWidget
/*!
Constructs the UiDigitalGenerator with the given \a parent.
*/
UiDigitalGenerator::UiDigitalGenerator(DigitalSignals* digitalSignals,
QWidget *parent) :
QWidget(parent)
{
int defaultStates = 32;
mSignals = digitalSignals;
GeneratorDevice* device = DeviceManager::instance().activeDevice()
->generatorDevice();
if (device != NULL) {
defaultStates = device->maxNumDigitalStates();
}
// Deallocation: ownership changed when calling setLayout
QVBoxLayout* verticalLayout = new QVBoxLayout();
mTable = createTable();
verticalLayout->addWidget(createToolBar());
verticalLayout->addWidget(mTable);
setLayout(verticalLayout);
setNumStates(defaultStates);
}
开发者ID:AlexandreN7,项目名称:Liqui_lense,代码行数:29,代码来源:uidigitalgenerator.cpp
示例9: newGameMatrix
GameMatrix* newGameMatrix(SDL_Surface *screen, int matrixHeight, int matrixWidth)
{
int i = 0,j = 0;
/** Crée la surface de jeu **/
GameMatrix *surface = malloc(sizeof(GameMatrix));
/// Dimensions de la grille de jeu
surface->height = matrixHeight;
surface->width = matrixWidth;
surface->surf = createTable(surface->height, surface->width);
// Calcul de la largeur d'un bloc en fonction des dimensions de la fenêtre
surface->coteBloc = (HEIGHT-CADRE*2)/surface->height;
// Initialisation de la surface à 0
for(i = 0; i < surface->height; i++)
for(j = 0; j < surface->width; j++)
surface->surf[i][j] = 0;
// Initialisation des couleurs
surface->colors[0] = SDL_MapRGB(screen->format, 255,0,0); // Rouge
surface->colors[1] = SDL_MapRGB(screen->format, 0,0,255); // Bleu
surface->colors[2] = SDL_MapRGB(screen->format, 189,141,70); // Brun
surface->colors[3] = SDL_MapRGB(screen->format, 255,0,255); // Magenta
surface->colors[4] = SDL_MapRGB(screen->format, 255,255,255); // Blanc
surface->colors[5] = SDL_MapRGB(screen->format, 0,255,255); // Cyan
surface->colors[6] = SDL_MapRGB(screen->format, 0,255,0); // Vert
return surface;
}
开发者ID:WhiteMoll,项目名称:sdl-tetris,代码行数:30,代码来源:tetris.c
示例10: switch
Recordinfo API::dealCmd(sqlcommand& sql){
// 使用get方法更好,这里先直接调用public
switch(sql.sqlType){
case 0:
return select(sql);
break;
case 1:
return del(sql);
break;
case 2:
return insert(sql);
break;
case 3:
return createTable(sql);
break;
case 4:
return createIndex(sql);
break;
case 5:
return dropTable(sql);
break;
case 6:
return dropIndex(sql);
break;
}
return Recordinfo();
}
开发者ID:smilenow,项目名称:Database-System-Design_miniSQL,代码行数:27,代码来源:API.cpp
示例11: createTable
void HashTable::rebuildTable(unsigned int newSize, HashFunction *hashFunct)
{
List **oldTable = table;
unsigned int oldSize = hTsize;
hTsize = newSize;
createTable();
collisions = 0;
maxCollLength = 0;
LoadFactor = 0;
elemQuantity = 0;
delete hash;
hash = hashFunct;
for (unsigned int i = 0; i < oldSize; i++)
{
if (oldTable[i] != NULL && !oldTable[i]->isEmpty())
{
ListElement *temp = oldTable[i]->getHead();
while (temp->getNext() != NULL)
{
add(temp->getStr(), temp->getElemCounter());
temp = temp->getNext();
}
add(temp->getStr(), temp->getElemCounter());
}
}
for (int i = 0; i < hTsize; i++)
delete oldTable[i];
delete[] oldTable;
}
开发者ID:antongulikov,项目名称:Homework,代码行数:29,代码来源:HashTable.cpp
示例12: dbFile
void Calendar::initDatabase()
{
QFile dbFile("data.db");
if(dbFile.exists())
{
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName("data.db");
m_db.open();
qDebug() << "Database oppened.";
}
else
{
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName("data.db");
m_db.open();
QSqlQuery createTable(m_db);
createTable.exec("CREATE TABLE events(empty_place TEXT NULL, name TEXT NULL, description TEXT NULL, date_time DATETIME)");
qDebug() << "Database created.";
}
m_sqlTableModel = new QSqlTableModel(this, m_db);
m_sqlTableModel->setTable("events");
m_sqlTableModel->setSort(3, Qt::AscendingOrder);
m_sqlTableModel->select();
}
开发者ID:mariusz-ba,项目名称:Calendar,代码行数:25,代码来源:calendar.cpp
示例13: addLandauDiamondTable
void THTMLLandaus::addLandauDiamondTable(vector<Float_t> vecHistoMeans, vector<Float_t> vecHistoMaxs, vector<Float_t> vecHistoGaus, vector<Float_t> vecHistoLandau)
{
stringstream sectionContent;
vector<vector<string> > tableContent;
tableContent.resize(vecHistoMeans.size()+1);
tableContent.at(0).push_back("ClusterSize");
tableContent.at(0).push_back("Mean");
tableContent.at(0).push_back("MaxPos");
tableContent.at(0).push_back("GausPos");
tableContent.at(0).push_back("LandauMP");
tableContent.at(0).push_back("Landau/Gaus");
tableContent.at(0).push_back("Landau/Max");
for(UInt_t i=0;i<vecHistoMeans.size()&&i<vecHistoMaxs.size()&&i<vecHistoGaus.size()&&i<vecHistoLandau.size();i++){
Float_t fraction = vecHistoLandau.at(i)/vecHistoGaus.at(i);
tableContent.at(i+1).push_back((i==0?"AllClusters":this->floatToString(i+1)));
tableContent.at(i+1).push_back(this->floatToString(vecHistoMeans.at(i)));
tableContent.at(i+1).push_back(this->floatToString(vecHistoMaxs.at(i)));
tableContent.at(i+1).push_back(this->floatToString(vecHistoGaus.at(i)));
tableContent.at(i+1).push_back(this->floatToString(vecHistoLandau.at(i)));
tableContent.at(i+1).push_back(this->floatToString(fraction));
fraction = vecHistoLandau.at(i)/vecHistoMaxs.at(i);
tableContent.at(i+1).push_back(this->floatToString(fraction));
}
sectionContent<<"<p>\n";
sectionContent<<createTable(tableContent)<<endl;
sectionContent<<"<p>";
this->addSection("Landau Fit CrossCheck Table",sectionContent.str());
}
开发者ID:diamondIPP,项目名称:StripTelescopeAnalysis,代码行数:28,代码来源:THTMLLandaus.cpp
示例14: qDebug
/***********************************************************************************
Main function for table creation/altering called from tobrowsertable.cpp
It will call either createTable either alterTable
************************************************************************************/
QString toOracleExtract::migrateTable(toExtract &ext, std::list<QString> &source,
std::list<QString> &destin) const
{
#ifdef DEBUG
qDebug() << "toOracleExtract::migrateTable source=";
for (std::list<QString>::iterator i = source.begin(); i != source.end(); i++)
{
qDebug() << *i;
}
qDebug() << "toOracleExtract::migrateTable destin=";
for (std::list<QString>::iterator i = destin.begin(); i != destin.end(); i++)
{
qDebug() << *i;
}
#endif
if (source.empty())
{
#ifdef DEBUG
qDebug() << "New table has to be created.";
#endif
return createTable(destin);
}
else
{
#ifdef DEBUG
qDebug() << "Existing table is to be modified.";
#endif
return alterTable(source, destin);
}
} // migrateTable
开发者ID:netrunner-debian-kde-extras,项目名称:tora,代码行数:36,代码来源:tooracletable.cpp
示例15: main
int main ()
{
HashTable *hashTable = createTable(hashConst, SIZE);
textAnalyzer(hashTable);
stat(hashTable);
freeTable(hashTable);
hashTable = createTable(hashCountCodes, SIZE);
textAnalyzer(hashTable);
stat(hashTable);
freeTable(hashTable);
hashTable = createTable(hashGood, SIZE);
textAnalyzer(hashTable);
stat(hashTable);
freeTable(hashTable);
}
开发者ID:nfadeeva,项目名称:My_homework,代码行数:16,代码来源:countWords.c
示例16: main
int main()
{
Connection conn;
DbRetVal rv = conn.open("root", "manager");
if (rv != OK) return 1;
DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager();
if (dbMgr == NULL) { printf("Auth failed\n"); return 2;}
int ret =0, rc =0;
if (createTable(dbMgr, "t1") != 0 ) { ret = 3; }
#ifdef WITHINDEX
if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; }
#endif
rv = conn.startTransaction();
if (rv != OK) ret = 5;
rc = insertTuple(dbMgr, conn, "t1", 10);
if (rc != 10) ret = 6;
conn.commit();
rv = conn.startTransaction();
if (rv != OK) ret = 5;
rc = selectTuple(dbMgr, conn, "t1", 10);
if (rc != 10) ret = 6;
printf("Before commit\n");
dbMgr->printDebugLockInfo();
conn.commit();
printf("After commit\n");
dbMgr->printDebugLockInfo();
dropTable(dbMgr, "t1");
conn.close();
return ret;
}
开发者ID:mattibickel,项目名称:csql,代码行数:31,代码来源:locktest003.c
示例17: main
void main() {
Table *table = createTable(11);
TableEntry entry[11];
initialize(&entry[0], "coke", 20);
insertEntry(table, &entry[0]);
initialize(&entry[1], "bsererreeaffsfsd", 20);
insertEntry(table, &entry[1]);
initialize(&entry[2], "bfdsfadsfb", 20);
insertEntry(table, &entry[2]);
initialize(&entry[3], "bfdafdsbb", 20);
insertEntry(table, &entry[3]);
initialize(&entry[4], "milk tefssfa", 15);
insertEntry(table, &entry[4]);
initialize(&entry[5], "apple judffice", 30);
insertEntry(table, &entry[5]);
initialize(&entry[6], "orange juidsce", 25);
insertEntry(table, &entry[6]);
initialize(&entry[7], "black tefdfdsa", 10);
insertEntry(table, &entry[7]);
findTable(table, "bsererreeaffsfsd");
findTable(table, "cok");
findTable(table, "milk tea");
findTable(table, "apple juice");
findTable(table, "black tea");
findTable(table, "b");
system("pause");
}
开发者ID:k1dave6412,项目名称:CPP,代码行数:31,代码来源:main.cpp
示例18: main
int main()
{
Connection conn;
DbRetVal rv = conn.open("root", "manager");
if (rv != OK) { printf("Error during connection %d\n", rv); return 1; }
DatabaseManager *dbMgr = conn.getDatabaseManager();
int ret = createTable(dbMgr);
if (ret != 0) { return 1; }
pthread_t thr[2];
int *status1, *status2;
pthread_create (&thr[0], NULL, &runTest1, NULL);
pthread_create (&thr[1], NULL, &runTest2, NULL);
printf("All threads started\n");
pthread_join(thr[0], (void**)&status1);
pthread_join(thr[1], (void**)&status2);
ret = 0;
if (*status1 != 0 || *status2 != 0) ret = 1;
if (p1RetVal) { delete p1RetVal; p1RetVal = NULL; }
if (p2RetVal) { delete p2RetVal; p2RetVal = NULL; }
dbMgr->dropTable("t1");
conn.close();
return ret;
}
开发者ID:mattibickel,项目名称:csql,代码行数:26,代码来源:isotest11.c
示例19: deleteTable
void database::redoTable()
{
deleteTable();
deleteReactionsTable();
createTable();
createReactionsTable();
}
开发者ID:mifark,项目名称:everything,代码行数:7,代码来源:database.cpp
示例20: TEST_F
TEST_F(PointerCalcTests, pc_from_vertical_table_slice_count_4_groups) {
auto t = createTable(table_5);
ASSERT_EQ(5u, t->partitionCount());
auto tmp_fd = new std::vector<field_t>{1, 2, 3, 4};
auto res = PointerCalculator::create(t, nullptr, tmp_fd);
ASSERT_EQ(2u, res->partitionCount());
}
开发者ID:HanumathRao,项目名称:hyrise,代码行数:7,代码来源:pointercalc_tests.cpp
注:本文中的createTable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论