Skip to content

Commit 9db4d8b

Browse files
committed
Fix of the build for not ODBC 3.8 DM's(read iOdbc) and new header
packaging. In the commit introdusing mariadb specific attributes were also added checks and correct sql states for unknown attributes from DS specific range. This used definition that is not present in iOdbc Since iOdbc does not really support ODBC 3.8 that header is not really needed. But for the case of direct linking it may be still useful.
1 parent 4e8f68d commit 9db4d8b

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

driver/ma_connection.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,13 @@ SQLRETURN MADB_Dbc::SetAttr(SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGE
355355
PrepareOnClient= ((SQLULEN)ValuePtr != SQL_FALSE);
356356
break;
357357
default:
358+
#ifdef SQL_DRIVER_CONN_ATTR_BASE
358359
if (Attribute >= SQL_DRIVER_CONN_ATTR_BASE)
359360
{
360361
// The error is for unknown by us attributes from driver specific attributes range
361362
return MADB_SetError(&Error, MADB_ERR_HYC00, nullptr, 0);
362363
}
364+
#endif
363365
break;
364366
}
365367
return Error.ReturnValue;
@@ -486,11 +488,14 @@ SQLRETURN MADB_Dbc::GetAttr(SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGE
486488
*(SQLULEN*)ValuePtr= PrepareOnClient ? SQL_TRUE : SQL_FALSE;
487489
break;
488490
default:
491+
// Basically - is DM is not ODBC 3.8
492+
#ifdef SQL_DRIVER_CONN_ATTR_BASE
489493
if (Attribute >= SQL_DRIVER_CONN_ATTR_BASE && Attribute < 0x00008000)
490494
{
491495
// The error is for unknown by us attributes from driver specific attributes range
492496
return MADB_SetError(&Error, MADB_ERR_HYC00, nullptr, 0);
493497
}
498+
#endif
494499
return MADB_SetError(&Error, MADB_ERR_HY024, nullptr, 0);
495500
}
496501
return Error.ReturnValue;

driver/ma_statement.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,11 +2348,13 @@ SQLRETURN MADB_StmtGetAttr(MADB_Stmt *Stmt, SQLINTEGER Attribute, SQLPOINTER Val
23482348
*(SQLULEN*)ValuePtr= Stmt->Options.PrepareOnClient ? SQL_TRUE : SQL_FALSE;
23492349
break;
23502350
default:
2351+
#ifdef SQL_DRIVER_CONN_ATTR_BASE
23512352
if (Attribute >= SQL_DRIVER_CONN_ATTR_BASE && Attribute < 0x00008000)
23522353
{
23532354
// The error is for unknown by us attributes from driver specific attributes range
23542355
return MADB_SetError(&Stmt->Error, MADB_ERR_HYC00, nullptr, 0);
23552356
}
2357+
#endif
23562358
// Should probably return error here as in other Attr functions, but not gonna change that
23572359
// in GA. TODO: for 3.3 of will it be 4.0
23582360

@@ -2582,11 +2584,13 @@ SQLRETURN MADB_StmtSetAttr(MADB_Stmt *Stmt, SQLINTEGER Attribute, SQLPOINTER Val
25822584
Stmt->Options.PrepareOnClient= ((SQLULEN)ValuePtr != SQL_FALSE);
25832585
break;
25842586
default:
2587+
#ifdef SQL_DRIVER_CONN_ATTR_BASE
25852588
if (Attribute >= SQL_DRIVER_CONN_ATTR_BASE && Attribute < 0x00008000)
25862589
{
25872590
// The error is for unknown by us attributes from driver specific attributes range
25882591
return MADB_SetError(&Stmt->Error, MADB_ERR_HYC00, nullptr, 0);
25892592
}
2593+
#endif
25902594
// HY024(that was here before) does not look correct - it's about wrong value, and not attribute. HY092 is also for DM
25912595
// But for the case of direct linking it looks legit.
25922596
return MADB_SetError(&Stmt->Error, MADB_ERR_HY024, nullptr, 0);

packaging/macos/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/distribution.plist.in
6666
${CMAKE_CURRENT_BINARY_DIR}/distribution.plist @ONLY)
6767
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build_package.sh.in
6868
${CMAKE_CURRENT_BINARY_DIR}/build_package.sh @ONLY)
69+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/copy_package_files.sh.in
70+
${CMAKE_CURRENT_BINARY_DIR}/copy_package_files.sh @ONLY)
6971

7072
ADD_EXECUTABLE(install_driver install_driver.c)
7173
TARGET_LINK_LIBRARIES(install_driver ${ODBC_INSTLIBS})
@@ -88,7 +90,7 @@ ENDIF()
8890

8991
IF(USE_SYSTEM_INSTALLED_LIB)
9092
ADD_CUSTOM_TARGET(copypkgfiles
91-
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/copy_package_files.sh $<TARGET_FILE_DIR:maodbc> $<TARGET_FILE_DIR:install_driver>
93+
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/copy_package_files.sh $<TARGET_FILE_DIR:maodbc> $<TARGET_FILE_DIR:install_driver>
9294
DEPENDS maodbc install_driver
9395
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
9496
ELSE()
@@ -98,7 +100,7 @@ ELSE()
98100
MESSAGE(STATUS "Configuring to include gnutls library(${GNUTLS_LIB}) into the package")
99101
ENDIF()
100102
ADD_CUSTOM_TARGET(copypkgfiles
101-
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/copy_package_files.sh $<TARGET_FILE_DIR:maodbc> $<TARGET_FILE_DIR:install_driver> $<TARGET_FILE_DIR:dialog> ${GNUTLS_LIB}
103+
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/copy_package_files.sh $<TARGET_FILE_DIR:maodbc> $<TARGET_FILE_DIR:install_driver> $<TARGET_FILE_DIR:dialog> ${GNUTLS_LIB}
102104
DEPENDS maodbc install_driver
103105
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
104106
ENDIF()

packaging/macos/copy_package_files.sh renamed to packaging/macos/copy_package_files.sh.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# *************************************************************************************/
2020

2121
LibPath="Library/MariaDB/MariaDB-Connector-ODBC"
22-
22+
SourceRootDir=@CMAKE_SOURCE_DIR@
2323
set -e
2424
rm -rf ./ROOT
2525

@@ -30,7 +30,8 @@ cp $2//install_driver ./ROOT/${LibPath}/bin
3030
CURRENTDIR=$(dirname "$0")
3131

3232
mkdir -p ./ROOT/${LibPath}/include/mariadb
33-
cp $SRCROOTDIR/../../include/mariadb/sqlmariadb.h ./ROOT/${LibPath}/include/mariadb/
33+
cp $SourceRootDir/include/mariadb/sqlmariadb.h ./ROOT/${LibPath}/include/mariadb/
34+
3435
if [ $3 ]; then
3536
mkdir ./ROOT/${LibPath}/plugin
3637
cp $3/dialog.so ./ROOT/${LibPath}/plugin/

0 commit comments

Comments
 (0)