static Database* __database = NULL;
static unsigned int __numDBConnection = 0;
-static const char* __getTableName(uid_t uid)
+static const char* __get_table_name(uid_t uid)
{
static char tableName[24] = {0};
return tableName;
}
-static void __initDatabase(uid_t uid)
+static void __init_database(uid_t uid)
{
char* query = sqlite3_mprintf(
"CREATE TABLE IF NOT EXISTS [%s] (" \
"owner TEXT NOT NULL," \
"jobInfo TEXT NOT NULL," \
"state TEXT NOT NULL DEFAULT ''" \
- ")", __getTableName(uid));
+ ")", __get_table_name(uid));
__database->execute(query, NULL);
}
}
- __initDatabase(uid);
+ __init_database(uid);
++__numDBConnection;
return true;
{
char* query = sqlite3_mprintf(
"INSERT INTO [%s] (jobId, owner, jobInfo) VALUES (%d, '%s', '%s')",
- __getTableName(__uid), jobInfo->getId(), owner.c_str(), jobInfo->serialize().c_str());
+ __get_table_name(__uid), jobInfo->getId(), owner.c_str(), jobInfo->serialize().c_str());
__database->execute(query, NULL);
void JobInfoDatabase::remove(int jobId)
{
char* query = sqlite3_mprintf(
- "DELETE FROM [%s] WHERE jobId = %d", __getTableName(__uid), jobId);
+ "DELETE FROM [%s] WHERE jobId = %d", __get_table_name(__uid), jobId);
__database->execute(query, NULL);
{
char* query = sqlite3_mprintf(
"UPDATE [%s] SET state = '%s' WHERE jobId = %d",
- __getTableName(__uid), started ? ST_STARTED : EMPTY_STR, jobId);
+ __get_table_name(__uid), started ? ST_STARTED : EMPTY_STR, jobId);
__database->execute(query, NULL);
std::vector<std::shared_ptr<Tuple>> queryResult;
char* query = sqlite3_mprintf(
- "SELECT owner, jobInfo, state FROM [%s]", __getTableName(__uid));
+ "SELECT owner, jobInfo, state FROM [%s]", __get_table_name(__uid));
__database->execute(query, &queryResult);
// App Control
verified = [&]()->bool {
JobAppControl* appControlAction = dynamic_cast<JobAppControl*>(action);
- IF_FAIL_RETURN(!util::isSystem(__uid), false);
+ IF_FAIL_RETURN(!util::is_system(__uid), false);
IF_FAIL_RETURN(appControlAction, false);
IF_FAIL_RETURN(appControlAction->getAppControl(), false);
return true;
// Notification
verified = [&]()->bool {
JobNotification* notiAction = dynamic_cast<JobNotification*>(action);
- IF_FAIL_RETURN(!util::isSystem(__uid), false);
+ IF_FAIL_RETURN(!util::is_system(__uid), false);
IF_FAIL_RETURN(notiAction, false);
IF_FAIL_RETURN(!(notiAction->getTitle().empty()), false);
return true;