Author: cazfi
Date: Mon Aug  1 09:13:14 2016
New Revision: 33404

URL: http://svn.gna.org/viewcvs/freeciv?rev=33404&view=rev
Log:
Updated included luasql to version 2.3.2

See patch #7374

Modified:
    trunk/dependencies/luasql/Version
    trunk/dependencies/luasql/src/ls_postgres.c

Modified: trunk/dependencies/luasql/Version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/Version?rev=33404&r1=33403&r2=33404&view=diff
==============================================================================
--- trunk/dependencies/luasql/Version   (original)
+++ trunk/dependencies/luasql/Version   Mon Aug  1 09:13:14 2016
@@ -1,5 +1,5 @@
-Sources here are fron luasql git tag v2.3.1
-(https://github.com/keplerproject/luasql/tree/v2.3.1)
+Sources here are fron luasql git tag v2.3.2
+(https://github.com/keplerproject/luasql/tree/v2.3.2)
 
 Only the files needed by freeciv are included here, not entire luasql
 source directory hierarchy.

Modified: trunk/dependencies/luasql/src/ls_postgres.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/luasql/src/ls_postgres.c?rev=33404&r1=33403&r2=33404&view=diff
==============================================================================
--- trunk/dependencies/luasql/src/ls_postgres.c (original)
+++ trunk/dependencies/luasql/src/ls_postgres.c Mon Aug  1 09:13:14 2016
@@ -498,30 +498,21 @@
 
 /*
 ** Connects to a data source.
-** This driver provides two ways to connect to a data source:
-** (1) giving the connection parameters as a set of pairs separated
-**     by whitespaces in a string (first method parameter)
-** (2) giving one string for each connection parameter, said
-**     datasource, username, password, host and port.
 */
 static int env_connect (lua_State *L) {
        const char *sourcename = luaL_checkstring(L, 2);
+       const char *username = luaL_optstring(L, 3, NULL);
+       const char *password = luaL_optstring(L, 4, NULL);
+       const char *pghost = luaL_optstring(L, 5, NULL);
+       const char *pgport = luaL_optstring(L, 6, NULL);
        PGconn *conn;
        getenvironment (L);     /* validate environment */
-       if ((lua_gettop (L) == 2) && (strchr (sourcename, '=') != NULL))
-               conn = PQconnectdb (sourcename);
-       else {
-               const char *username = luaL_optstring(L, 3, NULL);
-               const char *password = luaL_optstring(L, 4, NULL);
-               const char *pghost = luaL_optstring(L, 5, NULL);
-               const char *pgport = luaL_optstring(L, 6, NULL);
-
-               conn = PQsetdbLogin(pghost, pgport, NULL, NULL,
-                       sourcename, username, password);
-       }
-
-       if (PQstatus(conn) == CONNECTION_BAD)
+       conn = PQsetdbLogin(pghost, pgport, NULL, NULL, sourcename, username, 
password);
+
+       if (PQstatus(conn) == CONNECTION_BAD) {
+               PQfinish(conn);
                return luasql_failmsg(L, "error connecting to database. 
PostgreSQL: ", PQerrorMessage(conn));
+       }
        PQsetNoticeProcessor(conn, notice_processor, NULL);
        return create_connection(L, 1, conn);
 }


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

Reply via email to