Beispiel #1
0
/*
    Removes the details of \serviceName from the database corresponding to \a
    scope.

    Returns true if the operation succeeded, false otherwise.
    The last error is set when this function is called.
*/
bool DatabaseManager::unregisterService(const QString &serviceName, DbScope scope)
{
    #ifdef Q_OS_SYMBIAN
        scope = SystemScope;
    #endif

    if(scope == DatabaseManager::SystemScope) {
        if (!openDb(DatabaseManager::SystemScope))
            return false;
   else {
            if (!m_systemDb->unregisterService(serviceName)) {
                m_lastError = m_systemDb->lastError();
                return false;
            } else { //must be successful unregistration
                m_lastError.setError(DBError::NoError);
                return true;
            }
        }
    } else {
        if (!openDb(DatabaseManager::UserScope)) {
            return false;
        } else {
            if (!m_userDb->unregisterService(serviceName)){
                m_lastError = m_userDb->lastError();
                return false;
            } else { //must be successful unregistration
                m_lastError.setError(DBError::NoError);
                return true;
            }
        }
    }
}
Beispiel #2
0
void wb_db::copy(wb_export &e, const char *fileName)
{
  pwr_tStatus sts;
  dcli_translate_filename(m_fileName, fileName);

  openDb(false);
  importVolume(e);
  close();
  openDb(true);

  try {
    m_env->txn_begin(0, (DbTxn **)&m_txn, 0);

    wb_db_info i(this);
    i.get(m_txn);
    m_vid = i.vid();
    m_cid = i.cid();
    strcpy(m_volumeName, i.name());
    commit(&sts);
  }
  catch (DbException &e) {
    //txn->abort();
    printf("exeption: %s\n", e.what());
  }

}
Beispiel #3
0
/*
    Adds the details \a  service into the service database corresponding to
    \a scope.

    Returns true if the operation succeeded and false otherwise.
    The last error is set when this function is called.
*/
bool DatabaseManager::registerService(ServiceMetaDataResults &service, DbScope scope)
{
    #ifdef Q_OS_SYMBIAN
        scope = SystemScope;
    #endif

    if (scope == DatabaseManager::SystemScope) {
        if(!openDb(DatabaseManager::SystemScope)) {
            return false;
        }  else {
            if (!m_systemDb->registerService(service)) {
                m_lastError = m_systemDb->lastError();
                return false;
            } else { //must be successful registration
                m_lastError.setError(DBError::NoError);
                return true;
            }
        }
    } else { //must  be registering service at user scope
        if (!openDb(DatabaseManager::UserScope)) {
            return false;
        } else {
            if (!m_userDb->registerService(service)) {
                m_lastError = m_userDb->lastError();
                return false;
            } else { //must be successful registration
                m_lastError.setError(DBError::NoError);
                return true;
            }
        }
    }
}
Beispiel #4
0
/*
    Retrieves a list of interface descriptors that fulfill the constraints specified
    by \a filter at a given \a scope.

    The last error is set when this function is called.
*/
QList<QServiceInterfaceDescriptor>  DatabaseManager::getInterfaces(const QServiceFilter &filter, DbScope scope)
{
    #ifdef Q_OS_SYMBIAN
        QService::Scope requestedScope;
        if (scope == UserScope) {
            requestedScope = QService::UserScope;
        } else {
            requestedScope = QService::SystemScope;
        }
        scope = SystemScope;
    #endif

    QList<QServiceInterfaceDescriptor> descriptors;

    int userDescriptorCount = 0;
    if (scope == UserScope) {
        if (!openDb(UserScope))
            return descriptors;

        descriptors =  m_userDb->getInterfaces(filter);
        if (m_userDb->lastError().code() != DBError::NoError ) {
            descriptors.clear();
            m_lastError = m_userDb->lastError();
            return descriptors;
        }

        userDescriptorCount = descriptors.count();
        for (int i=0; i < userDescriptorCount; ++i) {
            descriptors[i].d->scope = QService::UserScope;
        }
    }

    if (openDb(SystemScope)) {
        descriptors.append(m_systemDb->getInterfaces(filter));
        if (m_systemDb->lastError().code() != DBError::NoError) {
            descriptors.clear();
            m_lastError = m_systemDb->lastError();
            return descriptors;
        }

        for (int i = userDescriptorCount; i < descriptors.count(); ++i) {
            #ifdef Q_OS_SYMBIAN
                descriptors[i].d->scope = requestedScope;
            #else
                descriptors[i].d->scope = QService::SystemScope;
            #endif
        }
    } else {
        if ( scope == SystemScope) {
            //openDb() should already have handled lastError
            descriptors.clear();
            return descriptors;
        }
    }

    m_lastError.setError(DBError::NoError);
    return descriptors;
}
Beispiel #5
0
void setUpDbForTest(){
    db = openDb();
    executeSql("create table config (key, value)", NULL);
    populateConfigTable();
    executeSql("create table data (ts,dr,ad,dl,ul,hs)", NULL);
    executeSql("create table alert (id, name, active, bound, direction, amount);", NULL);
    executeSql("create table interval (id, yr, mn, dy, wk, hr);", NULL);
    executeSql("create table alert_interval (alert_id, interval_id);", NULL);
}
Beispiel #6
0
void DbController::addToBanned( const QByteArray& nick, const QByteArray& login, const QByteArray& ip, const QByteArray& author, const QString& date )
{
    if( !openDb() )
        return;

    QSqlQuery query;

    if( !query.exec( "insert into banned( nick, login, ip, author, date ) values('" + nick + "','" + login + "','" + ip + "','" + author + "','" + date + "');" ) ) {
        qWarning() << "\e[1;31m[FAIL]DbController::addToBanned failed to execute query" << query.lastError() << "\e[0m" ;
        return;
    }
Beispiel #7
0
int main(int argc, char **argv){
 // Interpret the command-lin arguments and decide if they make sense
	int status = parseArgs(argc, argv, &prefs);

    printf(COPYRIGHT);
	setLogLevel(LOG_INFO);
	
	if (status == FAIL){
	 // The command-line was duff...
		if (prefs.errorMsg != NULL){
		 // ...and we have a specific error to show the user
			printf("Error: %s\n", prefs.errorMsg);
		} else {
		 // ...and we have no specific error message, so show a vague one
			printf("BitMeter did not understand. ");
		}
		printf("Use the '-h' option to display help.\n");

	} else if (prefs.help){
	 // Dump the help info and stop
		doHelp();

	} else if (prefs.version){
	 // Show the version and stop
		doVersion();

	} else {
	 // We will need to go to the database if we end up here
		openDb();
        dbVersionCheck();

		switch(prefs.mode){
			case PREF_MODE_DUMP:
				doDump();
				break;
			case PREF_MODE_SUMMARY:
				doSummary();
				break;
			case PREF_MODE_MONITOR:
				doMonitor();
				break;
			case PREF_MODE_QUERY:
				doQuery();
				break;
			default:
				assert(FALSE); // Any other mode value should cause parseArgs to fail
				break;
		}

		closeDb();
	}

	return 0;
}
Beispiel #8
0
static void readDbConfig(){
 // Read in some config parameters from the database
	openDb();
	setCustomLogLevel();
	dbVersionCheck();
	int allowRemote = getConfigInt(CONFIG_WEB_ALLOW_REMOTE, 0);
	allowRemoteConnect = (allowRemote >= ALLOW_REMOTE_CONNECT);
	allowRemoteAdmin   = (allowRemote == ALLOW_REMOTE_ADMIN);
	port = getPort();
    getWebRootPath(webRoot);
	closeDb();
}
void CDatabaseManagerServerSession::ConstructL(QString dbPath)
    {
    iDb = new ServiceDatabase();
    iDb->setDatabasePath(dbPath);
    openDb();
    
    //initDbPath();
    iDatabaseManagerSignalHandler = new DatabaseManagerSignalHandler(*this);
        
    m_watcher = new QFileSystemWatcher();
    QObject::connect(m_watcher, SIGNAL(fileChanged(QString)),
            iDatabaseManagerSignalHandler, SLOT(databaseChanged(QString)));
    }
Beispiel #10
0
Commercials::
Commercials(MWindow *mwindow)
 : Garbage("Commercials")
{
	this->mwindow = mwindow;
	this->scan_status = 0;
  	mdb = new MediaDb();
	scan_file = 0;
	cancelled = 0;
	muted = 0;
	openDb();
	detachDb();
}
Beispiel #11
0
void insertTable(char *counter, char *threadName, int value)
{
	char sqlCommand[512];
	sqlite3 *db;

	db = openDb(DBPATH);

	sprintf(sqlCommand, "INSERT INTO infos VALUES('%s', '%s', '%d');", counter, threadName, value);

	sqlite3_exec(db, sqlCommand, NULL, NULL, NULL);

	sqlite3_close(db);
}
Beispiel #12
0
int taskShow(){
	openDb();
	char *errMsg;
	char **dbResult;
	int nRow,nColumn;
	long currentAreaId;
	
	int ret=sqlite3_get_table(
			conn,
			QUERY_CURRENT_AREA_ID_SQL,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);
	if (ret==SQLITE_OK){
		currentAreaId=atol(dbResult[1]);
		printf("Current area is %ld...\n",currentAreaId);
	}else{
		printf("Query current area failed...\n");
		closeDb();
		return -1;
	}

	char *selectSql=(char*)malloc(1024);
	sprintf(selectSql,QUERY_TASK_BY_STATE_SQL,TASK_STATE_ACTIVE,currentAreaId);

	ret=sqlite3_get_table(
			conn,
			selectSql,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);
	if (ret==SQLITE_OK){
		printf("%d tasks to do in total:\n",nRow);
		for (int i=0;i<nRow;i++){
			int startPos=(i+1)*nColumn;
			printf("%s\t%s\n",dbResult[startPos],dbResult[startPos+1]);
		}
	}else{
		printf("Query tasks to do failed...\n");
		closeDb();
		return -1;
	}

	closeDb();
	return 0;
}
Collection* RollbackTest::_createCollection(OperationContext* opCtx,
                                            const NamespaceString& nss,
                                            const CollectionOptions& options) {
    Lock::DBLock dbLock(opCtx, nss.db(), MODE_X);
    mongo::WriteUnitOfWork wuow(opCtx);
    auto databaseHolder = DatabaseHolder::get(opCtx);
    auto db = databaseHolder->openDb(opCtx, nss.db());
    ASSERT_TRUE(db);
    db->dropCollection(opCtx, nss.ns()).transitional_ignore();
    auto coll = db->createCollection(opCtx, nss.ns(), options);
    ASSERT_TRUE(coll);
    wuow.commit();
    return coll;
}
Beispiel #14
0
int Commercials::
scan_media()
{
	cancelled = 0;
	scan_status = new ScanStatus(this, 30, 30, 2, 2,
		cancelled, "Cutting Ads");
	if( !openDb() ) {
		scan_video();
		commitDb();
		closeDb();
	}
	delete scan_status;
	scan_status = 0;
	return 0;
}
void SavingSettingsTabView::loadDbModel()
{
    QMutex mutex;
    QMutexLocker locker(&mutex);

    QSqlDatabase db = openDb();
    if (db.isOpen()) {
        m_model->setQuery("SELECT * FROM studentresults", db);
    }
    db.close();

    //make table full screen
    for (int i = 0; i < m_model->columnCount(); i++) {
        m_table->setColumnWidth(i, m_table->width()/m_model->columnCount());
    }
}
Beispiel #16
0
/*
    Removes the initialization specific information of \serviceName from the database
    corresponding to a \scope.

    Returns true if teh operation succeeded, false otherwise.
    The last error is set when this function is called.
  */
bool DatabaseManager::serviceInitialized(const QString &serviceName, DbScope scope)
{
    ServiceDatabase *db = (scope == DatabaseManager::SystemScope) ? m_systemDb : m_userDb;

    if (!openDb(scope)) {
        return false;
    } else {
        if (!db->serviceInitialized(serviceName)) {
            m_lastError = db->lastError();
            return false;
        } else {
            m_lastError.setError(DBError::NoError);
            return true;
        }
    }
}
Beispiel #17
0
LWRESULT ConnectPool::GetConnect(ConnectVal& ret_connect, int32_ timeout_ms)
{
	
	GET_OBJECT_RET(TimerTick, iTimerTick, LWDP_GET_OBJECT_ERROR);
	uint32_ startTimeout = iTimerTick->GetMilliseconds();
	pthread_mutex_lock(&setMutex);
	while(!mIdleIndex.size())
	{
		if(mConnectSet.size() < mMaxConnNum)
		{
			MYSQL* pDb = openDb();
			if(!pDb)
			{
				pthread_mutex_unlock(&setMutex);
				return LWDP_OPEN_DB_ERROR;
			}
			mConnectSet.push_back(pDb);
			mIdleIndex.push_back(mConnectSet.size() - 1);	
		}
		else if(mConnectSet.size() == mMaxConnNum)
		{
			if(timeout_ms < 0)
			{
				pthread_mutex_unlock(&setMutex);
				return LWDP_GET_POOL_CONNECT_TIMEOUT;
			}
			uint32_ nowTimeout = iTimerTick->GetMilliseconds();
			uint32_ diff = nowTimeout - startTimeout;
			if(diff > timeout_ms)
			{
				pthread_mutex_unlock(&setMutex);
				return LWDP_GET_POOL_CONNECT_TIMEOUT;
			}

			pthread_cond_wait(&timeOutCond, &setMutex); 
			continue;
		}
	}
	
	uint32_ selectIndex = randof(mIdleIndex.size());
	ConnectVal retVal;
	retVal.index   = mIdleIndex[selectIndex];
	retVal.connect = mConnectSet[retVal.index];
	ret_connect = retVal;
	
	return LWDP_OK;
}
Beispiel #18
0
LWRESULT ConnectPool::ConnectToDb(uint32_ min_connect, uint32_ max_connect)
{
	mMaxConnNum = max_connect;
	mMinConnNum = min_connect;

	srand(time(NULL));
	for(int i = 0; i<mMinConnNum; ++i)
	{
		MYSQL* pDb = openDb();
		if(!pDb)
			return LWDP_OPEN_DB_ERROR;
		mConnectSet.push_back(pDb);
		mIdleIndex.push_back(i);
	}
	
	return LWDP_OK;
}
Beispiel #19
0
void setupCapture(){
 // Called once when the application starts - setup up the various db related things...
    openDb();
    setCustomLogLevel();
    dbVersionCheck();
	setupDb();
	compressDb();

	prevData = getData();
	tsCompress = getNextCompressTime();
	
 // Check how often we should write captured values to the database - the default is every second
	dbWriteInterval = getConfigInt(CONFIG_DB_WRITE_INTERVAL, TRUE);
	if (dbWriteInterval < 1){
		dbWriteInterval = 1;	
	}
}
void SavingSettingsTabView::fillResultStructure()
{
    m_dbTable.clear();

    QSqlDatabase db = openDb();
    if (db.isOpen()) {

        QSqlQuery q_select(db);
        q_select.prepare("SELECT * FROM studentresults");

        if (q_select.exec()) {
            while (q_select.next()) {
                //testname, firstname, secondName, surname, groupname, scorevalue, maxvalue, testtime
                StudentResult table;
                table.id              = q_select.value(q_select.record().indexOf("id")).toInt();
                table.firstName       = q_select.value(q_select.record().indexOf("firstname")).toString();
                table.secondName      = q_select.value(q_select.record().indexOf("secondName")).toString();
                table.surname         = q_select.value(q_select.record().indexOf("surname")).toString();
                table.group           = q_select.value(q_select.record().indexOf("groupname")).toString();
                table.score           = q_select.value(q_select.record().indexOf("scorevalue")).toInt();
                table.maxPosibleScore = q_select.value(q_select.record().indexOf("maxvalue")).toInt();
                table.time            = getTimeString(q_select.value(q_select.record().indexOf("testtime")).toString());
                table.testName        = q_select.value(q_select.record().indexOf("testname")).toString();
                m_dbTable.append(table);
            }
        }

        QSqlQuery q_questionInfo(db);
        q_questionInfo.prepare("SELECT * FROM studentresultanswers");

        if (q_questionInfo.exec()) {
            while (q_questionInfo.next()) {
                //resultid, statement, chosenvar, assuarance, iscorrect
                AnswersVector vector;
                vector.id              = q_questionInfo.value(q_questionInfo.record().indexOf("resultid")).toInt();
                vector.statement       = q_questionInfo.value(q_questionInfo.record().indexOf("statement")).toString();
                vector.chosenAnswer    = q_questionInfo.value(q_questionInfo.record().indexOf("chosenvar")).toString();
                vector.isCorrectAnswer = q_questionInfo.value(q_questionInfo.record().indexOf("iscorrect")).toInt();
                vector.assurance       = q_questionInfo.value(q_questionInfo.record().indexOf("assuarance")).toInt();

                m_answerInfo.append(vector);
            }
        }
    }
    db.close();
}
Beispiel #21
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTextCodec::setCodecForTr(QTextCodec::codecForName("CP1251"));
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("CP1251"));

    if (false == openDb())
    {
        terminate();
    }

    MainWindow w;
    w.show();

    return a.exec();
}
Beispiel #22
0
int taskAdd(char *title,char *desc){
	openDb();
	char *errMsg;
	char *insertSql=(char*)malloc(1024);

	char **dbResult;
	int nRow,nColumn;
	long currentAreaId;	

	int ret=sqlite3_get_table(
			conn,
			QUERY_CURRENT_AREA_ID_SQL,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);

	if (ret==SQLITE_OK){
		currentAreaId=atol(dbResult[1]);
		printf("Current area is %ld...\n",currentAreaId);
	}else{
		printf("Query current area failed...\n");
		closeDb();
		return -1;
	}

	sprintf(insertSql,INSERT_TASK_SQL,title,desc,TASK_STATE_ACTIVE,currentAreaId);	
	ret=sqlite3_exec(
			conn,
			insertSql,
			NULL,
			NULL,
			&errMsg
		);
	if (ret!=SQLITE_OK){
		LOG("%s\n",errMsg);
	}else{
		printf("Task %s added and its initial state is ACTIVE.\n",title);
	}
	free(insertSql);
	closeDb();

	return 0;
}
Beispiel #23
0
int areaShow(){
	openDb();
	char *errMsg;
	char **dbResult;
	int nRow,nColumn;
	
	int ret=sqlite3_get_table(
			conn,
			QUERY_ALL_AREA_SQL,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);
	if (ret==SQLITE_OK){
		printf("%d areas in total:\n",nRow);
		for (int i=0;i<nRow;i++){
			printf("%s\n",dbResult[(i+1)*nColumn]);
		}
	}else{
		printf("Query all areas failed...\n");
	}

	ret=sqlite3_get_table(
			conn,
			QUERY_CURRENT_AREA_SQL,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);
	if (ret==SQLITE_OK){
		if (dbResult[1]==NULL){
			printf("No selected area.\n");
		}else{
			printf("Selected area:%s\n",dbResult[1]);
		}
	}


	closeDb();
	return 0;
}
Beispiel #24
0
int taskShowId(long taskId){
	openDb();
	char *errMsg;
	char **dbResult;
	int nRow,nColumn;
	
	char *selectSql=(char*)malloc(1024);
	sprintf(selectSql,QUERY_TASK_BY_ID_SQL,taskId);

	int ret=sqlite3_get_table(
			conn,
			selectSql,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);
	if (ret==SQLITE_OK){
		if (nRow<1){
			printf("No such task with the given id!");
		}else{
			printf("Id:%ld\n",taskId);
			printf("Title:%s\n",dbResult[nColumn]);
			printf("Content:%s\n",dbResult[nColumn+1]);
			char *stateCode=dbResult[nColumn+2];
			char *stateString=NULL;
			if (strcmp(stateCode,TASK_STATE_ACTIVE)==0){
				stateString=TASK_STATE_ACTIVE_STRING;
			}else if (strcmp(stateCode,TASK_STATE_DONE)){
				stateString=TASK_STATE_DONE_STRING;
			}else
				LOG("Unrecognized task state code:%s\n",stateCode);
			if (stateString!=NULL)
				printf("State:%s\n",stateString);
		}
	}else{
		printf("Query task failed...\n");
	}

	closeDb();
	return 0;
}
Beispiel #25
0
void readDataBase(dataList **l)
{
	char tmp[255];
	dataList *ptr;
	sqlite3 *db;
	sqlite3_stmt *res;

	newDataList(l);
	ptr = *l;

	db = openDb(DBPATH);

	sqlite3_prepare_v2(db, "SELECT * FROM infos;", 255, &res, NULL);

	while(sqlite3_step(res) == SQLITE_ROW)
	{
		newDataList(&(ptr->next));
		ptr = ptr->next;
		newDateCell(&(ptr->date));
		newDataLine(&(ptr->data));

		sprintf(tmp, "%s", sqlite3_column_text(res, 5));
		strcpy(ptr->data->counter, tmp);
		sprintf(tmp, "%s", sqlite3_column_text(res, 6));
		strcpy(ptr->data->threadName, tmp);
		ptr->data->value = sqlite3_column_int64(res, 7);

		sprintf(tmp, "%s", sqlite3_column_text(res, 0));
		sscanf(tmp, "%d-%d-%d %d:%d:%d",
			&(ptr->date->year),
			&(ptr->date->month),
			&(ptr->date->day),
			&(ptr->date->hours),
			&(ptr->date->min),
			&(ptr->date->sec));

		ptr->date->uday = sqlite3_column_int(res, 1);
		ptr->date->uhours = sqlite3_column_int(res, 2);
		ptr->date->umin = sqlite3_column_int(res, 3);
		ptr->date->usec = sqlite3_column_int(res, 4);
	}
}
Beispiel #26
0
int areaSwitch(char *area){
	openDb();
	char **dbResult;
	int nRow,nColumn;
	char *errMsg;
	char *selectSql=(char*)malloc(1024);
	sprintf(selectSql,QUERY_CERTAIN_AREA_SQL,area);
	int ret=sqlite3_get_table(
			conn,
			selectSql,
			&dbResult,
			&nRow,
			&nColumn,
			&errMsg
		);
	if (ret!=SQLITE_OK){
		LOG("%s\n",errMsg);
	}else{
		if (nRow<1){
			printf("No such area.\n");
		}else{
			char *updateSql=(char*)malloc(1024);
			sprintf(updateSql,UPDATE_SWITHCED_AREA_SQL,dbResult[1]);
			ret=sqlite3_exec(
					conn,
					updateSql,
					NULL,
					NULL,
					&errMsg
				);
			if (ret!=SQLITE_OK){
				LOG("%s\n",errMsg);
			}else{
				printf("Current arear swithced to %s.\n",area);
			}
			free(updateSql);
		}
	}
	free(selectSql);
	closeDb();
	return 0;
}
Beispiel #27
0
void  wb_db::open(const char *fileName)
{
  dcli_translate_filename(m_fileName, fileName);

  openDb(true);

  try {
    m_env->txn_begin(0, (DbTxn **)&m_txn, 0);

    wb_db_info i(this);
    i.get(m_txn);
    m_vid = i.vid();
    m_cid = i.cid();
    strcpy(m_volumeName, i.name());
  }
  catch (DbException &e) {
    //txn->abort();
    printf("exeption: %s\n", e.what());
  }
}
Beispiel #28
0
int taskDone(long taskId){
	openDb();
	char *errMsg;
	char *updateSql=(char*)malloc(1024);
	sprintf(updateSql,UPDATE_TASK_STATE_SQL,TASK_STATE_DONE,taskId);
	int ret=sqlite3_exec(
			conn,
			updateSql,
			NULL,
			NULL,
			&errMsg
		);
	if (ret!=SQLITE_OK){
		LOG("%s\n",errMsg);
	}else{
		printf("Task %ld has been done.\n",taskId);
	}
	closeDb();
	free(updateSql);
	return 0;
}
Beispiel #29
0
int areaAdd(char *area){
	openDb();
	char *errMsg;
	char *insertSql=(char*)malloc(1024);
	sprintf(insertSql,INSERT_AREA_SQL,area);	
	int	ret=sqlite3_exec(
			conn,
			insertSql,
			NULL,
			NULL,
			&errMsg
		);
	if (ret!=SQLITE_OK){
		LOG("%s\n",errMsg);
	}else{
		printf("Area %s added.\n",area);
	}
	free(insertSql);
	closeDb();
	return 0;
}
Beispiel #30
0
void createTable(char *dbPath)
{
	char sqlCommand[255];
	sqlite3 *db;

	db = openDb(dbPath);

	sprintf(sqlCommand, "CREATE TABLE infos(Date DATETIME,"
						"uday INTEGER,"
						"uhours INTEGER,"
						"umin INTEGER,"
						"usec INTEGER,"
						"counter VARCHAR(%d),"
						"threadName VARCHAR(%d),"
						"value INTEGER)",
						MAXCOUNTERNAME,
						MAXTHREADNAME);

	sqlite3_exec(db, sqlCommand, NULL, NULL, NULL);

	sqlite3_close(db);
}