Skip to content

Commit

Permalink
Merge branch 'main' into version16
Browse files Browse the repository at this point in the history
  • Loading branch information
davecramer authored Oct 1, 2024
2 parents bd9d86c + ab76a10 commit cc52469
Show file tree
Hide file tree
Showing 20 changed files with 612 additions and 54 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches: [ "main" ]
tags:
- 'REL-*'
- '!REL-*-mimalloc'
pull_request:
branches: [ "main" ]

Expand All @@ -23,9 +24,9 @@ env:
WORKFLOW_VERSION_POSTGRESQL: '1' # for build steps related to the 'cachePostgres' cache

# Software versions.
POSTGRESQL_SOURCE_TAG: 'REL_16_3'
POSTGRESQL_SOURCE_TAG: 'REL_17_STABLE'
POSTGRESQL_PACKAGE_FILEID: '1259019'
OPENSSL_VERSION: '3_3_0'
OPENSSL_VERSION: '3_3_2'
PKGCONFIGLITE_VERSION: '0.28-1'
WINFLEXBISON_VERSION: '2.5.24'
DIFFUTILS_VERSION: '2.8.7-1'
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ windows-local.mak
/Makefile.in
/aclocal.m4
/autom4te.cache/
/autom4te.cache/*
/config/
/config.h
/config.h.in
/config.log
/config.status
/configure
/libtool
/psqlodbca.la
/psqlodbcw.la
/stamp-h1

Expand Down Expand Up @@ -107,6 +109,11 @@ bld/
[Ll]og/
[Ll]ogs/

# Eclipse project options
/.project
/.cproject
/.settings

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
Expand Down
1 change: 1 addition & 0 deletions connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ CC_clear_col_info(ConnectionClass *self, BOOL destroy)
/* Going through COL_INFO cache table and releasing coli objects. */
if (coli = self->col_info[i], NULL != coli)
{
MYLOG(0, "!!!refcnt %p:%d -> %d\n", coli, coli->refcnt, coli->refcnt - 1);
coli->refcnt--;
if (coli->refcnt <= 0)
{
Expand Down
2 changes: 1 addition & 1 deletion convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ MYLOG(0, "null_cvt_date_string=%d\n", conn->connInfo.cvt_null_date_string);
else
{
SC_set_error(stmt, STMT_RETURN_NULL_WITHOUT_INDICATOR, "StrLen_or_IndPtr was a null pointer and NULL data was retrieved", func);
return SQL_ERROR;
return COPY_GENERAL_ERROR;
}
}

Expand Down
2 changes: 2 additions & 0 deletions descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,8 @@ static const struct
{ DESC_OPTION_NOT_FOR_THE_DRIVER, "HYC00", "HYC00" },
{ DESC_FETCH_OUT_OF_RANGE, "HY106", "S1106" },
{ DESC_COUNT_FIELD_INCORRECT, "07002", "07002" },
{ DESC_STATEMENT_NOT_PREPARED, "HY007", "S1010" },
{ DESC_STRING_DATA_TRUNCATED, "01004", "01004"}
};

static PG_ErrorInfo *DC_create_errorinfo(const DescriptorClass *self)
Expand Down
2 changes: 2 additions & 0 deletions descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,7 @@ enum {
,DESC_OPTION_NOT_FOR_THE_DRIVER
,DESC_FETCH_OUT_OF_RANGE
,DESC_COUNT_FIELD_INCORRECT
,DESC_STATEMENT_NOT_PREPARED
,DESC_STRING_DATA_TRUNCATED
};
#endif /* __DESCRIPTOR_H__ */
60 changes: 57 additions & 3 deletions docs/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,63 @@
</HEAD>

<body bgcolor="#ffffff" text="#000000" link="#ff0000" vlink="#a00000" alink="#0000ff">

<h1>psqlODBC release notes</h1>
<hr>
<ol type="1">
<h2><a id="17.00.0000">psqlODBC 17.00.0000 Release</a></h2>
Changes:<br />
<li>
Release: Update version numbers <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/52">PR #52</a>
Author: <a href="https://github.com/davecramer">Dave Cramer</a>
</li>
</ol>
<ol type="1">
<h2><a id="16.00.0006">psqlODBC 16.00.0006 Release</a></h2>
Changes:<br />
<li>
Change: Build against PostgreSQL 17 RC1 <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/44">PR #44</a>
Author: <a href="https://github.com/davecramer">Dave Cramer</a>
</li>
<li>
Fix: Double free of COL_INFO object <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/48">PR #48</a>
Fixes <a href="https://github.com/postgresql-interfaces/psqlodbc/issues/47"> Issue #47</a>
Author: <a href="https://github.com/progmachine">Alexandr Kuznetsov</a>
</li>

