Author: cazfi
Date: Thu Nov  3 06:50:22 2016
New Revision: 34342

URL: http://svn.gna.org/viewcvs/freeciv?rev=34342&view=rev
Log:
Updated included luasql files to luasql-2.3.4 level.

See patch #7910

Removed:
    trunk/dependencies/luasql/freeciv_luasql.patch
Modified:
    trunk/dependencies/luasql/Makefile.am
    trunk/dependencies/luasql/Version
    trunk/dependencies/luasql/src/ls_postgres.c
    trunk/dependencies/luasql/src/luasql.c

Modified: trunk/dependencies/luasql/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/Makefile.am?rev=34342&r1=34341&r2=34342&view=diff
==============================================================================
--- trunk/dependencies/luasql/Makefile.am       (original)
+++ trunk/dependencies/luasql/Makefile.am       Thu Nov  3 06:50:22 2016
@@ -4,5 +4,4 @@
 
 EXTRA_DIST = \
                README \
-               freeciv_luasql.patch \
                Version

Modified: trunk/dependencies/luasql/Version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/Version?rev=34342&r1=34341&r2=34342&view=diff
==============================================================================
--- trunk/dependencies/luasql/Version   (original)
+++ trunk/dependencies/luasql/Version   Thu Nov  3 06:50:22 2016
@@ -1,8 +1,6 @@
-Sources here are fron luasql git tag v2.3.2
-(https://github.com/keplerproject/luasql/tree/v2.3.2)
+Sources here are fron luasql git tag v2.3.4
+(https://github.com/keplerproject/luasql/tree/v2.3.4)
 
 Only the files needed by freeciv are included here, not entire luasql
 source directory hierarchy.
 The ls_*.h files are our own additions to use those backends directly.
-Changes applied to included luasql source files are included in
-freeciv_luasql.patch

Removed: trunk/dependencies/luasql/freeciv_luasql.patch
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/freeciv_luasql.patch?rev=34341&view=auto
==============================================================================
--- trunk/dependencies/luasql/freeciv_luasql.patch      (original)
+++ trunk/dependencies/luasql/freeciv_luasql.patch      (removed)
@@ -1,12 +0,0 @@
-diff -Nurd luasql/src/ls_mysql.c luasql/src/ls_mysql.c
---- luasql/src/ls_mysql.c      2016-04-14 06:25:33.675191715 +0300
-+++ luasql/src/ls_mysql.c      2016-04-14 06:26:22.555141176 +0300
-@@ -183,7 +183,7 @@
- /*
- ** Closes the cursos and nullify all structure fields.
- */
--static int cur_nullify (lua_State *L, cur_data *cur) {
-+static void cur_nullify (lua_State *L, cur_data *cur) {
-       /* Nullify structure fields. */
-       cur->closed = 1;
-       mysql_free_result(cur->my_res);

Modified: trunk/dependencies/luasql/src/ls_postgres.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/src/ls_postgres.c?rev=34342&r1=34341&r2=34342&view=diff
==============================================================================
--- trunk/dependencies/luasql/src/ls_postgres.c (original)
+++ trunk/dependencies/luasql/src/ls_postgres.c Thu Nov  3 06:50:22 2016
@@ -374,24 +374,34 @@
        int error;
        int ret = 1;
        luaL_Buffer b;
-#if defined(luaL_buffinitsize)
-       char *to = luaL_buffinitsize (L, &b, 2*len+1);
+       char *to;
+#if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM == 501)
+       /* Lua 5.0 and 5.1 */
+       luaL_buffinit (L, &b);
+       do {
+               int max = LUAL_BUFFERSIZE / 2;
+               size_t bytes_copied;
+               size_t this_len = (len > max) ? max : len;
+               to = luaL_prepbuffer (&b);
+               bytes_copied = PQescapeStringConn (conn->pg_conn, to, from, 
this_len, &error);
+               if (error != 0) { /* failed ! */
+                       return luasql_failmsg (L, "cannot escape string. 
PostgreSQL: ", PQerrorMessage (conn->pg_conn));
+               }
+               luaL_addsize (&b, bytes_copied);
+               from += this_len;
+               len -= this_len;
+       } while (len > 0);
+       luaL_pushresult (&b);
 #else
-       char *to;
-       luaL_buffinit (L, &b);
-       to = luaL_prepbuffer (&b);
-#endif
+       /* Lua 5.2 and 5.3 */
+       to = luaL_buffinitsize (L, &b, 2*len+1);
        len = PQescapeStringConn (conn->pg_conn, to, from, len, &error);
        if (error == 0) { /* success ! */
-#if defined(luaL_pushresultsize)
                luaL_pushresultsize (&b, len);
-#else
-               luaL_addsize (&b, len);
-               luaL_pushresult (&b);
-#endif
        } else {
                ret = luasql_failmsg (L, "cannot escape string. PostgreSQL: ", 
PQerrorMessage (conn->pg_conn));
        }
+#endif
        return ret;
 }
 
@@ -510,8 +520,9 @@
        conn = PQsetdbLogin(pghost, pgport, NULL, NULL, sourcename, username, 
password);
 
        if (PQstatus(conn) == CONNECTION_BAD) {
+               int rc = luasql_failmsg(L, "error connecting to database. 
PostgreSQL: ", PQerrorMessage(conn));
                PQfinish(conn);
-               return luasql_failmsg(L, "error connecting to database. 
PostgreSQL: ", PQerrorMessage(conn));
+               return rc;
        }
        PQsetNoticeProcessor(conn, notice_processor, NULL);
        return create_connection(L, 1, conn);

Modified: trunk/dependencies/luasql/src/luasql.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/src/luasql.c?rev=34342&r1=34341&r2=34342&view=diff
==============================================================================
--- trunk/dependencies/luasql/src/luasql.c      (original)
+++ trunk/dependencies/luasql/src/luasql.c      Thu Nov  3 06:50:22 2016
@@ -128,6 +128,6 @@
        lua_pushliteral (L, "LuaSQL is a simple interface from Lua to a DBMS");
        lua_settable (L, -3);
        lua_pushliteral (L, "_VERSION");
-       lua_pushliteral (L, "LuaSQL 2.3.1");
+       lua_pushliteral (L, "LuaSQL 2.3.4 (for "LUA_VERSION")");
        lua_settable (L, -3);
 }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to