瀏覽代碼

Corrected the return value for script command query_sql
* Should return 0 on an empty query and -1 on a query failure.
* Updated script command documentation.

aleos89 9 年之前
父節點
當前提交
5766fc6209
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      doc/script_commands.txt
  2. 1 1
      src/map/script.c

+ 2 - 2
doc/script_commands.txt

@@ -7650,8 +7650,8 @@ Example:
 *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
 *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
 
-Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
-and will return the number of rows (i.e. array size) or -1 on failure/empty array.
+Executes an SQL query. A 'select' query can fill array variables with up to 2 billion rows of
+values, and will return the number of rows (i.e. array size) or -1 on failure.
 
 Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
 

+ 1 - 1
src/map/script.c

@@ -15989,7 +15989,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
 
 	if( Sql_NumRows(handle) == 0 ) { // No data received
 		Sql_FreeResult(handle);
-		script_pushint(st, -1);
+		script_pushint(st, 0);
 		return SCRIPT_CMD_SUCCESS;
 	}