From: Hiroshi Inoue Date: Mon, 20 Mar 2017 22:57:54 +0000 (+0900) Subject: Reflect the ANSI test dsn to reset-db. X-Git-Tag: REL-09_06_0300~35 X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/queryCache.php?a=commitdiff_plain;h=6b1ddd9e02ce740c6d59375a7931b65719dfae22;p=psqlodbc.git Reflect the ANSI test dsn to reset-db. --- diff --git a/test/Makefile.in b/test/Makefile.in index 8710616..8a623c6 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -41,8 +41,8 @@ override CFLAGS += -Wno-pointer-sign $(CFLAGS_ADD) runsuite: runsuite.c -reset-db: reset-db.c - $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LIBODBC) +reset-db: reset-db.c exe/common.o + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBODBC) exe/common.o: src/common.c @if test ! -d exe; then mkdir -p exe; fi diff --git a/test/reset-db.c b/test/reset-db.c index 3e442be..766f1a2 100644 --- a/test/reset-db.c +++ b/test/reset-db.c @@ -12,13 +12,16 @@ #ifdef WIN32 #include +#define snprintf _snprintf #endif #include #include -static SQLHENV env; -static SQLHDBC conn; +#include "src/common.h" + +SQLHENV env; +SQLHDBC conn; static HSTMT hstmt = SQL_NULL_HSTMT; static void @@ -92,17 +95,19 @@ run_statement(char *statement) int main(int argc, char **argv) { - char line[500]; + char line[500], dsn[100]; SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); - connect_to_db("DSN=psqlodbc_test_dsn;Database=postgres"); + snprintf(dsn, sizeof(dsn), "DSN=%s;Database=postgres", get_test_dsn()); + connect_to_db(dsn); printf("Dropping and creating database contrib_regression...\n"); run_statement("DROP DATABASE IF EXISTS contrib_regression"); run_statement("CREATE DATABASE contrib_regression"); - connect_to_db("DSN=psqlodbc_test_dsn;Database=contrib_regression"); + snprintf(dsn, sizeof(dsn), "DSN=%s;Database=contrib_regression", get_test_dsn()); + connect_to_db(dsn); printf("Running initialization script...\n"); while (fgets(line, sizeof(line), stdin) != NULL)