Hello community, here is the log from the commit of package psqlODBC for openSUSE:Factory checked in at 2018-05-29 10:41:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/psqlODBC (Old) and /work/SRC/openSUSE:Factory/.psqlODBC.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "psqlODBC" Tue May 29 10:41:13 2018 rev:23 rq:611528 version:10.03.0000 Changes: -------- --- /work/SRC/openSUSE:Factory/psqlODBC/psqlODBC.changes 2018-04-06 17:47:49.519221590 +0200 +++ /work/SRC/openSUSE:Factory/.psqlODBC.new/psqlODBC.changes 2018-05-29 10:41:17.792516242 +0200 @@ -1,0 +2,12 @@ +Wed May 23 10:15:15 UTC 2018 - [email protected] + +- Update to version 10.03.0000: + * Put back the handling of lock_CC_for_rb variable. The variable lock_CC_for_rb should be held per connection. + * Fix SQLGetTypeInfo() so that it filters SQL_TYPE_DATE, SQL_TYPE_TIME or SQL_TYPE_TIMESTAMP for ODBC 2.x applications. + * Revise ConfigDSN() so that it handles the 4th parameter(lpszAttribues) correctly. + * Fix a crash bug when handling error messages. Also modified some error messages. + * Let SQLTables() or SQLTablePrivileges() show partition tables. + * Fix build on Solaris defined(__SUNPRO_C) using Solaris Studio + * Reduce DB access to pg_class or pg_index by caching relhasoids, relhassubclass etc. It would improve the performance of SQLSetPos() or SQLBulkOperations() very much in some cases. + +------------------------------------------------------------------- Old: ---- psqlodbc-10.02.0000.tar.gz New: ---- psqlodbc-10.03.0000.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ psqlODBC.spec ++++++ --- /var/tmp/diff_new_pack.A2aP70/_old 2018-05-29 10:41:19.072468997 +0200 +++ /var/tmp/diff_new_pack.A2aP70/_new 2018-05-29 10:41:19.072468997 +0200 @@ -28,7 +28,7 @@ Summary: ODBC Driver for PostgreSQL License: LGPL-2.1+ Group: Productivity/Databases/Clients -Version: 10.02.0000 +Version: 10.03.0000 Release: 0 Source0: https://ftp.postgresql.org/pub/odbc/versions/src/%tarname-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ psqlodbc-10.02.0000.tar.gz -> psqlodbc-10.03.0000.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/catfunc.h new/psqlodbc-10.03.0000/catfunc.h --- old/psqlodbc-10.02.0000/catfunc.h 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/catfunc.h 2018-05-19 12:32:53.000000000 +0200 @@ -48,6 +48,7 @@ ,COLUMNS_TABLE_OID ,COLUMNS_BASE_TYPEID ,COLUMNS_ATTTYPMOD + ,COLUMNS_TABLE_INFO ,NUM_OF_COLUMNS_FIELDS }; /* SQLPrimaryKeys field position */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/configure new/psqlodbc-10.03.0000/configure --- old/psqlodbc-10.02.0000/configure 2018-03-30 15:51:36.000000000 +0200 +++ new/psqlodbc-10.03.0000/configure 2018-05-19 12:46:50.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for psqlodbc 10.02.0000. +# Generated by GNU Autoconf 2.69 for psqlodbc 10.03.0000. # # Report bugs to <[email protected]>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='psqlodbc' PACKAGE_TARNAME='psqlodbc' -PACKAGE_VERSION='10.02.0000' -PACKAGE_STRING='psqlodbc 10.02.0000' +PACKAGE_VERSION='10.03.0000' +PACKAGE_STRING='psqlodbc 10.03.0000' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1324,7 +1324,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures psqlodbc 10.02.0000 to adapt to many kinds of systems. +\`configure' configures psqlodbc 10.03.0000 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1394,7 +1394,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of psqlodbc 10.02.0000:";; + short | recursive ) echo "Configuration of psqlodbc 10.03.0000:";; esac cat <<\_ACEOF @@ -1509,7 +1509,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -psqlodbc configure 10.02.0000 +psqlodbc configure 10.03.0000 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2161,7 +2161,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by psqlodbc $as_me 10.02.0000, which was +It was created by psqlodbc $as_me 10.03.0000, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3025,7 +3025,7 @@ # Define the identity of the package. PACKAGE='psqlodbc' - VERSION='10.02.0000' + VERSION='10.03.0000' cat >>confdefs.h <<_ACEOF @@ -13759,7 +13759,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by psqlodbc $as_me 10.02.0000, which was +This file was extended by psqlodbc $as_me 10.03.0000, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13825,7 +13825,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -psqlodbc config.status 10.02.0000 +psqlodbc config.status 10.03.0000 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/configure.ac new/psqlodbc-10.03.0000/configure.ac --- old/psqlodbc-10.02.0000/configure.ac 2018-03-30 15:43:31.000000000 +0200 +++ new/psqlodbc-10.03.0000/configure.ac 2018-05-19 12:43:56.000000000 +0200 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(psqlodbc, 10.02.0000, [[email protected]]) +AC_INIT(psqlodbc, 10.03.0000, [[email protected]]) AC_PREREQ(2.57) AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/connection.h new/psqlodbc-10.03.0000/connection.h --- old/psqlodbc-10.02.0000/connection.h 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/connection.h 2018-05-19 12:32:53.000000000 +0200 @@ -238,8 +238,13 @@ pgNAME schema_name; pgNAME table_name; OID table_oid; + int table_info; time_t acc_time; }; +enum { + TBINFO_HASOIDS = 1L + ,TBINFO_HASSUBCLASS = (1L << 1) +}; #define free_col_info_contents(coli) \ { \ if (NULL != coli->result) \ @@ -315,7 +320,6 @@ /* for per statement rollback */ char internal_svp; /* is set? */ char internal_op; /* operation being executed as to internal savepoint */ - unsigned char lock_CC_for_rb; unsigned char rbonerr; unsigned char opt_in_progress; unsigned char opt_previous; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/docs/release.html new/psqlodbc-10.03.0000/docs/release.html --- old/psqlodbc-10.02.0000/docs/release.html 2018-03-30 15:40:56.000000000 +0200 +++ new/psqlodbc-10.03.0000/docs/release.html 2018-05-19 12:42:43.000000000 +0200 @@ -9,6 +9,24 @@ <h1>psqlODBC release notes</h1> <hr> +<h2><a id="10.03.0000">psqlODBC 10.03.0000 Release</a></h2> +Changes:<br /> +<ol type="1"> +<li>Put back the handling of lock_CC_for_rb variable. +The variable lock_CC_for_rb should be held per connection.</li> +Per report from Ayman Samamry. +<li>Fix SQLGetTypeInfo() so that it filters SQL_TYPE_DATE, SQL_TYPE_TIME or SQL_TYPE_TIMESTAMP for ODBC 2.x applications.</li> +Per report from Oleg Tonkikh. +<li>Revise ConfigDSN() so that it handles the 4th parameter(lpszAttribues) correctly.</li> +Per report from Haribabu Kommi. +<li>Fix a crash bug when handling error messages. +Also modified some error messages.</li> +<li>Let SQLTables() or SQLTablePrivileges() show partition tables.</li> +<li>Fix build on Solaris defined(__SUNPRO_C) using Solaris Studio</li> +<li>Reduce DB access to pg_class or pg_index by caching relhasoids, relhassubclass etc. +It would improve the performance of SQLSetPos() or SQLBulkOperations() very much in some cases.</li> +Per report from Takayuki Tsunakawa. +</ol><br /> <h2><a id="10.02.0000">psqlODBC 10.02.0000 Release</a></h2> Changes:<br /> <ol type="1"> @@ -30,9 +48,6 @@ <li>Fix a crash bug in AddDeleted().</li> Report and patch by Takayuki Tsunakawa. </ol><br /> - -<h1>psqlODBC release notes</h1> -<hr> <h2><a id="10.01.0000">psqlODBC 10.01.0000 Release</a></h2> Changes:<br /> <ol type="1"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/execute.c new/psqlodbc-10.03.0000/execute.c --- old/psqlodbc-10.02.0000/execute.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/execute.c 2018-05-19 12:32:53.000000000 +0200 @@ -631,10 +631,10 @@ if (CC_is_in_error_trans(conn)) return ret; - if (0 == conn->lock_CC_for_rb) + if (!stmt->lock_CC_for_rb) { ENTER_CONN_CS(conn); - conn->lock_CC_for_rb++; + stmt->lock_CC_for_rb = TRUE; } MYLOG(DETAIL_LOG_LEVEL, " %p->accessed=%d opt=%u in_progress=%u prev=%u\n", conn, CC_accessed_db(conn), option, conn->opt_in_progress, conn->opt_previous); conn->opt_in_progress &= option; @@ -692,7 +692,7 @@ MYLOG(DETAIL_LOG_LEVEL, "entering %p->accessed=%d is_in=%d is_rb=%d is_tc=%d\n", conn, CC_accessed_db(conn), CC_is_in_trans(conn), SC_is_rb_stmt(stmt), SC_is_tc_stmt(stmt)); - if (conn->lock_CC_for_rb > 0) + if (stmt->lock_CC_for_rb) MYLOG(0, "in_progress=%u previous=%d\n", conn->opt_in_progress, conn->opt_previous); switch (ret) { @@ -744,10 +744,10 @@ conn->opt_previous = conn->opt_in_progress; CC_init_opt_in_progress(conn); } - while (conn->lock_CC_for_rb > 0) + if (stmt->lock_CC_for_rb) { + stmt->lock_CC_for_rb = FALSE; LEAVE_CONN_CS(conn); - conn->lock_CC_for_rb--; MYLOG(DETAIL_LOG_LEVEL, " release conn_lock\n"); } CC_start_stmt(conn); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/info.c new/psqlodbc-10.03.0000/info.c --- old/psqlodbc-10.02.0000/info.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/info.c 2018-05-19 12:32:53.000000000 +0200 @@ -1151,6 +1151,20 @@ for (i = 0, sqlType = sqlTypes[0]; sqlType; sqlType = sqlTypes[++i]) { + EnvironmentClass *env = CC_get_env(conn); + + /* Filter unsupported data types */ + if (EN_is_odbc2(env)) + { + switch (sqlType) + { + case SQL_TYPE_DATE: + case SQL_TYPE_TIME: + case SQL_TYPE_TIMESTAMP: + continue; + } + } + pgType = sqltype_to_pgtype(conn, sqlType); if (sqlType == SQL_LONGVARBINARY) @@ -1687,6 +1701,8 @@ return stricmp(curschema, (const char *) pubstr) == 0; } +#define TABLE_IN_RELKIND "('r', 'v', 'm', 'f', 'p')" + RETCODE SQL_API PGAPI_Tables(HSTMT hstmt, const SQLCHAR * szTableQualifier, /* PV X*/ @@ -1811,6 +1827,7 @@ { /* * Query relations depending on what is available: + * - 10 and newer versions have partition tables * - 9.3 and newer versions have materialized views * - 9.1 and newer versions have foreign tables */ @@ -1818,7 +1835,8 @@ "select NULL, NULL, relkind from (select 'r' as relkind " "union select 'v' " "union select 'm' " - "union select 'f') as a"); + "union select 'f' " + "union select 'p') as a"); } else if (list_schemas) { @@ -1834,7 +1852,7 @@ */ appendPQExpBufferStr(&tables_query, "select relname, nspname, relkind " "from pg_catalog.pg_class c, pg_catalog.pg_namespace n " - "where relkind in ('r', 'v', 'm', 'f')"); + "where relkind in " TABLE_IN_RELKIND); } op_string = gen_opestr(like_or_eq, conn); @@ -2178,7 +2196,7 @@ * for oid or xmin */ static void -add_tuple_for_oid_or_xmin(TupleField *tuple, int ordinal, const char *colname, OID the_type, const char *typname, const ConnectionClass *conn, const char *table_owner, const char *table_name, OID greloid, int attnum, BOOL auto_increment) +add_tuple_for_oid_or_xmin(TupleField *tuple, int ordinal, const char *colname, OID the_type, const char *typname, const ConnectionClass *conn, const char *table_owner, const char *table_name, OID greloid, int attnum, BOOL auto_increment, int table_info) { int sqltype; const int atttypmod = -1; @@ -2211,6 +2229,7 @@ set_tuplefield_int4(&tuple[COLUMNS_TABLE_OID], greloid); set_tuplefield_int4(&tuple[COLUMNS_BASE_TYPEID], 0); set_tuplefield_int4(&tuple[COLUMNS_ATTTYPMOD], -1); + set_tuplefield_int4(&tuple[COLUMNS_TABLE_INFO], table_info); } RETCODE SQL_API @@ -2242,7 +2261,7 @@ result_cols; Int4 mod_length, ordinal, - typmod, relhasoids; + typmod, relhasoids, relhassubclass; OID field_type, greloid, basetype; char not_null[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING], relkind[8], attidentity[2]; @@ -2254,6 +2273,7 @@ const char *like_or_eq = likeop, *op_string; const SQLCHAR *szSchemaName; BOOL setIdentity = FALSE; + int table_info = 0; MYLOG(0, "entering...stmt=%p scnm=%p len=%d\n", stmt, szTableOwner, cbTableOwner); @@ -2321,7 +2341,7 @@ "t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull, " "c.relhasrules, c.relkind, c.oid, pg_get_expr(d.adbin, d.adrelid), " "case t.typtype when 'd' then t.typbasetype else 0 end, t.typtypmod, " - "c.relhasoids, %s " + "c.relhasoids, %s, c.relhassubclass " "from (((pg_catalog.pg_class c " "inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace", PG_VERSION_GE(conn, 10.0) ? "attidentity" : "''"); if (search_by_ids) @@ -2499,6 +2519,12 @@ goto cleanup; } + result = PGAPI_BindCol(col_stmt, 18, SQL_C_LONG, + &relhassubclass, sizeof(relhassubclass), NULL); + if (!SQL_SUCCEEDED(result)) + { + goto cleanup; + } if (res = QR_Constructor(), !res) { SC_set_error(stmt, STMT_NO_MEMORY_ERROR, "Couldn't allocate memory for PGAPI_Columns result.", func); @@ -2549,6 +2575,7 @@ QR_set_field_info_v(res, COLUMNS_TABLE_OID, "TABLE OID", PG_TYPE_OID, 4); QR_set_field_info_v(res, COLUMNS_BASE_TYPEID, "BASE TYPEID", PG_TYPE_OID, 4); QR_set_field_info_v(res, COLUMNS_ATTTYPMOD, "TYPMOD", PG_TYPE_INT4, 4); + QR_set_field_info_v(res, COLUMNS_TABLE_INFO, "TABLE INFO", PG_TYPE_INT4, 4); ordinal = 1; result = PGAPI_Fetch(col_stmt); @@ -2560,8 +2587,12 @@ */ relisaview = (relkind[0] == 'v'); - if (result != SQL_ERROR) + if (SQL_SUCCEEDED(result)) { + if (relhasoids) + table_info |= TBINFO_HASOIDS; + if (relhassubclass) + table_info |= TBINFO_HASSUBCLASS; if (!relisaview && relhasoids && (show_oid_column || @@ -2581,7 +2612,7 @@ } else typname = OID_NAME; - add_tuple_for_oid_or_xmin(tuple, ordinal, OID_NAME, PG_TYPE_OID, typname, conn, table_owner, table_name, greloid, OID_ATTNUM, TRUE); + add_tuple_for_oid_or_xmin(tuple, ordinal, OID_NAME, PG_TYPE_OID, typname, conn, table_owner, table_name, greloid, OID_ATTNUM, TRUE, table_info); ordinal++; } } @@ -2707,6 +2738,7 @@ set_tuplefield_int4(&tuple[COLUMNS_TABLE_OID], greloid); set_tuplefield_int4(&tuple[COLUMNS_BASE_TYPEID], basetype); set_tuplefield_int4(&tuple[COLUMNS_ATTTYPMOD], mod_length); + set_tuplefield_int4(&tuple[COLUMNS_TABLE_INFO], table_info); ordinal++; result = PGAPI_Fetch(col_stmt); @@ -2730,7 +2762,7 @@ /* For Row Versioning fields */ tuple = QR_AddNew(res); - add_tuple_for_oid_or_xmin(tuple, ordinal, XMIN_NAME, PG_TYPE_XID, "xid", conn, table_owner, table_name, greloid, XMIN_ATTNUM, FALSE); + add_tuple_for_oid_or_xmin(tuple, ordinal, XMIN_NAME, PG_TYPE_XID, "xid", conn, table_owner, table_name, greloid, XMIN_ATTNUM, FALSE, table_info); ordinal++; } ret = SQL_SUCCESS; @@ -5491,7 +5523,7 @@ if (escTableName) appendPQExpBuffer(&proc_query, " relname %s'%s' and", op_string, escTableName); - appendPQExpBufferStr(&proc_query, " pg_namespace.oid = relnamespace and relkind in ('r', 'v') and"); + appendPQExpBufferStr(&proc_query, " pg_namespace.oid = relnamespace and relkind in " TABLE_IN_RELKIND " and"); if ((!escTableName) && (!escSchemaName)) appendPQExpBufferStr(&proc_query, " nspname not in ('pg_catalog', 'information_schema') and"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/parse.c new/psqlodbc-10.03.0000/parse.c --- old/psqlodbc-10.02.0000/parse.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/parse.c 2018-05-19 12:51:08.000000000 +0200 @@ -379,6 +379,92 @@ } } +static BOOL CheckHasOidsUsingSaved(StatementClass *stmt, TABLE_INFO *ti) +{ + const COL_INFO *coli; + int table_info; + BOOL hasoids = FALSE, hassubclass =FALSE, keyFound = FALSE; + + MYLOG(DETAIL_LOG_LEVEL, "ti->col_info=%p\n", ti->col_info); + if (TI_checked_hasoids(ti)) + ; + else if (coli = ti->col_info, NULL != coli) + { + table_info = coli->table_info; + if (0 == (table_info & TBINFO_HASSUBCLASS)) + { + TI_set_has_no_subclass(ti); + } + else + { + hassubclass = TRUE; + TI_set_hassubclass(ti); + STR_TO_NAME(ti->bestitem, TABLEOID_NAME); + STRX_TO_NAME(ti->bestqual, "\"" TABLEOID_NAME "\" = %u"); + } + if (!hassubclass) + { + if (0 == (table_info & TBINFO_HASOIDS)) + { + TI_set_has_no_oids(ti); + } + else + { + hasoids = TRUE; + TI_set_hasoids(ti); + STR_TO_NAME(ti->bestitem, OID_NAME); + STRX_TO_NAME(ti->bestqual, "\"" OID_NAME "\" = %u"); + } + } + ti->table_oid = coli->table_oid; + if (!hasoids && !hassubclass) + { + QResultClass *res = coli->result; + int num_tuples = res ? QR_get_num_cached_tuples(res) : -1; + + if (num_tuples > 0) + { + int i; + + for (i = 0; i < num_tuples; i++) + { + if (QR_get_value_backend_int(res, i, COLUMNS_AUTO_INCREMENT, NULL) != 0&& + QR_get_value_backend_int(res, i, COLUMNS_FIELD_TYPE, NULL) == PG_TYPE_INT4) + { + char query[512]; + + STR_TO_NAME(ti->bestitem, QR_get_value_backend_text(res, i, COLUMNS_COLUMN_NAME)); + SPRINTF_FIXED(query, "\"%s\" = %%d", SAFE_NAME(ti->bestitem)); + STRX_TO_NAME(ti->bestqual, query); + break; + } + } + } + } + TI_set_hasoids_checked(ti); + } + else + return FALSE; + + stmt->num_key_fields = PG_NUM_NORMAL_KEYS; + if (TI_has_subclass(ti)) + keyFound = FALSE; + else if (TI_has_oids(ti)) + keyFound = TRUE; + else if (NAME_IS_NULL(ti->bestqual)) + { + keyFound = TRUE; + stmt->num_key_fields--; + } + else + keyFound = TRUE; + MYLOG(DETAIL_LOG_LEVEL, "subclass=%d oids=%d bestqual=%s keyFound=%d num_key_fields=%d\n", TI_has_subclass(ti), TI_has_oids(ti), PRINT_NAME(ti->bestqual), keyFound, stmt->num_key_fields); + + SC_set_checked_hasoids(stmt, keyFound); + + return TRUE; +} + static BOOL CheckHasOids(StatementClass * stmt) { QResultClass *res; @@ -387,11 +473,15 @@ ConnectionClass *conn = SC_get_conn(stmt); TABLE_INFO *ti; +MYLOG(0, "Entering\n"); if (0 != SC_checked_hasoids(stmt)) return TRUE; if (!stmt->ti || !stmt->ti[0]) return FALSE; ti = stmt->ti[0]; + if (CheckHasOidsUsingSaved(stmt, ti)) + return TRUE; + // no longer come here?? SPRINTF_FIXED(query, "select relhasoids, c.oid, relhassubclass from pg_class c, pg_namespace n where relname = '%s' and nspname = '%s' and c.relnamespace = n.oid", SAFE_NAME(ti->table_name), SAFE_NAME(ti->schema_name)); @@ -456,6 +546,9 @@ } QR_Destructor(res); SC_set_checked_hasoids(stmt, foundKey); + + MYLOG(DETAIL_LOG_LEVEL, "subclass=%d oids=%d bestqual=%s foundKey=%d num_key_fields=%d\n", TI_has_subclass(ti), TI_has_oids(ti), PRINT_NAME(ti->bestqual), foundKey, stmt->num_key_fields); + return TRUE; } @@ -933,6 +1026,9 @@ coli->result = res; if (res && QR_get_num_cached_tuples(res) > 0) { + int num_tuples = QR_get_num_cached_tuples(res); + int i; + if (!greloid) greloid = (OID) strtoul(QR_get_value_backend_text(res, 0, COLUMNS_TABLE_OID), NULL, 10); if (!wti->table_oid) @@ -943,6 +1039,14 @@ if (NAME_IS_NULL(wti->table_name)) STR_TO_NAME(wti->table_name, QR_get_value_backend_text(res, 0, COLUMNS_TABLE_NAME)); + for (i = 0; i < num_tuples; i++) + { + if (NULL != QR_get_value_backend_text(res, 0, COLUMNS_TABLE_INFO)) + { + coli->table_info = QR_get_value_backend_int(res, 0, COLUMNS_TABLE_INFO, NULL); + break; + } + } } MYLOG(DETAIL_LOG_LEVEL, "#2 %p->table_name=%s(%u)\n", wti, PRINT_NAME(wti->table_name), wti->table_oid); /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/psqlodbc.c new/psqlodbc-10.03.0000/psqlodbc.c --- old/psqlodbc-10.02.0000/psqlodbc.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/psqlodbc.c 2018-05-19 12:32:53.000000000 +0200 @@ -154,7 +154,7 @@ #else /* not WIN32 */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__SUNPRO_C) /* Shared library initializer and destructor, using gcc's attributes */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/results.c new/psqlodbc-10.03.0000/results.c --- old/psqlodbc-10.02.0000/results.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/results.c 2018-05-19 12:32:53.000000000 +0200 @@ -2374,7 +2374,6 @@ SQLLEN *deleted; KeySet *deleted_keyset; UWORD status; - Int2 num_fields = res->num_fields; MYLOG(DETAIL_LOG_LEVEL, "entering " FORMAT_ULEN "\n", index); dl_count = res->dl_count; @@ -3058,7 +3057,7 @@ */ else { - SC_set_error(stmt,STMT_INTERNAL_ERROR, "can't find the add and updating row because of the lack of oid", func); + SC_set_error(stmt,STMT_INTERNAL_ERROR, "can't find added and updating row because of the lack of oid", func); goto cleanup; } } @@ -3091,7 +3090,7 @@ } else { - SC_set_error(stmt,STMT_INTERNAL_ERROR, "can't find the add and updating row because of the lack of oid", func); + SC_set_error(stmt,STMT_INTERNAL_ERROR, "can't find added and updating row because of the lack of oid", func); goto cleanup; } if (bestqual && oidint) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/setup.c new/psqlodbc-10.03.0000/setup.c --- old/psqlodbc-10.02.0000/setup.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/setup.c 2018-05-19 12:32:53.000000000 +0200 @@ -73,7 +73,9 @@ if (!hglbAttr) return FALSE; lpsetupdlg = (LPSETUPDLG) GlobalLock(hglbAttr); - /* Parse attribute string */ + + /* First of all, parse attribute string only for DSN entry */ + CC_conninfo_init(&(lpsetupdlg->ci), INIT_GLOBALS); if (lpszAttributes) ParseAttributes(lpszAttributes, lpsetupdlg); @@ -103,6 +105,20 @@ lpsetupdlg->fNewDSN = (ODBC_ADD_DSN == fRequest); lpsetupdlg->fDefault = !lstrcmpi(lpsetupdlg->ci.dsn, INI_DSN); + /* Cleanup conninfo and restore data source name */ + CC_conninfo_init(&(lpsetupdlg->ci), CLEANUP_FOR_REUSE | INIT_GLOBALS); + STRCPY_FIXED(lpsetupdlg->ci.dsn, lpsetupdlg->szDSN); + /* Get common attributes of Data Source */ + getDSNinfo(&(lpsetupdlg->ci), lpsetupdlg->lpszDrvr); + /* + * Parse attribute string again + * + * NOTE: Values supplied in the attribute string will always + * override settings in ODBC.INI + */ + if (lpszAttributes) + ParseAttributes(lpszAttributes, lpsetupdlg); + /* * Display the appropriate dialog (if parent window handle * supplied) @@ -118,8 +134,7 @@ } else if (lpsetupdlg->ci.dsn[0]) { - MYLOG(0, "about to getCiAllDefaults\n"); - getCiAllDefaults(&lpsetupdlg->ci); + MYLOG(0, "SetDSNAttributes\n"); fSuccess = SetDSNAttributes(hwnd, lpsetupdlg, NULL); } else @@ -279,15 +294,6 @@ SetWindowLongPtr(hdlg, DWLP_USER, lParam); CenterDialog(hdlg); /* Center dialog */ - /* - * NOTE: Values supplied in the attribute string will always - */ - /* override settings in ODBC.INI */ - - init_globals(&ci->drivers); - /* Get the rest of the common attributes */ - getDSNinfo(ci, lpsetupdlg->lpszDrvr); - /* Initialize dialog fields */ SetDlgStuff(hdlg, ci); @@ -579,8 +585,6 @@ size_t cbKey; char value[MAXPGPATH]; - CC_conninfo_init(&(lpsetupdlg->ci), INIT_GLOBALS); - for (lpsz = lpszAttributes; *lpsz; lpsz++) { /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/statement.c new/psqlodbc-10.03.0000/statement.c --- old/psqlodbc-10.02.0000/statement.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/statement.c 2018-05-19 12:32:53.000000000 +0200 @@ -457,6 +457,7 @@ rv->callbacks = NULL; GetDataInfoInitialize(SC_get_GDTI(rv)); PutDataInfoInitialize(SC_get_PDTI(rv)); + rv->lock_CC_for_rb = FALSE; INIT_STMT_CS(rv); } return rv; @@ -687,6 +688,11 @@ ProcessedStmt *pstmt; ProcessedStmt *next_pstmt; + if (self->lock_CC_for_rb) + { + LEAVE_CONN_CS(SC_get_conn(self)); + self->lock_CC_for_rb = FALSE; + } if (initializeOriginal) { if (self->statement) @@ -1422,6 +1428,8 @@ 0 < self->__error_number) return; } + if (!from_res) + return; self->__error_number = number; if (!check || message) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/statement.h new/psqlodbc-10.03.0000/statement.h --- old/psqlodbc-10.02.0000/statement.h 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/statement.h 2018-05-19 12:32:53.000000000 +0200 @@ -267,7 +267,7 @@ po_ind_t discard_output_params; /* discard output parameters on parse stage */ po_ind_t cancel_info; /* cancel information */ po_ind_t ref_CC_error; /* refer to CC_error ? */ -// po_ind_t lock_CC_for_rb; /* lock CC for statement rollback ? */ + po_ind_t lock_CC_for_rb; /* lock CC for statement rollback ? */ po_ind_t join_info; /* have joins ? */ po_ind_t parse_method; /* parse_statement is forced or ? */ po_ind_t curr_param_result; /* current param result is set ? */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/test/expected/catalogfunctions.out new/psqlodbc-10.03.0000/test/expected/catalogfunctions.out --- old/psqlodbc-10.02.0000/test/expected/catalogfunctions.out 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/test/expected/catalogfunctions.out 2018-05-19 12:32:53.000000000 +0200 @@ -65,6 +65,7 @@ TABLE OID: INTEGER(10) digits: 0, nullable BASE TYPEID: INTEGER(10) digits: 0, nullable TYPMOD: INTEGER(10) digits: 0, nullable +TABLE INFO: INTEGER(10) digits: 0, nullable Result set: contrib_regression public booltab id 4 int4 contrib_regression public booltab t 12 varchar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/test/expected/catalogfunctions_1.out new/psqlodbc-10.03.0000/test/expected/catalogfunctions_1.out --- old/psqlodbc-10.02.0000/test/expected/catalogfunctions_1.out 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/test/expected/catalogfunctions_1.out 2018-05-19 12:32:53.000000000 +0200 @@ -65,6 +65,7 @@ TABLE OID: INTEGER(10) digits: 0, nullable BASE TYPEID: INTEGER(10) digits: 0, nullable TYPMOD: INTEGER(10) digits: 0, nullable +TABLE INFO: INTEGER(10) digits: 0, nullable Result set: contrib_regression public booltab id 4 int4 contrib_regression public booltab t -9 varchar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/test/src/bulkoperations-test.c new/psqlodbc-10.03.0000/test/src/bulkoperations-test.c --- old/psqlodbc-10.02.0000/test/src/bulkoperations-test.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/test/src/bulkoperations-test.c 2018-05-19 12:32:53.000000000 +0200 @@ -68,7 +68,7 @@ * Initialize a table with some test data. */ printf("Creating test table bulkoperations_test\n"); - rc = SQLExecDirect(hstmt, (SQLCHAR *) "CREATE TEMPORARY TABLE bulkoperations_test(i int4, orig int4)", SQL_NTS); + rc = SQLExecDirect(hstmt, (SQLCHAR *) "CREATE TEMPORARY TABLE bulkoperations_test(i int4, orig serial)", SQL_NTS); CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt); rc = SQLExecDirect(hstmt, (SQLCHAR *) "INSERT INTO bulkoperations_test SELECT g, g FROM generate_series(1, 10) g", SQL_NTS); CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/test/src/cursor-block-delete-test.c new/psqlodbc-10.03.0000/test/src/cursor-block-delete-test.c --- old/psqlodbc-10.02.0000/test/src/cursor-block-delete-test.c 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/test/src/cursor-block-delete-test.c 2018-05-19 12:32:53.000000000 +0200 @@ -76,7 +76,7 @@ exit(1); } - rc = SQLExecDirect(hstmt, (SQLCHAR *) "create temporary table tmptable(id int4 primary key)", SQL_NTS); + rc = SQLExecDirect(hstmt, (SQLCHAR *) "create temporary table tmptable(id serial primary key)", SQL_NTS); CHECK_STMT_RESULT(rc, "SQLExecDirect create table failed", hstmt); /* insert into a table */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/version.h new/psqlodbc-10.03.0000/version.h --- old/psqlodbc-10.02.0000/version.h 2018-03-30 15:42:11.000000000 +0200 +++ new/psqlodbc-10.03.0000/version.h 2018-05-19 12:44:19.000000000 +0200 @@ -14,13 +14,13 @@ * and PG_DRVFILE_VERSION via winbuild/psqlodbc.vcxproj. */ #ifndef POSTGRESDRIVERVERSION -#define POSTGRESDRIVERVERSION "10.02.0000" +#define POSTGRESDRIVERVERSION "10.03.0000" #endif #ifndef POSTGRES_RESOURCE_VERSION #define POSTGRES_RESOURCE_VERSION POSTGRESDRIVERVERSION #endif #ifndef PG_DRVFILE_VERSION -#define PG_DRVFILE_VERSION 10,2,00,00 +#define PG_DRVFILE_VERSION 10,3,00,00 #endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/psqlodbc-10.02.0000/winbuild/regress.ps1 new/psqlodbc-10.03.0000/winbuild/regress.ps1 --- old/psqlodbc-10.02.0000/winbuild/regress.ps1 2018-03-30 15:35:01.000000000 +0200 +++ new/psqlodbc-10.03.0000/winbuild/regress.ps1 2018-05-19 12:32:54.000000000 +0200 @@ -8,7 +8,7 @@ "Clean" is available. .PARAMETER TestList Specify the list of test cases. If this parameter isn't specified(default), - all test cased are executed. + all test cases are executed. .PARAMETER Ansi Specify this switch in case of testing Ansi drivers. .PARAMETER DeclareFetch @@ -17,14 +17,15 @@ Used Visual Studio version is determined automatically unless this option is specified. .PARAMETER Platform - Specify build platforms, "x64"(default), "Win32" or "both" is available. + Specify platforms to test. "x64"(default), "Win32" or "both" is available. .PARAMETER Toolset MSBuild PlatformToolset is determined automatically unless this option is specified. Currently "v100", "Windows7.1SDK", "v110", "v110_xp", "v120", "v120_xp", "v140" or "v140_xp" is available. .PARAMETER MSToolsVersion MSBuild ToolsVersion is detemrined automatically unless this - option is specified. Currently "4.0", "12.0" or "14.0" is available. + option is specified. Currently "4.0", "12.0", "14.0" or "15.0" is + available. .PARAMETER Configuration Specify "Release"(default) or "Debug". .PARAMETER BuildConfigPath @@ -72,8 +73,9 @@ [ValidateSet("Debug", "Release")] [String]$Configuration="Release", [string]$BuildConfigPath, -[ValidateSet("off", "on", "all")] -[string]$DeclareFetch="on" +[ValidateSet("off", "on", "both")] +[string]$DeclareFetch="on", +[string]$SpecificDsn ) @@ -215,23 +217,22 @@ throw "`treset_db error" } $cnstr = @() - if (($DeclareFetch -eq "off") -or ($DeclareFetch -eq "all")) { - $cnstr += "UseDeclareFetch=0"; - } - if (($DeclareFetch -eq "on") -or ($DeclareFetch -eq "all")) { - $cnstr += "UseDeclareFetch=1"; + switch ($DeclareFetch) { + "off" { $cnstr += "UseDeclareFetch=0" } + "on" { $cnstr += "UseDeclareFetch=1" } + "both" { $cnstr += "UseDeclareFetch=0" + $cnstr += "UseDeclareFetch=1" } } if ($cnstr.length -eq 0) { $cnstr += $null; } - switch ($DeclareFetch) { - 0 { $env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST = "useDeclareFetch=" + $_ } - 1 { $env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST = "useDeclareFetch=" + $_ } - } for ($i = 0; $i -lt $cnstr.length; $i++) { $env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST = $cnstr[$i] - write-host "`tSetting by env variable:$env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST" + if ("$SpecificDsn" -ne "") { + $env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST += ";Database=contrib_regression;ConnSettings={set lc_messages='C'}" + } + write-host "`n`tSetting by env variable:$env:COMMON_CONNECTION_STRING_FOR_REGRESSION_TEST" .\runsuite $testexes --inputdir=$origdir } } catch [Exception] { @@ -350,6 +351,10 @@ $dllname="psqlsetup.dll" $setup="psqlsetup.dll" } +if ("$SpecificDsn" -ne "") { + Write-Host "`tSpecific DSN=$SpecificDsn" + $testdsn=$SpecificDsn +} foreach ($pl in $pary) { cd $scriptPath & ${msbuildexe} ${vcxfile} /tv:$MSToolsVersion "/p:Platform=$pl;Configuration=$Configuration;PlatformToolset=${Toolset}" /t:$vcx_target /p:VisualStudioVersion=${VCVersion} /Verbosity:minimal
