42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
|
#include "PartAddition.h"
|
||
|
|
||
|
|
||
|
|
||
|
PartAddition::PartAddition()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
PartAddition::~PartAddition()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void PartAddition::CreateIfNoExist(SQLite::Database* db)
|
||
|
{
|
||
|
if (db == nullptr)return;
|
||
|
if (db->tableExists(PART_TABLE_NAME))return;
|
||
|
char buffer[1024];
|
||
|
string createsql = "CREATE TABLE IF NOT EXISTS %s(%s INTEGER PRIMARY KEY AUTOINCREMENT,%s VARCHAR(50),%s INTEGER,%s INTEGER,%s FLOAT, %s FLOAT,%s FLOAT,UNIQUE(%s,%s))";
|
||
|
sprintf_s(buffer, sizeof(buffer), createsql.c_str(),
|
||
|
PART_TABLE_NAME.c_str(),
|
||
|
FIELD_ID.c_str(),
|
||
|
FIELD_JOB_ID.c_str(),
|
||
|
FIELD_SOURCE_PART.c_str(),
|
||
|
FIELD_NEW_PART.c_str(),
|
||
|
FIELD_X_OFFSET.c_str(),
|
||
|
FIELD_Y_OFFSET.c_str(),
|
||
|
FIELD_ROTATE.c_str(),
|
||
|
FIELD_JOB_ID.c_str(),
|
||
|
FIELD_NEW_PART.c_str()
|
||
|
);
|
||
|
db->exec(buffer);
|
||
|
}
|
||
|
|
||
|
const string PartAddition::PART_TABLE_NAME ="PartAddition";
|
||
|
const string PartAddition::FIELD_ID = "id";
|
||
|
const string PartAddition::FIELD_JOB_ID = "job_id";
|
||
|
const string PartAddition::FIELD_SOURCE_PART = "source_part";
|
||
|
const string PartAddition::FIELD_NEW_PART = "new_part";
|
||
|
const string PartAddition::FIELD_X_OFFSET = "x_offset";
|
||
|
const string PartAddition::FIELD_Y_OFFSET = "y_offset";
|
||
|
const string PartAddition::FIELD_ROTATE = "rotate";
|