<h2><a id="16.00.0005">psqlODBC 16.00.0005 Release</a></h2>
Changes:<br />
<ol type="1">
<li>Fix: if the connection is broken when calling SQLFreeHandle, the client can't be notified <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/1">PR #1</a>
Author: <a href="https://github.com/apgrucza"> Adrian Grucza</a></li>
<li>Perf: Use mimalloc to improve performance and reduce memory allocation lock contention <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/6">PR#6</a></li>
<li>Add: Build and release using github actions <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/7">PR#7</a></li>
<li>Add: Support building against VC17 on AMD64 <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/9">PR#9</a>
Author: <a href="https://github.com/apgrucza"> Adrian Grucza</a></li>
<li>Fix: Fixed typos in all source code and documentations <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/11">PR#11</a>
Author <a href="https://github.com/Hunaid2000">Hunaid Sohail</a></li>
<li>Fix: during call SQLFreeHandle, if the connection is broken the client is not notified <a href-"https://github.com/postgresql-interfaces/psqlodbc/pull/12">PR #12</a>
Author: <a href="https://github.com/apgrucza"> Adrian Grucza</a></li>
</li>
<li>Fix: Key caches based on software versions <a href-"https://github.com/postgresql-interfaces/psqlodbc/pull/13">PR #13</a><
Author: <a href="https://github.com/apgrucza"> Adrian Grucza</a></li>
<li>Add: Add mimalloc release <a href-"https://github.com/postgresql-interfaces/psqlodbc/pull/14">PR #14</a>
Author: <a href="https://github.com/apgrucza"> Adrian Grucza</a></li>
<li>Fix: Use strdup on non-Windows systems <a href-"https://github.com/postgresql-interfaces/psqlodbc/pull/17">PR #17</a>
Author: <a href="https://github.com/apgrucza"> Adrian Grucza</a></li>
<li>Add: Implementation of SQLSetDescRec & SQLGetDescRec functions <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/23">PR#23</a>
Author <a href="https://github.com/Hunaid2000">Hunaid Sohail</a></li>
<li>Fix: Fix Memory leaks <a href="https://github.com/postgresql-interfaces/psqlodbc/issues/8">Issue #8</a> <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/25">PR#25</a>
Author: <a href="https://github.com/progmachine">Alexandr Kuznetsov</a>
</li>
<li> Fix: SQLGetData function can return an incorrect SQLSTATE <a href="https://github.com/postgresql-interfaces/psqlodbc/issues/33">Issue #33</a> <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/35"> PR #35</a>
Author: <a href=""https://github.com/omeuid">Carlos García</a>
</li>
<li>
Change: Build against PostgreSQL 17 Beta3 <a href="https://github.com/postgresql-interfaces/psqlodbc/pull/37">PR #37</a>
Author: <a href="https://github.com/davecramer">Dave Cramer</a>
</li>
</ol>
<h2><a id="16.00.0000">psqlODBC 16.00.0000 Release</a></h2>
Changes:<br />
<ol type="1">
Expand All @@ -27,7 +81,7 @@ <h2><a id="15.00.0000">psqlODBC 15.00.0000 Release</a></h2>
<h2><a id="13.02.0000">psqlODBC 13.02.0000 Release</a></h2>
Changes:<br />
<ol type="1">
<li>Fix a bug of CC_send_query_append() when the ignore_roundtrip_time flag is onRemove a mylog() call which is a dupilicate of the preceding MYLOG() macro call.</li>
<li>Fix a bug of CC_send_query_append() when the ignore_roundtrip_time flag is onRemove a mylog() call which is a duplicate of the preceding MYLOG() macro call.</li>
Also direct use of mylog() should be avoided because mylog() uses lots of CPU.
<li>Noticed that the password field on the PostgreSQL Connection</li>
dialog is always focused when empty, even when other fields that appear
Expand Down Expand Up @@ -90,7 +144,7 @@ <h2><a id="12.02.0000">psqlODBC 12.02.0000 Release</a></h2>
<li>Add a new *Display Optional Error Message* option. </li>
This option allows to
display error messages other than primary one.
Also add documentaition about the option and *Numeric as* option.
Also add documentation about the option and *Numeric as* option.
<li>Handle notice messages in libpq_bind_and_exec().</li>
Sets and resets a notify receiver around PQexecParams() or PQexecPrepared().
<li>Ignore PQtransactionStatus PQTRANS_ACTIVE in LIBPQ_update_transaction_status().
Expand Down
4 changes: 2 additions & 2 deletions info.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,18 +1565,18 @@ PGAPI_GetFunctions(HDBC hdbc,
case SQL_API_SQLFREEHANDLE: /* 1006 */
case SQL_API_SQLGETCONNECTATTR: /* 1007 */
case SQL_API_SQLGETDESCFIELD: /* 1008 */
case SQL_API_SQLGETDESCREC: /* 1009 */
case SQL_API_SQLGETDIAGFIELD: /* 1010 */
case SQL_API_SQLGETDIAGREC: /* 1011 */
case SQL_API_SQLGETENVATTR: /* 1012 */
case SQL_API_SQLGETSTMTATTR: /* 1014 */
case SQL_API_SQLSETCONNECTATTR: /* 1016 */
case SQL_API_SQLSETDESCFIELD: /* 1017 */
case SQL_API_SQLSETDESCREC: /* 1018 */
case SQL_API_SQLSETENVATTR: /* 1019 */
case SQL_API_SQLSETSTMTATTR: /* 1020 */
*pfExists = TRUE;
break;
case SQL_API_SQLGETDESCREC: /* 1009 */
case SQL_API_SQLSETDESCREC: /* 1018 */
case SQL_API_SQLCOPYDESC: /* 1004 */
*pfExists = FALSE;
break;
Expand Down
32 changes: 18 additions & 14 deletions odbcapi30.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,14 @@ SQLGetDescRec(SQLHDESC DescriptorHandle,
SQLLEN *Length, SQLSMALLINT *Precision,
SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
{
MYLOG(0, "Entering\n");
MYLOG(0, "Error not implemented\n");
return SQL_ERROR;
RETCODE ret;

MYLOG(0, "Entering h=%p rec=%d name=%p blen=%d\n", DescriptorHandle, RecNumber, Name, BufferLength);
MYLOG(0, "str=%p type=%p sub=%p len=%p prec=%p scale=%p null=%p\n", StringLength, Type, SubType, Length, Precision, Scale, Nullable);
ret = PGAPI_GetDescRec(DescriptorHandle, RecNumber, Name, BufferLength,
StringLength, Type, SubType, Length, Precision,
Scale, Nullable);
return ret;
}

/* new function */
Expand Down Expand Up @@ -459,9 +464,14 @@ SQLSetDescRec(SQLHDESC DescriptorHandle,
PTR Data, SQLLEN *StringLength,
SQLLEN *Indicator)
{
MYLOG(0, "Entering\n");
MYLOG(0, "Error not implemented\n");
return SQL_ERROR;
RETCODE ret;

MYLOG(0, "Entering h=%p rec=%d type=%d sub=%d len=" FORMAT_LEN " prec=%d scale=%d data=%p\n", DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data);
MYLOG(0, "str=%p ind=%p\n", StringLength, Indicator);
ret = PGAPI_SetDescRec(DescriptorHandle, RecNumber, Type,
SubType, Length, Precision, Scale, Data,
StringLength, Indicator);
return ret;
}
#endif /* UNICODE_SUPPORTXX */

Expand Down Expand Up @@ -646,20 +656,14 @@ MYLOG(DETAIL_LOG_LEVEL, "lie=%d\n", ci->drivers.lie);
SQL_FUNC_ESET(pfExists, SQL_API_SQLFREEHANDLE); /* 1006 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETCONNECTATTR); /* 1007 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDESCFIELD); /* 1008 */
if (ci->drivers.lie)
{
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDESCREC); /* 1009 not implemented yet */
}
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDESCREC); /* 1009 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDIAGFIELD); /* 1010 minimal implementation */
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETDIAGREC); /* 1011 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETENVATTR); /* 1012 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLGETSTMTATTR); /* 1014 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLSETCONNECTATTR); /* 1016 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLSETDESCFIELD); /* 1017 */
if (ci->drivers.lie)
{
SQL_FUNC_ESET(pfExists, SQL_API_SQLSETDESCREC); /* 1018 not implemented yet */
}
SQL_FUNC_ESET(pfExists, SQL_API_SQLSETDESCREC); /* 1018 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLSETENVATTR); /* 1019 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLSETSTMTATTR); /* 1020 */
SQL_FUNC_ESET(pfExists, SQL_API_SQLFETCHSCROLL); /* 1021 */
Expand Down
61 changes: 55 additions & 6 deletions odbcapi30w.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,37 @@ SQLGetDescRecW(SQLHDESC DescriptorHandle,
SQLLEN *Length, SQLSMALLINT *Precision,
SQLSMALLINT *Scale, SQLSMALLINT *Nullable)
{
MYLOG(0, "Entering\n");
MYLOG(0, "Error not implemented\n");
return SQL_ERROR;
RETCODE ret;
char *NameA = NULL;
SQLSMALLINT nlen;

MYLOG(0, "Entering h=%p rec=%d name=%p blen=%d\n", DescriptorHandle, RecNumber, Name, BufferLength);
MYLOG(0, "str=%p type=%p sub=%p len=%p prec=%p scale=%p null=%p\n", StringLength, Type, SubType, Length, Precision, Scale, Nullable);

if (BufferLength > 0)
NameA = malloc(BufferLength);

ret = PGAPI_GetDescRec(DescriptorHandle, RecNumber, (SQLCHAR *) NameA, BufferLength,
&nlen, Type, SubType, Length, Precision,
Scale, Nullable);
if (SQL_SUCCEEDED(ret))
{
if (NameA && nlen <= BufferLength)
{
SQLULEN ulen = utf8_to_ucs2_lf(NameA, nlen, FALSE, Name, BufferLength, TRUE);
if (ulen == (SQLULEN) -1)
nlen = (SQLSMALLINT) locale_to_sqlwchar((SQLWCHAR *) Name, NameA, BufferLength, FALSE);
else
nlen = (SQLSMALLINT) ulen;
if (nlen >= BufferLength)
ret = SQL_SUCCESS_WITH_INFO;
}
if (StringLength)
*StringLength = nlen;
}
if (NameA)
free(NameA);
return ret;
}

