diff --git a/db_attribute_tbl.c b/db_attribute_tbl.c index 96d915b..79b2794 100644 --- a/db_attribute_tbl.c +++ b/db_attribute_tbl.c @@ -106,7 +106,7 @@ int load_db_attributes(){ int i=0; char sql[MAX_SQL_LEN]=""; - snprintf(sql, MAX_SQL_LEN, "SELECT * FROM ATTRIBUTE_TABLE"); + snprintf(sql, MAX_SQL_LEN, "SELECT ATTRIBUTE_ID,ATTRIBUTE_DESCRIPTION,RACE_ID,ATTRIBUTE_TYPE_ID FROM ATTRIBUTE_TABLE"); rc=sqlite3_prepare_v2(db, sql, -1, &stmt, NULL); if(rc!=SQLITE_OK){ diff --git a/db_chat_channel_tbl.c b/db_chat_channel_tbl.c index 12fcb55..d409121 100644 --- a/db_chat_channel_tbl.c +++ b/db_chat_channel_tbl.c @@ -92,7 +92,7 @@ void add_db_channel(int channel_id, int owner_id, int channel_type, char *passwo "NAME," \ "DESCRIPTION," \ "NEW_CHARS " \ - ") VALUES(%i, %i, %i, %s, %s, %s, %i)", channel_id, owner_id, channel_type, password, channel_name, channel_description, new_chars); + ") VALUES(%i, %i, %i, '%s','%s', '%s', %i)", channel_id, owner_id, channel_type, password, channel_name, channel_description, new_chars); process_sql(sql); diff --git a/db_map_tbl.c b/db_map_tbl.c index 5fa25e4..fc7d64e 100644 --- a/db_map_tbl.c +++ b/db_map_tbl.c @@ -350,13 +350,18 @@ int get_db_map_exists(int map_id){ char sql[MAX_SQL_LEN]=""; snprintf(sql, MAX_SQL_LEN, "SELECT count(*) FROM MAP_TABLE WHERE MAP_ID=?"); - sqlite3_prepare_v2(db, sql, -1, &stmt, NULL); + rc = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL); if(rc!=SQLITE_OK){ log_sqlite_error("sqlite3_prepare_v2 failed", __func__, __FILE__, __LINE__, rc, sql); } + rc = sqlite3_bind_int(stmt, 1, map_id); + if(rc!=SQLITE_OK){ + log_sqlite_error("sqlite3_bind_int failed", __func__, __FILE__, __LINE__, rc, sql); + } - rc = sqlite3_step(stmt); + while((rc = sqlite3_step(stmt))==SQLITE_ROW) + ; if (rc != SQLITE_DONE) { log_sqlite_error("sqlite3_step failed", __func__, __FILE__, __LINE__, rc, sql);