diff options
author | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-06 22:41:04 +0000 |
---|---|---|
committer | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-06 22:41:04 +0000 |
commit | 9cc1a0872e514fc269cc21f641676e17d5f994fb (patch) | |
tree | 316ceba6d89be4b1ea85c6845d1d32bee82c57e6 | |
parent | 0654a424e3b05d349237d490b95686d0e23244aa (diff) | |
download | hercules-9cc1a0872e514fc269cc21f641676e17d5f994fb.tar.gz hercules-9cc1a0872e514fc269cc21f641676e17d5f994fb.tar.bz2 hercules-9cc1a0872e514fc269cc21f641676e17d5f994fb.tar.xz hercules-9cc1a0872e514fc269cc21f641676e17d5f994fb.zip |
guild sql fix...
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1060 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog.txt | 1 | ||||
-rw-r--r-- | src/char_sql/char.c | 43 |
2 files changed, 40 insertions, 4 deletions
diff --git a/Changelog.txt b/Changelog.txt index c9af29156..1aab0c1fe 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Date Added 02/06 + * NULL entries for guild data fixed [Credit to Sirius] [1060: Ajarn] * Login server uses login_db_userid and login_db_user_pass for queries now [Credit to Sirius] [1059: Ajarn] * Login server can now check clientversion in clientinfo diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 3e144cf40..8da03ace4 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -1190,15 +1190,18 @@ int mmo_char_sql_init(void) { } else printf("set char_id_count: %d.......\n",char_id_count); - sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", char_db); + //sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", char_db); //OLD QUERY ! BUGGED + sprintf(tmp_sql, "UPDATE `%s` SET `online` = '0'", char_db);//fixed the on start 0 entrys! if (mysql_query(&mysql_handle, tmp_sql)) printf("DB server Error - %s\n", mysql_error(&mysql_handle)); - sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", guild_member_db); + //sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", guild_member_db); //OLD QUERY ! BUGGED + sprintf(tmp_sql, "UPDATE `%s` SET `online` = '0'", guild_member_db);//fixed the 0 entrys in start .. if (mysql_query(&mysql_handle, tmp_sql)) printf("DB server Error - %s\n", mysql_error(&mysql_handle)); - sprintf(tmp_sql , "REPLACE INTO `%s` SET `connect_member`=0", guild_db); + //sprintf(tmp_sql , "REPLACE INTO `%s` SET `connect_member`=0", guild_db); //OLD QUERY BUGGED! + sprintf(tmp_sql, "UPDATE `%s` SET `connect_member` = '0'", guild_db);//fixed the 0 entrys in start..... if (mysql_query(&mysql_handle, tmp_sql)) printf("DB server Error - %s\n", mysql_error(&mysql_handle)); @@ -3381,6 +3384,39 @@ int do_init(int argc, char **argv){ start_console(); } + //Cleaning the tables for NULL entrys @ startup [Sirius] + //Chardb clean + printf("Cleaning the '%s' table...", char_db); + sprintf(tmp_sql,"DELETE FROM `%s` WHERE `account_id` = '0'", char_db); + if(mysql_query(&mysql_handle, tmp_sql)){ + //error on clean + printf(" fail.\n"); + }else{ + printf(" done.\n"); + } + + //guilddb clean + printf("Cleaning the '%s' table...", guild_db); + sprintf(tmp_sql,"DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db); + if(mysql_query(&mysql_handle, tmp_sql)){ + //error on clean + printf(" fail.\n"); + }else{ + printf(" done.\n"); + } + + //guildmemberdb clean + printf("Cleaning the '%s' table...", guild_member_db); + sprintf(tmp_sql,"DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db); + if(mysql_query(&mysql_handle, tmp_sql)){ + //error on clean + printf(" fail.\n"); + }else{ + printf(" done.\n"); + } + + + printf("char server init func end (now unlimited loop start!)....\n"); printf("The char-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", char_port); return 0; @@ -3395,4 +3431,3 @@ int debug_mysql_query(char *file, int line, void *mysql, const char *q) { return mysql_query((MYSQL *) mysql, q); } - |