예제 #1
0
void Table_GENERAL_OPTIONS::ModifyDisplayAbsoluteTimeColumns(sqlite3 * db)
{

	std::lock_guard<std::recursive_mutex> data_lock(data_mutex);

	std::string sqlAdd("UPDATE GENERAL_OPTIONS SET ");
	sqlAdd += GENERAL_OPTIONS__DISPLAY_ABSOLUTE_TIME_COLUMNS;
	sqlAdd += "=";
	sqlAdd += boost::lexical_cast<std::string>(display_absolute_time_columns ? 1 : 0);
	sqlite3_stmt * stmt = NULL;
	sqlite3_prepare_v2(db, sqlAdd.c_str(), sqlAdd.size() + 1, &stmt, NULL);

	if (stmt == NULL)
	{
		return;
	}

	sqlite3_step(stmt);

	if (stmt)
	{
		sqlite3_finalize(stmt);
		stmt = nullptr;
	}

}
예제 #2
0
void Table_GENERAL_OPTIONS::ModifyRandomSamplingCount(sqlite3 * db)
{

	std::lock_guard<std::recursive_mutex> data_lock(data_mutex);

	std::string sqlAdd("UPDATE GENERAL_OPTIONS SET ");
	sqlAdd += GENERAL_OPTIONS__RANDOM_SAMPLING_COUNT_PER_STAGE;
	sqlAdd += "=";
	sqlAdd += boost::lexical_cast<std::string>(random_sampling_count_per_stage);
	sqlite3_stmt * stmt = NULL;
	sqlite3_prepare_v2(db, sqlAdd.c_str(), sqlAdd.size() + 1, &stmt, NULL);

	if (stmt == NULL)
	{
		return;
	}

	sqlite3_step(stmt);

	if (stmt)
	{
		sqlite3_finalize(stmt);
		stmt = nullptr;
	}

}
예제 #3
0
void Table_GENERAL_OPTIONS::ModifyConsolidateRows(sqlite3 * db)
{

	std::lock_guard<std::recursive_mutex> data_lock(data_mutex);

	std::string sqlAdd("UPDATE GENERAL_OPTIONS SET ");
	sqlAdd += GENERAL_OPTIONS__CONSOLIDATE_ROWS;
	sqlAdd += "=";
	sqlAdd += boost::lexical_cast<std::string>(consolidate_rows ? 1 : 0);
	sqlite3_stmt * stmt = NULL;
	sqlite3_prepare_v2(db, sqlAdd.c_str(), sqlAdd.size() + 1, &stmt, NULL);

	if (stmt == NULL)
	{
		return;
	}

	sqlite3_step(stmt);

	if (stmt)
	{
		sqlite3_finalize(stmt);
		stmt = nullptr;
	}

}
예제 #4
0
void MainWindow::InitData()
{


    head = (pstustr)malloc(sizeof(stustr));

    if(!flag)
    {
        //        QMessageBox::warning(this,tr("警告"),tr("数据库读取失败"),QMessageBox::Yes);
        sqlAdd();
        flag=1;
    }
    else
    {
        if(data!=NULL)
        {
            data=head;
            data->id=0;

            //data->major="通信";
            strcpy(data->major,"通信");
            //data->name="康庆飞";
            strcpy(data->name,"康庆飞");
            //data->psubinfo.subname="通信软件基础";
            strcpy(data->psubinfo.subname,"通信软件基础");

            data->pnext=NULL;
            data->stunum=2012210624;
            data->psubinfo.marks=100;

        }
    }

}