Ejemplo n.º 1
0
static void daemon_data_sqlite_data_CreateSchema (DaemonDataSqliteData* self, GError** error) {
	gchar* _tmp0_;
	gchar* createLog;
	gint _tmp1_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("CREATE TABLE IF NOT EXISTS Log (Username TEXT, Data TEXT NULL, Channel" \
" TEXT, Server TEXT, Timestamp INTEGER, Type INTEGER)");
	createLog = _tmp0_;
	_tmp1_ = _sqlite3_exec (self->priv->_database, createLog, NULL, NULL, NULL);
	if (_tmp1_ != SQLITE_OK) {
		GError* _tmp2_ = NULL;
		_tmp2_ = g_error_new_literal (DAEMON_DATA_DATA_ACCESS_ERROR, DAEMON_DATA_DATA_ACCESS_ERROR_WriteError, "Could not create Database");
		_inner_error_ = _tmp2_;
		if (_inner_error_->domain == DAEMON_DATA_DATA_ACCESS_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (createLog);
			return;
		} else {
			_g_free0 (createLog);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	daemon_global_log_ColorMessage (DAEMON_CONSOLE_COLORS_Green, "Successfully initialized Database");
	_g_free0 (createLog);
}
Ejemplo n.º 2
0
void irc_sq_lite_db_CreateDB (void) {
	sqlite3* _tmp0_ = NULL;
	gint _tmp1_;
	sqlite3* _tmp2_;
	gint _result_;
	char* createLog;
	_result_ = (_tmp1_ = sqlite3_open (IRC_SQ_LITE_DB__path, &_tmp0_), irc_sq_lite_db_DataBase = (_tmp2_ = _tmp0_, _sqlite3_close0 (irc_sq_lite_db_DataBase), _tmp2_), _tmp1_);
	createLog = g_strdup ("CREATE TABLE MyLogData (Username TEXT, Message TEXT NULL, Channel TEXT" \
", Server TEXT, Timestamp INTEGER)");
	if (_result_ == SQLITE_OK) {
		_sqlite3_exec (irc_sq_lite_db_DataBase, createLog, NULL, NULL, NULL);
	}
	_g_free0 (createLog);
}