Просмотр исходного кода

* Fixed Sql_SetEncoding not setting the encoding of the connection properly. (fixes bugreport:30)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11774 54d463be-8e91-2dee-dedb-b68131a5f0ec
FlavioJS 17 лет назад
Родитель
Сommit
c7fad50342
2 измененных файлов с 6 добавлено и 2 удалено
  1. 2 0
      Changelog-Trunk.txt
  2. 4 2
      src/common/sql.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/11/21
+	* Fixed Sql_SetEncoding not setting the encoding of the connection 
+	  properly. (fixes bugreport:30)
 	* Added backward compatible target 'conf' to the Makefile. [FlavioJS]
 	* Changed Lif's Emergency Avoid to just get a normal skill delay
 	  (blocks all skills, cancelled by mapchange / re-summon) instead of

+ 4 - 2
src/common/sql.c

@@ -145,7 +145,9 @@ int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_l
 /// Changes the encoding of the connection.
 int Sql_SetEncoding(Sql* self, const char* encoding)
 {
-	return Sql_Query(self, "SET NAMES %s", encoding);
+	if( self && mysql_set_character_set(self->handle, encoding) )
+		return SQL_SUCCESS;
+	return SQL_ERROR;
 }
 
 
@@ -155,7 +157,7 @@ int Sql_Ping(Sql* self)
 {
 	if( self && mysql_ping(&self->handle) == 0 )
 		return SQL_SUCCESS;
-	return  SQL_ERROR;
+	return SQL_ERROR;
 }