/* new function */
Expand All @@ -440,7 +468,28 @@ SQLSetDescRecW(SQLHDESC DescriptorHandle,
PTR Data, SQLLEN *StringLength,
SQLLEN *Indicator)
{
MYLOG(0, "Entering\n");
MYLOG(0, "Error not implemented\n");
return SQL_ERROR;
RETCODE ret;
SQLLEN vallen;
char *uval = NULL;
BOOL val_alloced = FALSE;

MYLOG(0, "Entering h=%p rec=%d type=%d sub=%d len=" FORMAT_LEN " prec=%d scale=%d data=%p\n", DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data);
MYLOG(0, "str=%p ind=%p\n", StringLength, Indicator);

if (Length > 0 || SQL_NTS == Length)
{
uval = ucs2_to_utf8(Data, Length > 0 ? Length / WCLEN : Length, &vallen, FALSE);
val_alloced = TRUE;
}
if (!val_alloced)
{
uval = Data;
vallen = Length;
}
ret = PGAPI_SetDescRec(DescriptorHandle, RecNumber, Type,
SubType, Length, Precision, Scale, uval,
&vallen, Indicator);
if (val_alloced)
free(uval);
return ret;
}
16 changes: 15 additions & 1 deletion parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ getColumnsInfo(ConnectionClass *conn, TABLE_INFO *wti, OID greloid, StatementCla
{
BOOL coli_exist = FALSE;
COL_INFO *coli = NULL, *ccoli = NULL, *tcoli;
int k;
int k, tmp_refcnt = 0;
time_t acctime = 0;

MYLOG(0, " Success\n");
Expand Down Expand Up @@ -882,6 +882,8 @@ getColumnsInfo(ConnectionClass *conn, TABLE_INFO *wti, OID greloid, StatementCla
if (coli_exist)
{
/* We have ready to use coli object. Cleaning it. */
tmp_refcnt = coli->refcnt; /* If we found coli with greloid, then some TABLE_INFO objects may have references to it -> save refcnt for them. */
tmp_refcnt--; /* Down the road we will increase refcnt again to account for the reference from ConnectionClass object to coli object. */
free_col_info_contents(coli);
}
else
Expand Down Expand Up @@ -921,6 +923,7 @@ getColumnsInfo(ConnectionClass *conn, TABLE_INFO *wti, OID greloid, StatementCla
}
col_info_initialize(coli);

coli->refcnt = tmp_refcnt;
coli->refcnt++; /* Counting one reference to coli object from connection COL_INFO cache table. */
coli->result = res;
if (res && QR_get_num_cached_tuples(res) > 0)
Expand Down Expand Up @@ -976,6 +979,17 @@ MYLOG(DETAIL_LOG_LEVEL, "oid item == %s\n", (const char *) QR_get_value_backend_
MYLOG(0, "Created col_info table='%s', ntables=%d\n", PRINT_NAME(wti->table_name), conn->ntables);
/* Associate a table from the statement with a SQLColumn info */
found = TRUE;
if (wti->col_info)
{
/* wti also has reference to COL_INFO object, so we must release it. */
MYLOG(0, "!!!refcnt %p:%d -> %d\n", wti->col_info, wti->col_info->refcnt, wti->col_info->refcnt - 1);
wti->col_info->refcnt--;
if (wti->col_info->refcnt <= 0)
{
free_col_info_contents(wti->col_info);
free(wti->col_info);
}
}
coli->refcnt++; /* Counting another one reference to coli object from TABLE_INFO wti object. */
wti->col_info = coli;
}
Expand Down
Loading

0 comments on commit cc52469

Please sign in to comment.