Skip to content

Commit

Permalink
Merge branch 'devel' into 2208-merge-dnssd
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f authored Mar 28, 2024
2 parents 2d83fa7 + 482c066 commit 056deb3
Show file tree
Hide file tree
Showing 40 changed files with 742 additions and 689 deletions.
6 changes: 3 additions & 3 deletions .github/actions/retry-action/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Retry Step
description: 'Retry a step on failure or timeout'
description: "Retry a step on failure or timeout"
inputs:
timeout_minutes:
description: Minutes to wait before attempt times out. Must only specify either minutes or seconds
Expand Down Expand Up @@ -50,5 +50,5 @@ outputs:
exit_error:
description: The final error returned by the command
runs:
using: 'node16'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
2 changes: 1 addition & 1 deletion .github/actions/retry-action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@types/babel-generator": "^6.25.7",
"@types/jest": "^28.1.6",
"@types/milliseconds": "0.0.30",
"@types/node": "^16.11.7",
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"@vercel/ncc": "^0.38.1",
Expand Down
357 changes: 191 additions & 166 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Data/ODBC/src/ConnectionHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void ConnectionHandle::setTimeouts(SQLULEN loginTimeout, SQLULEN timeout)
{
try
{
setTimeout(timeout);
setTimeout(static_cast<int>(timeout));
}
catch(const NotSupportedException&) {}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ bool ConnectionHandle::connect(const std::string& connectString, SQLULEN loginTi
// for Oracle) flat out refuse to set login timeout and return error - that's why these calls
// are wrapped in try/catch and silently ignore errors.
if (getTimeout() != timeout)
setTimeout(timeout);
setTimeout(static_cast<int>(timeout));
if (getLoginTimeout() != loginTimeout)
setLoginTimeout(loginTimeout);
}
Expand Down
2 changes: 1 addition & 1 deletion Data/ODBC/src/SessionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ inline Poco::Any SessionImpl::getCursorUse(const std::string&) const
void SessionImpl::setConnectionTimeout(std::size_t timeout)
{
SQLULEN value = static_cast<SQLUINTEGER>(timeout);
_db.setTimeout(value);
_db.setTimeout(static_cast<int>(value));
}


Expand Down
110 changes: 95 additions & 15 deletions Data/ODBC/src/Unicode_UNIXODBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/Unicode_UNIXODBC.h"
#include "Poco/Data/ODBC/Utility.h"
#include "Poco/TextConverter.h"
#include "Poco/UTF8Encoding.h"
#include "Poco/UTF16Encoding.h"
Expand Down Expand Up @@ -73,6 +74,12 @@ SQLRETURN SQLColAttribute(SQLHSTMT hstmt,
SQLSMALLINT* pcbCharAttr,
NumAttrPtrType pNumAttr)
{
SQLSMALLINT cbCharAttr = 0;
if (!pcbCharAttr) pcbCharAttr = &cbCharAttr;

SQLSMALLINT cbCharAttr;
if (!pcbCharAttr) pcbCharAttr = &cbCharAttr;

if (isString(pCharAttr, cbCharAttrMax))
{
Buffer<SQLWCHAR> buffer(stringLength(pCharAttr, cbCharAttrMax));
Expand All @@ -85,7 +92,9 @@ SQLRETURN SQLColAttribute(SQLHSTMT hstmt,
pcbCharAttr,
pNumAttr);

makeUTF8(buffer, *pcbCharAttr, pCharAttr, cbCharAttrMax);
if (!Utility::isError(rc))
makeUTF8(buffer, *pcbCharAttr, pCharAttr, cbCharAttrMax);

return rc;
}

Expand All @@ -107,6 +116,11 @@ SQLRETURN SQLColAttributes(SQLHSTMT hstmt,
SQLSMALLINT* pcbDesc,
SQLLEN* pfDesc)
{
SQLSMALLINT cbDesc = 0;
if (!pcbDesc) pcbDesc = &cbDesc;
SQLLEN fDesc = 0;
if (!pfDesc) pfDesc = &fDesc;

return SQLColAttribute(hstmt,
icol,
fDescType,
Expand Down Expand Up @@ -151,6 +165,17 @@ SQLRETURN SQLDescribeCol(SQLHSTMT hstmt,
SQLSMALLINT* pibScale,
SQLSMALLINT* pfNullable)
{
SQLSMALLINT cbColName = 0;
if (!pcbColName) pcbColName = &cbColName;
SQLSMALLINT fSqlType = 0;
if (!pfSqlType) pfSqlType = &fSqlType;
SQLULEN cbColDef = 0;
if (!pcbColDef) pcbColDef = &cbColDef;
SQLSMALLINT ibScale = 0;
if (!pibScale) pibScale = &ibScale;
SQLSMALLINT fNullable = 0;
if (!pfNullable) pfNullable = &fNullable;

Buffer<SQLWCHAR> buffer(cbColNameMax);
SQLRETURN rc = SQLDescribeColW(hstmt,
icol,
Expand All @@ -162,7 +187,9 @@ SQLRETURN SQLDescribeCol(SQLHSTMT hstmt,
pibScale,
pfNullable);

makeUTF8(buffer, *pcbColName * sizeof(SQLWCHAR), szColName, cbColNameMax);
if (!Utility::isError(rc))
makeUTF8(buffer, *pcbColName * sizeof(SQLWCHAR), szColName, cbColNameMax);

return rc;
}

Expand Down Expand Up @@ -198,6 +225,9 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC hdbc,
SQLINTEGER cbValueMax,
SQLINTEGER* pcbValue)
{
SQLINTEGER cbValue = 0;
if (!pcbValue) pcbValue = &cbValue;

if (isString(rgbValue, cbValueMax))
{
Buffer<SQLWCHAR> buffer(stringLength(rgbValue, cbValueMax));
Expand All @@ -208,7 +238,8 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC hdbc,
(SQLINTEGER) buffer.sizeBytes(),
pcbValue);

makeUTF8(buffer, *pcbValue, rgbValue, cbValueMax);
if (!Utility::isError(rc))
makeUTF8(buffer, *pcbValue, rgbValue, cbValueMax);
return rc;
}

Expand Down Expand Up @@ -263,6 +294,9 @@ SQLRETURN SQLGetDescField(SQLHDESC hdesc,
SQLINTEGER cbValueMax,
SQLINTEGER* pcbValue)
{
SQLINTEGER cbValue = 0;
if (!pcbValue) pcbValue = &cbValue;

if (isString(rgbValue, cbValueMax))
{
Buffer<SQLWCHAR> buffer(stringLength(rgbValue, cbValueMax));
Expand All @@ -274,7 +308,8 @@ SQLRETURN SQLGetDescField(SQLHDESC hdesc,
(SQLINTEGER) buffer.sizeBytes(),
pcbValue);

makeUTF8(buffer, *pcbValue, rgbValue, cbValueMax);
if (!Utility::isError(rc))
makeUTF8(buffer, *pcbValue, rgbValue, cbValueMax);

return rc;
}
Expand Down Expand Up @@ -312,6 +347,9 @@ SQLRETURN SQLGetDiagField(SQLSMALLINT fHandleType,
SQLSMALLINT cbDiagInfoMax,
SQLSMALLINT* pcbDiagInfo)
{
SQLSMALLINT cbDiagInfo = 0;
if (!pcbDiagInfo) pcbDiagInfo = &cbDiagInfo;

if (isString(rgbDiagInfo, cbDiagInfoMax))
{
Buffer<SQLWCHAR> buffer(stringLength(rgbDiagInfo, cbDiagInfoMax));
Expand All @@ -324,7 +362,8 @@ SQLRETURN SQLGetDiagField(SQLSMALLINT fHandleType,
(SQLSMALLINT) buffer.sizeBytes(),
pcbDiagInfo);

makeUTF8(buffer, *pcbDiagInfo, rgbDiagInfo, cbDiagInfoMax);
if (!Utility::isError(rc))
makeUTF8(buffer, *pcbDiagInfo, rgbDiagInfo, cbDiagInfoMax);

return rc;
}
Expand All @@ -348,6 +387,11 @@ SQLRETURN SQLGetDiagRec(SQLSMALLINT fHandleType,
SQLSMALLINT cbErrorMsgMax,
SQLSMALLINT* pcbErrorMsg)
{
SQLINTEGER fNativeError = 0;
if (!pfNativeError) pfNativeError = &fNativeError;
SQLSMALLINT cbErrorMsg = 0;
if (!pcbErrorMsg) pcbErrorMsg = &cbErrorMsg;

const SQLINTEGER stateLen = SQL_SQLSTATE_SIZE + 1;
Buffer<SQLWCHAR> bufState(stateLen);
Buffer<SQLWCHAR> bufErr(cbErrorMsgMax);
Expand All @@ -361,8 +405,11 @@ SQLRETURN SQLGetDiagRec(SQLSMALLINT fHandleType,
(SQLSMALLINT) bufErr.size(),
pcbErrorMsg);

makeUTF8(bufState, stateLen * sizeof(SQLWCHAR), szSqlState, stateLen);
makeUTF8(bufErr, *pcbErrorMsg * sizeof(SQLWCHAR), szErrorMsg, cbErrorMsgMax);
if (!Utility::isError(rc))
{
makeUTF8(bufState, stateLen * sizeof(SQLWCHAR), szSqlState, stateLen);
makeUTF8(bufErr, *pcbErrorMsg * sizeof(SQLWCHAR), szErrorMsg, cbErrorMsgMax);
}

return rc;
}
Expand Down Expand Up @@ -433,6 +480,9 @@ SQLRETURN SQLGetStmtAttr(SQLHSTMT hstmt,
SQLINTEGER cbValueMax,
SQLINTEGER* pcbValue)
{
SQLINTEGER cbValue = 0;
if (!pcbValue) pcbValue = &cbValue;

if (isString(rgbValue, cbValueMax))
{
Buffer<SQLWCHAR> buffer(stringLength(rgbValue, cbValueMax));
Expand Down Expand Up @@ -476,6 +526,9 @@ SQLRETURN SQLGetInfo(SQLHDBC hdbc,
SQLSMALLINT cbInfoValueMax,
SQLSMALLINT* pcbInfoValue)
{
SQLSMALLINT cbInfoValue = 0;
if (!pcbInfoValue) pcbInfoValue = &cbInfoValue;

if (cbInfoValueMax)
{
Buffer<SQLWCHAR> buffer(cbInfoValueMax);
Expand All @@ -486,7 +539,8 @@ SQLRETURN SQLGetInfo(SQLHDBC hdbc,
(SQLSMALLINT) buffer.sizeBytes(),
pcbInfoValue);

makeUTF8(buffer, *pcbInfoValue, rgbInfoValue, cbInfoValueMax);
if (!Utility::isError(rc))
makeUTF8(buffer, *pcbInfoValue, rgbInfoValue, cbInfoValueMax);

return rc;
}
Expand Down Expand Up @@ -561,6 +615,10 @@ SQLRETURN SQLDataSources(SQLHENV henv,
SQLSMALLINT cbDescMax,
SQLSMALLINT* pcbDesc)
{
SQLSMALLINT cbDSN = 0, cbDesc = 0;
if (!pcbDSN) pcbDSN = &cbDSN;
if (!pcbDesc) pcbDesc = &cbDesc;

Buffer<SQLWCHAR> bufDSN(cbDSNMax);
Buffer<SQLWCHAR> bufDesc(cbDescMax);

Expand All @@ -573,8 +631,11 @@ SQLRETURN SQLDataSources(SQLHENV henv,
(SQLSMALLINT) bufDesc.size(),
pcbDesc);

makeUTF8(bufDSN, *pcbDSN * sizeof(SQLWCHAR), szDSN, cbDSNMax);
makeUTF8(bufDesc, *pcbDesc * sizeof(SQLWCHAR), szDesc, cbDescMax);
if (!Utility::isError(rc))
{
makeUTF8(bufDSN, *pcbDSN * sizeof(SQLWCHAR), szDSN, cbDSNMax);
makeUTF8(bufDesc, *pcbDesc * sizeof(SQLWCHAR), szDesc, cbDescMax);
}

return rc;
}
Expand All @@ -589,6 +650,9 @@ SQLRETURN SQLDriverConnect(SQLHDBC hdbc,
SQLSMALLINT* pcbConnStrOut,
SQLUSMALLINT fDriverCompletion)
{
SQLSMALLINT cbConnStrOut = 0;
if (!pcbConnStrOut) pcbConnStrOut = &cbConnStrOut;

SQLSMALLINT len = cbConnStrIn;
if (SQL_NTS == len)
len = (SQLSMALLINT) std::strlen((const char*) szConnStrIn) + 1;
Expand All @@ -606,7 +670,8 @@ SQLRETURN SQLDriverConnect(SQLHDBC hdbc,
pcbConnStrOut,
fDriverCompletion);

makeUTF8(out, *pcbConnStrOut * sizeof(SQLWCHAR), pcbConnStrOut, cbConnStrOutMax);
if (!Utility::isError(rc))
makeUTF8(out, *pcbConnStrOut * sizeof(SQLWCHAR), pcbConnStrOut, cbConnStrOutMax);

return rc;
}
Expand All @@ -619,6 +684,9 @@ SQLRETURN SQLBrowseConnect(SQLHDBC hdbc,
SQLSMALLINT cbConnStrOutMax,
SQLSMALLINT* pcbConnStrOut)
{
SQLSMALLINT cbConnStrOut = 0;
if (!pcbConnStrOut) pcbConnStrOut = &cbConnStrOut;

std::string str;
makeUTF16(szConnStrIn, cbConnStrIn, str);

Expand All @@ -631,7 +699,8 @@ SQLRETURN SQLBrowseConnect(SQLHDBC hdbc,
(SQLSMALLINT) bufConnStrOut.size(),
pcbConnStrOut);

makeUTF8(bufConnStrOut, *pcbConnStrOut * sizeof(SQLWCHAR), szConnStrOut, cbConnStrOutMax);
if (!Utility::isError(rc))
makeUTF8(bufConnStrOut, *pcbConnStrOut * sizeof(SQLWCHAR), szConnStrOut, cbConnStrOutMax);

return rc;
}
Expand Down Expand Up @@ -676,6 +745,9 @@ SQLRETURN SQLNativeSql(SQLHDBC hdbc,
SQLINTEGER cbSqlStrMax,
SQLINTEGER* pcbSqlStr)
{
SQLINTEGER cbSqlStr = 0;
if (!pcbSqlStr) pcbSqlStr = &cbSqlStr;

std::string str;
makeUTF16(szSqlStrIn, cbSqlStrIn, str);

Expand All @@ -688,7 +760,8 @@ SQLRETURN SQLNativeSql(SQLHDBC hdbc,
(SQLINTEGER) bufSQLOut.size(),
pcbSqlStr);

makeUTF8(bufSQLOut, *pcbSqlStr * sizeof(SQLWCHAR), szSqlStr, cbSqlStrMax);
if (!Utility::isError(rc))
makeUTF8(bufSQLOut, *pcbSqlStr * sizeof(SQLWCHAR), szSqlStr, cbSqlStrMax);

return rc;
}
Expand Down Expand Up @@ -753,6 +826,10 @@ SQLRETURN SQLDrivers(SQLHENV henv,
SQLSMALLINT cbDrvrAttrMax,
SQLSMALLINT* pcbDrvrAttr)
{
SQLSMALLINT cbDriverDesc = 0, cbDrvrAttr = 0;
if (!pcbDriverDesc) pcbDriverDesc = &cbDriverDesc;
if (!pcbDrvrAttr) pcbDrvrAttr = &cbDrvrAttr;

Buffer<SQLWCHAR> bufDriverDesc(cbDriverDescMax);
Buffer<SQLWCHAR> bufDriverAttr(cbDrvrAttrMax);

Expand All @@ -765,8 +842,11 @@ SQLRETURN SQLDrivers(SQLHENV henv,
(SQLSMALLINT) bufDriverAttr.size(),
pcbDrvrAttr);

makeUTF8(bufDriverDesc, *pcbDriverDesc * sizeof(SQLWCHAR), szDriverDesc, cbDriverDescMax);
makeUTF8(bufDriverAttr, *pcbDrvrAttr * sizeof(SQLWCHAR), szDriverAttributes, cbDrvrAttrMax);
if (!Utility::isError(rc))
{
makeUTF8(bufDriverDesc, *pcbDriverDesc * sizeof(SQLWCHAR), szDriverDesc, cbDriverDescMax);
makeUTF8(bufDriverAttr, *pcbDrvrAttr * sizeof(SQLWCHAR), szDriverAttributes, cbDrvrAttrMax);
}

return rc;
}
Expand Down
Loading

0 comments on commit 056deb3

Please sign in to comment.