summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-28 18:26:55 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-28 18:26:55 +0000
commit3e7fd80993f7fccdcd1d4ac70be74a28485876de (patch)
treeb3f99fa1c679e12cc31a54637bead17228349e79 /src/char_sql
parentd32a1dd3390e960ca90db57f7b15f5f8d1470415 (diff)
downloadhercules-3e7fd80993f7fccdcd1d4ac70be74a28485876de.tar.gz
hercules-3e7fd80993f7fccdcd1d4ac70be74a28485876de.tar.bz2
hercules-3e7fd80993f7fccdcd1d4ac70be74a28485876de.tar.xz
hercules-3e7fd80993f7fccdcd1d4ac70be74a28485876de.zip
* Changed back the query to get the friends of a character to a LEFT JOIN.
* Setting the item script variables to NULL when they are freed. (bugreport:142 ?) (a double @reloaditemdb might result in a double free) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11328 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 64e341c11..178454e73 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -1016,7 +1016,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
//read friends
//`friends` (`char_id`, `friend_account`, `friend_id`)
- if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `account_id`,`char_id`,`name` FROM `%s` WHERE (`account_id`,`char_id`) IN (SELECT DISTINCT `friend_account`,`friend_id` FROM `%s` WHERE `char_id`=?) LIMIT %d", char_db, friend_db, MAX_FRIENDS)
+ if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, MAX_FRIENDS)
|| SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
|| SQL_ERROR == SqlStmt_Execute(stmt)
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, NULL, NULL)