summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-05 06:54:02 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-05 06:54:02 +0000
commitf4b3dff16a0b23c915cfae1de150b0943db83620 (patch)
tree7019bc8f7c4356410d199b0058f1e5e2b41a2089 /src/char_sql
parentcf5a6282cace4f9b4d788909a00f6c6e0057acfe (diff)
downloadhercules-f4b3dff16a0b23c915cfae1de150b0943db83620.tar.gz
hercules-f4b3dff16a0b23c915cfae1de150b0943db83620.tar.bz2
hercules-f4b3dff16a0b23c915cfae1de150b0943db83620.tar.xz
hercules-f4b3dff16a0b23c915cfae1de150b0943db83620.zip
added debugging
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@456 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c17
-rw-r--r--src/char_sql/int_guild.c4
-rw-r--r--src/char_sql/int_party.c4
-rw-r--r--src/char_sql/int_pet.c2
-rw-r--r--src/char_sql/int_storage.c3
-rw-r--r--src/char_sql/inter.c3
-rw-r--r--src/char_sql/itemdb.c3
7 files changed, 31 insertions, 5 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 382c654b9..364755cf1 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -190,6 +190,7 @@ void read_gm_account(void) {
sprintf(tmp_lsql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,login_db,login_db_level,lowest_gm_level);
if (mysql_query(&lmysql_handle, tmp_lsql)) {
printf("DB server Error (select %s to Memory)- %s\n",login_db,mysql_error(&lmysql_handle));
+ return;
}
lsql_res = mysql_store_result(&lmysql_handle);
if (lsql_res) {
@@ -507,7 +508,6 @@ int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int
if((eqcount==1) && (dbeqcount==1)){//printf("%s Equip Empty\n",tablename);
//item empty
} else {
-
for(i=1;i<eqcount;i++){
for(j=1;j<dbeqcount;j++){
if(mapitem.equip[i].flag==1) break;
@@ -541,7 +541,7 @@ int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int
for(i=1;i<dbeqcount;i++){
//printf("dbitem.equip[i].flag = %d , dbitem.equip[i].id = %d\n",dbitem.equip[i].flag,dbitem.equip[i].id);
- if (!(dbitem.equip[i].flag == 1)) {
+ if (dbitem.equip[i].flag == 0) {
sprintf(tmp_sql,"DELETE from `%s` where `id`='%d'",tablename , dbitem.equip[i].id);
//printf("%s", tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql))
@@ -549,7 +549,7 @@ int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int
}
}
for(i=1;i<eqcount;i++){
- if(!(mapitem.equip[i].flag==1)){
+ if(mapitem.equip[i].flag==0){
sprintf(tmp_sql,"INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`)"
" VALUES ( '%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
tablename, selectoption, char_id, mapitem.equip[i].nameid, mapitem.equip[i].amount, mapitem.equip[i].equip, mapitem.equip[i].identify, mapitem.equip[i].refine,
@@ -621,7 +621,7 @@ int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int
for(i=1;i<dbnoteqcount;i++){
//printf("dbitem.notequip[i].flag = %d , dbitem.notequip[i].id = %d\n",dbitem.notequip[i].flag,dbitem.notequip[i].id);
- if(!(dbitem.notequip[i].flag==1)){
+ if(dbitem.notequip[i].flag==0){
sprintf(tmp_sql,"DELETE from `%s` where `id`='%d'", tablename, dbitem.notequip[i].id);
//printf("%s", tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql))
@@ -629,7 +629,7 @@ int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int
}
}
for(i=1;i<noteqcount;i++){
- if(!(mapitem.notequip[i].flag==1)){
+ if(mapitem.notequip[i].flag==0) {
sprintf(tmp_sql,"INSERT INTO `%s`( `%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`)"
" VALUES ('%d','%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
tablename ,selectoption , char_id, mapitem.notequip[i].nameid, mapitem.notequip[i].amount, mapitem.notequip[i].equip, mapitem.notequip[i].identify, mapitem.notequip[i].refine,
@@ -3042,3 +3042,10 @@ int do_init(int argc, char **argv){
}
+#undef mysql_query
+int STDCALL mysql_query(MYSQL *mysql, const char *q);
+
+int debug_mysql_query(MYSQL *mysql, const char *q) {
+ printf("DEBUG_MYSQL: %s\n", q);
+ return mysql_query(mysql, q);
+}
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index 4f6c88a70..47343cb7b 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -16,6 +16,10 @@
#include <stdio.h>
#include <stdlib.h>
+
+extern int debug_mysql_query(MYSQL *mysql, const char *q);
+#define mysql_query(_x, _y) debug_mysql_query(_x, _y)
+
static struct guild *guild_pt;
static struct guild *guild_pt2;
static struct guild_castle * guildcastle_pt;
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c
index 84de078c9..2ac955230 100644
--- a/src/char_sql/int_party.c
+++ b/src/char_sql/int_party.c
@@ -10,6 +10,10 @@
#include <stdlib.h>
#include <string.h>
+
+extern int debug_mysql_query(MYSQL *mysql, const char *q);
+#define mysql_query(_x, _y) debug_mysql_query(_x, _y)
+
static struct party *party_pt;
static int party_newid=100;
diff --git a/src/char_sql/int_pet.c b/src/char_sql/int_pet.c
index 14d2144c7..bf42670b6 100644
--- a/src/char_sql/int_pet.c
+++ b/src/char_sql/int_pet.c
@@ -12,6 +12,8 @@
struct s_pet *pet_pt;
static int pet_newid = 100;
+extern int debug_mysql_query(MYSQL *mysql, const char *q);
+#define mysql_query(_x, _y) debug_mysql_query(_x, _y)
//---------------------------------------------------------
int inter_pet_tosql(int pet_id, struct s_pet *p) {
diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c
index 7c8c8ce4a..72b8386fc 100644
--- a/src/char_sql/int_storage.c
+++ b/src/char_sql/int_storage.c
@@ -14,6 +14,9 @@ struct storage *storage_pt=NULL;
struct guild_storage *guild_storage_pt=NULL;
+extern int debug_mysql_query(MYSQL *mysql, const char *q);
+#define mysql_query(_x, _y) debug_mysql_query(_x, _y)
+
// storage data -> DB conversion
int storage_tosql(int account_id,struct storage *p){
int i;
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index 9c10cf6c5..95768b049 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -15,6 +15,9 @@
#include "int_pet.h"
#include "lock.h"
+extern int debug_mysql_query(MYSQL *mysql, const char *q);
+#define mysql_query(_x, _y) debug_mysql_query(_x, _y)
+
#define WISDATA_TTL (60*1000) // Wisデータの生存時間(60秒)
#define WISDELLIST_MAX 256 // Wisデータ削除リストの要素数
diff --git a/src/char_sql/itemdb.c b/src/char_sql/itemdb.c
index 0bed07c23..7a8db9e7e 100644
--- a/src/char_sql/itemdb.c
+++ b/src/char_sql/itemdb.c
@@ -13,6 +13,9 @@
#include "memwatch.h"
#endif
+extern int debug_mysql_query(MYSQL *mysql, const char *q);
+#define mysql_query(_x, _y) debug_mysql_query(_x, _y)
+
#define MAX_RANDITEM 2000
// ** ITEMDB_OVERRIDE_NAME_VERBOSE **