diff --git a/.gitignore b/.gitignore index 2534cd21..92bea7ac 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,8 @@ mac/iODBCtest/build/ mac/iODBCtestw/build/ mac/include/ mac/**/xcuserdata/ + +# +# IDE configuration files +# +.idea/ \ No newline at end of file diff --git a/README_MACOSX.md b/README_MACOSX.md old mode 100644 new mode 100755 index 57f990bd..9eab7122 --- a/README_MACOSX.md +++ b/README_MACOSX.md @@ -18,14 +18,28 @@ Packages, which you can download from . Then, execute the following commands in a terminal session, to build all the frameworks and demo applications: ```shell -$ cd mac -$ make +cd mac +make +``` + +If there are errors, first try to clean up temporary files: + +```shell +sudo make clean ``` After building the iODBC libraries and applications, you have to install them on your system with the command: ```shell -$ sudo make install +sudo make install +``` + +To generate and install a development build with debug symbols, run: + +```shell +sudo make realclean +make MODEL=Development +sudo make install MODEL=Development ``` This installs the `iODBCinst` and `iODBC` frameworks into — @@ -86,16 +100,16 @@ using the [HomeBrew package manager](http://brew.sh/) to install these tools, ac To build the libraries, open up a terminal session in **`Terminal.app`** or similar, and execute the following commands: ```shell -$ sh autogen.sh -$ ./configure -$ make +sh autogen.sh +./configure +make ``` To install the header files and libraries in `/usr/local`, execute the following command as an administrator, and provide that user's password when prompted: ```shell -$ sudo make install +sudo make install ``` Note that, by default, this will build components that only run on the CPU type you are building on, so `ppc` @@ -112,18 +126,18 @@ The following commands will build a release of iODBC that supports Mac OS X Leop Mac OS X Snow Leopard (10.6), on `ppc` (including as emulated by Rosetta), `x86`, and `x86_64`: ```shell -$ CFLAGS="-O -arch ppc -arch i386 -arch x86_64" -$ CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk" -$ CFLAGS="$CFLAGS -mmacosx-version-min=10.5" -$ export CFLAGS +CFLAGS="-O -arch ppc -arch i386 -arch x86_64" +CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk" +CFLAGS="$CFLAGS -mmacosx-version-min=10.5" +export CFLAGS -$ sh autogen.sh -$ ./configure \ +sh autogen.sh +./configure \ --disable-dependency-tracking \ --prefix=/usr/local/iODBC.universal -$ make -$ sudo make install +make +sudo make install ``` ### Mac OS X Lion (10.7) and OS X Mountain Lion (10.8) @@ -132,17 +146,17 @@ The following commands will build a release of iODBC that works on Mac OS X Lion and OS X Mountain Lion (10.8): ```shell -$ CFLAGS="-O -arch i386 -arch x86_64" -$ CFLAGS="$CFLAGS -mmacosx-version-min=10.7" -$ export CFLAGS +CFLAGS="-O -arch i386 -arch x86_64" +CFLAGS="$CFLAGS -mmacosx-version-min=10.7" +export CFLAGS -$ sh autogen.sh -$ ./configure \ +sh autogen.sh +./configure \ --disable-dependency-tracking \ --prefix=/usr/local/iODBC.universal -$ make -$ sudo make install +make +sudo make install ``` ### OS X Mavericks (10.9) through macOS Big Sur (11.x) on `x86` or `x86_64` (including Rosetta2 emulation) @@ -152,17 +166,17 @@ supporting other components built for `x86` (through macOS Mojave (10.14), where components) or `x86_64` (including Rosetta2 emulation): ```shell -$ CFLAGS="-O -arch i386 -arch x86_64" -$ CFLAGS="$CFLAGS -mmacosx-version-min=10.9" -$ export CFLAGS +CFLAGS="-O -arch i386 -arch x86_64" +CFLAGS="$CFLAGS -mmacosx-version-min=10.9" +export CFLAGS -$ sh autogen.sh -$ ./configure \ +sh autogen.sh +./configure \ --disable-dependency-tracking \ --prefix=/usr/local/iODBC.universal -$ make -$ sudo make install +$make +sudo make install ``` ### macOS Big Sur (11.x) through macOS Ventura (13.x) on `x86_64` (including Rosetta2 emulation) or `arm64` (Apple Silicon a/k/a M1 or M2) @@ -171,17 +185,17 @@ The following commands will build a release of iODBC that works on macOS Big Sur running on Intel (`x86_64`) or Apple Silicon (`arm64` a/k/a `M1` or `M2`): ```shell -$ CFLAGS="-O -arch arm64 -arch x86_64" -$ CFLAGS="$CFLAGS -mmacosx-version-min=10.9" -$ export CFLAGS +CFLAGS="-O -arch arm64 -arch x86_64" +CFLAGS="$CFLAGS -mmacosx-version-min=10.9" +export CFLAGS -$ sh autogen.sh -$ ./configure \ +sh autogen.sh +./configure \ --disable-dependency-tracking \ --prefix=/usr/local/iODBC.universal -$ make -$ sudo make install +make +sudo make install ``` ### Test DSN connection diff --git a/drvproxy/mac/IODBCProxy_LoginController.m b/drvproxy/mac/IODBCProxy_LoginController.m index e4435bf4..16efed47 100644 --- a/drvproxy/mac/IODBCProxy_LoginController.m +++ b/drvproxy/mac/IODBCProxy_LoginController.m @@ -97,13 +97,16 @@ BOOL showLogin(const char* title, const char *username, const char *password, TL NSInteger rc = [app runModalForWindow:dlg.window]; [dlg.window orderOut:dlg.window]; + + BOOL result = FALSE; if (log_t && rc == 1){ log_t->user = (char*)conv_NSString_to_char(dlg.d_uid); log_t->pwd = (char*)conv_NSString_to_char(dlg.d_pwd); log_t->ok = 1; + result = TRUE; } [dlg release]; - return rc == 1 ? TRUE : FALSE; + return result; } } diff --git a/iodbcadm/drvconn.c b/iodbcadm/drvconn.c index a66b2ccb..032f3534 100644 --- a/iodbcadm/drvconn.c +++ b/iodbcadm/drvconn.c @@ -272,7 +272,7 @@ iodbcdm_drvconn_dialboxw ( TDSNCHOOSER choose_t; wchar_t *string = NULL, *prov, *prov1, *szDSN = NULL, *szDriver = NULL; wchar_t *szFILEDSN = NULL, *szSAVEFILE = NULL; - wchar_t tokenstr[4096]; + wchar_t tokenstr[4096]= { L'\0' }; wchar_t drvbuf[4096] = { L'\0'}; char *_szdriver_u8 = NULL; wchar_t *_szdriver_w = NULL; @@ -280,6 +280,7 @@ iodbcdm_drvconn_dialboxw ( pDriverConnFunc pDrvConn; pDriverConnWFunc pDrvConnW; int i, skip; + size_t offset = 0; #if defined (__APPLE__) && !defined (NO_FRAMEWORKS) CFBundleRef bundle = NULL; CFBundleRef bundle_dll = NULL; @@ -379,8 +380,7 @@ iodbcdm_drvconn_dialboxw ( { WCSCPY (string, L"DSN="); WCSCAT (string, choose_t.dsn); - string[WCSLEN (string) + 1] = L'\0'; - szDSN = string + WCSLEN (L"DSN="); + szDSN = choose_t.dsn + L'\0'; retcode = SQL_SUCCESS; } else @@ -388,6 +388,58 @@ iodbcdm_drvconn_dialboxw ( if (sqlStat) *sqlStat = errSqlStat; } + + /* Try to copy the DSN parameters */ + offset = WCSLEN(string); + size_t remaining_space = cbInOutConnStr - offset; + BOOL buffer_error = FALSE; + + /* Set configuration mode once before reading parameters */ + SQLSetConfigMode(choose_t.type_dsn == SYSTEM_DSN ? ODBC_SYSTEM_DSN : ODBC_USER_DSN); + + /* Explicitly read parameters from odbc.ini */ + if (SQLGetPrivateProfileStringW(szDSN, NULL, L"", + tokenstr, sizeof(tokenstr)/sizeof(wchar_t), L"odbc.ini")) + { + /* Add each parameter to the connection string with semicolons */ + for (wchar_t *paramName = tokenstr; *paramName != L'\0'; paramName += (WCSLEN(paramName) + 1)) + { + wchar_t valueBuf[1024] = { L'\0' }; + + /* Skip "Driver" parameter if present in odbc.ini */ + if (WCSCASEEQ(paramName, L"Driver")) + continue; + + /* Get the value for this parameter */ + SQLGetPrivateProfileStringW(szDSN, paramName, L"", + valueBuf, sizeof(valueBuf)/sizeof(wchar_t), + L"odbc.ini"); + + size_t param_space = 1 + WCSLEN(paramName) + 1 + WCSLEN(valueBuf); + + /* Check if enough space remains */ + if (remaining_space > param_space) { + string[offset++] = L';'; + WCSCPY(string + offset, paramName); + offset += WCSLEN(paramName); + string[offset++] = L'='; + WCSCPY(string + offset, valueBuf); + offset += WCSLEN(valueBuf); + remaining_space -= param_space; + } + else { + if (sqlStat) + *sqlStat = errSqlStat; /* Use the already defined error state */ + retcode = SQL_ERROR; + buffer_error = TRUE; + break; + } + } + if (!buffer_error) + string[offset] = L'\0'; + + } + } else if (choose_t.fdsn && choose_t.type_dsn == FILE_DSN) { diff --git a/iodbcadm/mac/Helpers.m b/iodbcadm/mac/Helpers.m index dfa50bca..552c1c29 100644 --- a/iodbcadm/mac/Helpers.m +++ b/iodbcadm/mac/Helpers.m @@ -322,7 +322,7 @@ void addDrivers_to_list(NSArrayController* list) _drv_u8 = (char *) conv_NSString_to_char(a_drv); if (_drv_u8 == NULL) goto skip; - + if ((handle = DLL_OPEN(_drv_u8)) != NULL) { if ((allocHdl = (pSQLAllocHandle)DLL_PROC(handle, "SQLAllocHandle")) != NULL) @@ -718,12 +718,56 @@ void test_dsn(BOOL systemDSN, NSString *dsn, NSString *driver) wchar_t *szDSN = conv_NSString_to_wchar(dsn); wchar_t *szDriver = conv_NSString_to_wchar(driver); wchar_t connstr[4096] = { L'\0' }, outconnstr[4096] = { L'\0' }; + wchar_t tokenstr[4096] = { L'\0' }; HENV henv; HDBC hdbc; SWORD buflen; - - + size_t offset = 0; + if (szDSN && szDriver){ + /* Start with basic DSN */ + WCSCPY(connstr, L"DSN="); + WCSCAT(connstr, szDSN); + offset = WCSLEN(connstr); + + /* Set configuration mode once before reading parameters */ + SQLSetConfigMode(systemDSN ? ODBC_SYSTEM_DSN : ODBC_USER_DSN); + + /* Explicitly read parameters from odbc.ini */ + if (SQLGetPrivateProfileStringW(szDSN, NULL, L"", + tokenstr, sizeof(tokenstr)/sizeof(wchar_t), L"odbc.ini")) + { + /* Add each parameter to the connection string with semicolons */ + for (wchar_t *paramName = tokenstr; *paramName != L'\0'; paramName += (WCSLEN(paramName) + 1)) { + wchar_t valueBuf[1024] = { L'\0' }; + + /* Skip "Driver" parameter if present in odbc.ini */ + if (WCSCASEEQ(paramName, L"Driver")) + continue; + + /* Get the value for this parameter */ + SQLGetPrivateProfileStringW(szDSN, paramName, L"", + valueBuf, sizeof(valueBuf)/sizeof(wchar_t), + L"odbc.ini"); + + /* Add semicolon before next parameter */ + connstr[offset++] = L';'; + + /* Copy parameter name */ + WCSCPY(connstr + offset, paramName); + offset += WCSLEN(paramName); + + connstr[offset++] = L'='; + + /* Copy value */ + WCSCPY(connstr + offset, valueBuf); + offset += WCSLEN(valueBuf); + } + + /* Ensure string is properly terminated */ + connstr[offset] = L'\0'; + } + /* Make the connection */ #if (ODBCVER < 0x300) if (SQLAllocEnv (&henv) != SQL_SUCCESS) @@ -752,11 +796,7 @@ void test_dsn(BOOL systemDSN, NSString *dsn, NSString *driver) SQLFreeEnv (henv); goto done; } - - WCSCPY(connstr, L"DSN="); - WCSCAT(connstr, szDSN); - - SQLSetConfigMode (systemDSN?ODBC_SYSTEM_DSN: ODBC_USER_DSN); + if (SQLDriverConnectW (hdbc, (void*)1L, connstr, SQL_NTS, outconnstr, sizeof (outconnstr) / sizeof(wchar_t), &buflen, SQL_DRIVER_PROMPT) != SQL_SUCCESS) diff --git a/mac/GNUmakefile b/mac/GNUmakefile old mode 100644 new mode 100755 index 151a6c07..4eee2ae1 --- a/mac/GNUmakefile +++ b/mac/GNUmakefile @@ -73,7 +73,7 @@ # # iODBC VERSION # -IODBC_VERSION=3.52.16 +IODBC_VERSION=3.52.17 # @@ -101,6 +101,9 @@ xcodebuild_version := $(shell xcodebuild -version | grep -i Xcode | cut -d " " - # Common build settings # PROJBUILD := /usr/bin/xcodebuild -configuration $(MODEL) +DEPLOYMENT_TARGET := "10.13" +IODBC_UNI := "arm64 x86_64" +IODBC_X64 := "x86_64" IODBC_32BIT = "i386" @@ -113,35 +116,55 @@ endif # -# macOS 11.x (BigSur)does not have 32bit support +# macOS 11.x (BigSur) and later do not have 32bit support # -ifeq (11, $(findstring 11, $(macos_major))) +ifeq ($(shell test $(macos_version) -ge 11; echo $$?),0) IODBC_32BIT := "x86_64" endif +# +# Additional build flags for modern macOS +# +XCODE_FLAGS_UNI := MACOSX_DEPLOYMENT_TARGET=$(DEPLOYMENT_TARGET) ARCHS=$(IODBC_UNI) +XCODE_FLAGS_X64 := MACOSX_DEPLOYMENT_TARGET=$(DEPLOYMENT_TARGET) ARCHS=$(IODBC_X64) +PROJBUILD_UNI := $(PROJBUILD) $(XCODE_FLAGS_UNI) +PROJBUILD_X64 := $(PROJBUILD) $(XCODE_FLAGS_X64) # # Pass settings to xcodebuild # export IODBC_VERSION IODBC_32BIT +# +# Enable debug symbols for Development builds +# +ifeq ($(MODEL), Development) + CFLAGS += -g -O0 + CXXFLAGS += -g -O0 + LDFLAGS += -g +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + # # Build the libraries # all: check_supported include @echo "Building on macOS $(macos_version)" - @echo "Projbuild is [$(PROJBUILD)]" - cd iODBCinst; $(PROJBUILD) build - cd iODBC; $(PROJBUILD) build - cd iODBCtest; $(PROJBUILD) build - cd iODBCtestw; $(PROJBUILD) build - cd iODBCdrvproxy; $(PROJBUILD) build - cd iODBCadm; $(PROJBUILD) build - cd iODBCadministrator; $(PROJBUILD) build - cd iODBCadministrator64; $(PROJBUILD) build - cd iODBCdemo/DemoAnsi; $(PROJBUILD) build - cd iODBCdemo/DemoUnicode; $(PROJBUILD) build + @echo "Deployment Target is $(DEPLOYMENT_TARGET)" + @echo "Projbuild is [$(PROJBUILD_UNI)]" + cd iODBCinst; $(PROJBUILD_UNI) build + cd iODBC; $(PROJBUILD_UNI) build + cd iODBCtest; $(PROJBUILD_UNI) build + cd iODBCtestw; $(PROJBUILD_UNI) build + cd iODBCdrvproxy; $(PROJBUILD_UNI) build + cd iODBCadm; $(PROJBUILD_UNI) build + cd iODBCadministrator; $(PROJBUILD_UNI) build + cd iODBCadministrator64; $(PROJBUILD_X64) build + cd iODBCdemo/DemoAnsi; $(PROJBUILD_UNI) build + cd iODBCdemo/DemoUnicode; $(PROJBUILD_UNI) build # @@ -172,8 +195,8 @@ install: # -rm $(DESTDIR)/Library/Frameworks/iODBC.framework/Versions/Current -rm $(DESTDIR)/Library/Frameworks/iODBCinst.framework/Versions/Current - cd iODBCinst; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ - cd iODBC; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ + cd iODBCinst; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Frameworks/ + cd iODBC; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Frameworks/ # # Install /usr/local/iODBC # @@ -181,20 +204,20 @@ install: # # Install iODBC Administrator # - cd iODBCadministrator; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ - cd iODBCadministrator64; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ + cd iODBCadministrator; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Applications/iODBC; + cd iODBCadministrator64; $(PROJBUILD_X64) install DSTROOT=$(DESTDIR)/Applications/iODBC; # Next ones are a bit special as they need to be installed twice - cd iODBCadm; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBC.framework/Resources/ - cd iODBCadm; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBCinst.framework/Resources/ - cd iODBCdrvproxy; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBC.framework/Resources/ - cd iODBCdrvproxy; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBCinst.framework/Resources/ + cd iODBCadm; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBC.framework/Resources/ + cd iODBCadm; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBCinst.framework/Resources/ + cd iODBCdrvproxy; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBC.framework/Resources/ + cd iODBCdrvproxy; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBCinst.framework/Resources/ # # Install application # - cd iODBCdemo/DemoAnsi; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ - cd iODBCdemo/DemoUnicode; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ - cd iODBCtest; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ - cd iODBCtestw; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ + cd iODBCdemo/DemoAnsi; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Applications/iODBC + cd iODBCdemo/DemoUnicode; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Applications/iODBC + cd iODBCtest; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Application\ Support/iODBC/bin + cd iODBCtestw; $(PROJBUILD_UNI) install DSTROOT=$(DESTDIR)/Library/Application\ Support/iODBC/bin # @@ -202,16 +225,16 @@ install: # clean: rm -rf include - cd iODBC; $(PROJBUILD) clean - cd iODBCinst; $(PROJBUILD) clean - cd iODBCtest; $(PROJBUILD) clean - cd iODBCtestw; $(PROJBUILD) clean - cd iODBCdrvproxy; $(PROJBUILD) clean - cd iODBCadm; $(PROJBUILD) clean - cd iODBCadministrator; $(PROJBUILD) clean - cd iODBCadministrator64; $(PROJBUILD) clean - cd iODBCdemo/DemoAnsi; $(PROJBUILD) clean - cd iODBCdemo/DemoUnicode; $(PROJBUILD) clean + cd iODBC; $(PROJBUILD_UNI) clean + cd iODBCinst; $(PROJBUILD_UNI) clean + cd iODBCtest; $(PROJBUILD_UNI) clean + cd iODBCtestw; $(PROJBUILD_UNI) clean + cd iODBCdrvproxy; $(PROJBUILD_UNI) clean + cd iODBCadm; $(PROJBUILD_UNI) clean + cd iODBCadministrator; $(PROJBUILD_UNI) clean + cd iODBCadministrator64; $(PROJBUILD_X64) clean + cd iODBCdemo/DemoAnsi; $(PROJBUILD_UNI) clean + cd iODBCdemo/DemoUnicode; $(PROJBUILD_UNI) clean realclean: clean diff --git a/mac/iODBC/iODBC.xcodeproj/project.pbxproj b/mac/iODBC/iODBC.xcodeproj/project.pbxproj index c06e49a6..aacc07d8 100644 --- a/mac/iODBC/iODBC.xcodeproj/project.pbxproj +++ b/mac/iODBC/iODBC.xcodeproj/project.pbxproj @@ -691,6 +691,7 @@ CURRENT_PROJECT_VERSION = $IODBC_VERSION; DYLIB_COMPATIBILITY_VERSION = 1.0.0; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; EXPORTED_SYMBOLS_FILE = ""; FRAMEWORK_SEARCH_PATHS = ( ../../mac/iODBCinst/build/Development, @@ -698,13 +699,15 @@ ); FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; GCC_PREPROCESSOR_DEFINITIONS = ( _REENTRANT, WITH_PTHREADS, _MACX, IODBC_COCOA, + "DEBUG=1", ); HEADER_SEARCH_PATHS = ( ../../include, @@ -712,9 +715,11 @@ ../../iodbc, ); INFOPLIST_FILE = "Info-iODBC.plist"; - INSTALL_PATH = /Library/Frameworks; + INSTALL_PATH = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ + DYLIB_INSTALL_NAME_BASE = /Library/Frameworks; LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + LLVM_LTO = NO; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = "-fno-constant-cfstrings"; PRODUCT_BUNDLE_IDENTIFIER = org.iodbc.core; PRODUCT_NAME = iODBC; @@ -763,7 +768,8 @@ ../../iodbcinst, ); INFOPLIST_FILE = "Info-iODBC.plist"; - INSTALL_PATH = /Library/Frameworks; + INSTALL_PATH = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ + DYLIB_INSTALL_NAME_BASE = /Library/Frameworks; LIBRARY_SEARCH_PATHS = ""; MACOSX_DEPLOYMENT_TARGET = 10.9; OTHER_CFLAGS = "-fno-constant-cfstrings"; diff --git a/mac/iODBCadm/iODBCadm.xcodeproj/project.pbxproj b/mac/iODBCadm/iODBCadm.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 1512bb92..fb1642ca --- a/mac/iODBCadm/iODBCadm.xcodeproj/project.pbxproj +++ b/mac/iODBCadm/iODBCadm.xcodeproj/project.pbxproj @@ -565,11 +565,12 @@ x86_64, ); CLANG_ENABLE_OBJC_WEAK = YES; - COPY_PHASE_STRIP = YES; + COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = $IODBC_VERSION; - DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0.0; + /* DEPLOYMENT_POSTPROCESSING = YES; */ + /DYLIB_COMPATIBILITY_VERSION = 1.0.0; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; EXPORTED_SYMBOLS_FILE = ../../mac/iodbcadm.exp; FRAMEWORK_SEARCH_PATHS = ( ../../mac/iODBCinst/build/Development, @@ -580,20 +581,24 @@ FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_OPTIMIZATION_LEVEL = 2; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEBUGGING = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "ODBCVER=0x351", _MACX, IODBC_COCOA, + "DEBUG=1", ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = "Info-iODBCadm.plist"; - INSTALL_PATH = /; + INSTALL_PATH = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ + DYLIB_INSTALL_NAME_BASE = /Library/Frameworks; LIBRARY_SEARCH_PATHS = ""; LIBRARY_STYLE = BUNDLE; - MACOSX_DEPLOYMENT_TARGET = 10.9; + LLVM_LTO = NO; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = "-fno-constant-cfstrings"; OTHER_LDFLAGS = ( "-multiply_defined", @@ -603,8 +608,10 @@ PRODUCT_BUNDLE_IDENTIFIER = org.iodbc.adm; PRODUCT_NAME = iODBCadm; SECTORDER_FLAGS = ""; - SKIP_INSTALL = YES; - STRIPFLAGS = "-u -r -s ../../mac/iodbcadm.exp"; + SKIP_INSTALL = NO; + /* STRIPFLAGS = "-u -r -s ../../mac/iodbcadm.exp"; */ + STRIP_INSTALLED_PRODUCT = NO; + STRIP_STYLE = none; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -642,10 +649,11 @@ ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = "Info-iODBCadm.plist"; - INSTALL_PATH = /; + INSTALL_PATH = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ + DYLIB_INSTALL_NAME_BASE = /Library/Frameworks; LIBRARY_SEARCH_PATHS = ""; LIBRARY_STYLE = Bundle; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = "-fno-constant-cfstrings"; OTHER_LDFLAGS = ( "-multiply_defined", @@ -703,8 +711,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; STRIP_INSTALLED_PRODUCT = NO; }; name = Development; @@ -746,7 +754,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; STRIP_INSTALLED_PRODUCT = NO; }; name = Deployment; diff --git a/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.pbxproj b/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 82507500..33db836e --- a/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.pbxproj +++ b/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ 858A02D21B787ED900C8009C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 858A02D41B787EE500C8009C /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 858A02D51B787EE500C8009C /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 858A02DB1B7883E300C8009C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + 858A02DB1B7883E300C8009C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 85D1BBC707E7D7C90070A59E /* iODBC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iODBC.framework; path = ../../mac/iODBC/build/iODBC.framework; sourceTree = SOURCE_ROOT; }; CDAE3B890987D655003250F8 /* Info-iODBC_Administrator.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iODBC_Administrator.plist"; sourceTree = ""; }; CDAE3B8A0987D655003250F8 /* iODBC Administrator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iODBC Administrator.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -164,7 +164,7 @@ dependencies = ( ); name = "iODBC Administrator"; - productInstallPath = /Applications/iODBC; + productInstallPath = ""; /* set /Applications/iODBC in makefile to avoid cycle error */ productName = "iODBC Administrator"; productReference = CDAE3B8A0987D655003250F8 /* iODBC Administrator.app */; productType = "com.apple.product-type.application"; @@ -280,31 +280,35 @@ ); CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = YES; + COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = $IODBC_VERSION; - DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = ""; + /* DEPLOYMENT_POSTPROCESSING = YES; */ + /* DYLIB_COMPATIBILITY_VERSION = ""; */ DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; FRAMEWORK_SEARCH_PATHS = ( - ../../mac/iODBC/build/Deployment, + ../../mac/iODBC/build/Development, ../../mac/iODBC/build, - ../../mac/iODBCinst/build/Deployment, + ../../mac/iODBCinst/build/Development, ../../mac/iODBCinst/build, ); - FRAMEWORK_VERSION = 3.52; + /* FRAMEWORK_VERSION = 3.52; */ GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_OPTIMIZATION_LEVEL = 2; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DATEBUILD=`date`", "ODBCVER=0x351", _MACX, + "DEBUG=1", ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = "Info-iODBC_Administrator.plist"; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + LLVM_LTO = NO; + MACOSX_DEPLOYMENT_TARGET = 10.13; ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH)"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ( @@ -317,7 +321,7 @@ PRODUCT_NAME = "iODBC Administrator"; RESMERGER_SOURCES_FORK = data; SECTORDER_FLAGS = ""; - SKIP_INSTALL = YES; + SKIP_INSTALL = NO; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -352,9 +356,9 @@ ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = "Info-iODBC_Administrator.plist"; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH)"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ( @@ -366,6 +370,7 @@ PRODUCT_BUNDLE_IDENTIFIER = org.iodbc.iODBCAdministrator; PRODUCT_NAME = "iODBC Administrator"; SECTORDER_FLAGS = ""; + SKIP_INSTALL = NO; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -411,8 +416,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; }; name = Development; }; @@ -450,7 +455,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; diff --git a/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.pbxproj b/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 69296bdf..0743f32a --- a/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.pbxproj +++ b/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ 858A02D21B787ED900C8009C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 858A02D41B787EE500C8009C /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 858A02D51B787EE500C8009C /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 858A02DB1B7883E300C8009C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + 858A02DB1B7883E300C8009C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 85D1BBC707E7D7C90070A59E /* iODBC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iODBC.framework; path = ../../mac/iODBC/build/iODBC.framework; sourceTree = SOURCE_ROOT; }; CD75BBFB2637000B00ED5683 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = ../Base.lproj/MainMenu.xib; sourceTree = ""; }; CD75BBFC2637001000ED5683 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ../en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -164,7 +164,7 @@ dependencies = ( ); name = "iODBC Administrator64"; - productInstallPath = /Applications/iODBC; + productInstallPath = ""; /* set /Applications/iODBC in makefile to avoid cycle errors */ productName = "iODBC Administrator64"; productReference = CDAE3B8A0987D655003250F8 /* iODBC Administrator64.app */; productType = "com.apple.product-type.application"; @@ -277,31 +277,35 @@ ARCHS = x86_64; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = YES; + COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = $IODBC_VERSION; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = ""; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; FRAMEWORK_SEARCH_PATHS = ( - ../../mac/iODBC/build/Deployment, + ../../mac/iODBC/build/Development, ../../mac/iODBC/build, - ../../mac/iODBCinst/build/Deployment, + ../../mac/iODBCinst/build/Development, ../../mac/iODBCinst/build, ); FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_OPTIMIZATION_LEVEL = 2; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DATEBUILD=`date`", "ODBCVER=0x351", _MACX, + "DEBUG=1", ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = "Info-iODBC_Administrator.plist"; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle errors */ LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + LLVM_LTO = NO; + MACOSX_DEPLOYMENT_TARGET = 10.13; ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH)"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ( @@ -314,7 +318,7 @@ PRODUCT_NAME = "iODBC Administrator64"; RESMERGER_SOURCES_FORK = data; SECTORDER_FLAGS = ""; - SKIP_INSTALL = YES; + SKIP_INSTALL = NO; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -346,9 +350,9 @@ ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = "Info-iODBC_Administrator.plist"; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle errors */ LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH)"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ( @@ -360,6 +364,7 @@ PRODUCT_BUNDLE_IDENTIFIER = org.iodbc.iODBCAdministrator64; PRODUCT_NAME = "iODBC Administrator64"; SECTORDER_FLAGS = ""; + SKIP_INSTALL = NO; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -402,7 +407,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; ONLY_ACTIVE_ARCH = YES; }; name = Development; @@ -438,7 +443,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; diff --git a/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.pbxproj b/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index e46b4748..155846cc --- a/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.pbxproj +++ b/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.pbxproj @@ -152,7 +152,7 @@ dependencies = ( ); name = "iODBC Demo Ansi"; - productInstallPath = /Applications/iODBC; + productInstallPath = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ productName = "iODBC Demo Ansi"; productReference = CD7C37B70A063F40001A43B7 /* iODBC Demo Ansi.app */; productType = "com.apple.product-type.application"; @@ -293,9 +293,9 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ( - ../../mac/iODBC/build/Deployment, + ../../mac/iODBC/build/Development, ../../mac/iODBC/build, - ../../mac/iODBCinst/build/Deployment, + ../../mac/iODBCinst/build/Development, ../../mac/iODBCinst/build, ); GCC_NO_COMMON_BLOCKS = YES; @@ -306,8 +306,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; }; name = Development; }; @@ -353,7 +353,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; @@ -363,18 +363,25 @@ CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + ENABLE_NS_ASSERTIONS = YES; FRAMEWORK_SEARCH_PATHS = ( - ../../../mac/iODBC/build/Deployment, + ../../../mac/iODBC/build/Development, ../../../mac/iODBC/build, - ../../../mac/iODBCinst/build/Deployment, + ../../../mac/iODBCinst/build/Development, ../../../mac/iODBCinst/build, ); GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = InfoAnsi.plist; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ + LLVM_LTO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.openlinksw.iodbcdemo-ansi"; PRODUCT_NAME = "iODBC Demo Ansi"; WRAPPER_EXTENSION = app; @@ -392,13 +399,14 @@ ../../../mac/iODBCinst/build/Deployment, ../../../mac/iODBCinst/build, ); - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_MODEL_TUNING = G5; HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = InfoAnsi.plist; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ PRODUCT_BUNDLE_IDENTIFIER = "com.openlinksw.iodbcdemo-ansi"; PRODUCT_NAME = "iODBC Demo Ansi"; + SKIP_INSTALL = NO; WRAPPER_EXTENSION = app; }; name = Deployment; diff --git a/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.pbxproj b/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 1dd1fa1a..a4a3e934 --- a/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.pbxproj +++ b/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.pbxproj @@ -166,7 +166,7 @@ dependencies = ( ); name = "iODBC Demo Unicode"; - productInstallPath = /Applications/iODBC; + productInstallPath = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ productName = "iODBC Demo Unicode"; productReference = 8D1107320486CEB800E47090 /* iODBC Demo Unicode.app */; productType = "com.apple.product-type.application"; @@ -289,18 +289,25 @@ CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + ENABLE_NS_ASSERTIONS = YES; FRAMEWORK_SEARCH_PATHS = ( - ../../../mac/iODBC/build/Deployment, + ../../../mac/iODBC/build/Development, ../../../mac/iODBC/build, - ../../../mac/iODBCinst/build/Deployment, + ../../../mac/iODBCinst/build/Development, ../../../mac/iODBCinst/build, ); GCC_DYNAMIC_NO_PIC = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + ); HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = InfoUnicode.plist; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ + LLVM_LTO = NO; OTHER_CFLAGS = "-DUNICODE"; PRODUCT_BUNDLE_IDENTIFIER = "com.openlinksw.iodbcdemo-unicode"; PRODUCT_NAME = "iODBC Demo Unicode"; @@ -328,10 +335,11 @@ GCC_MODEL_TUNING = G5; HEADER_SEARCH_PATHS = ../../include; INFOPLIST_FILE = InfoUnicode.plist; - INSTALL_PATH = /Applications/iODBC; + INSTALL_PATH = "."; /* set /Applications/iODBC in makefile to avoid cycle error */ OTHER_CFLAGS = "-DUNICODE"; PRODUCT_BUNDLE_IDENTIFIER = "com.openlinksw.iodbcdemo-unicode"; PRODUCT_NAME = "iODBC Demo Unicode"; + SKIP_INSTALL = NO; WRAPPER_EXTENSION = app; }; name = Deployment; @@ -366,9 +374,9 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ( - ../../../mac/iODBC/build/Deployment, + ../../../mac/iODBC/build/Development, ../../../mac/iODBC/build, - ../../../mac/iODBCinst/build/Deployment, + ../../../mac/iODBCinst/build/Development, ../../../mac/iODBCinst/build, ); GCC_NO_COMMON_BLOCKS = YES; @@ -379,8 +387,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; }; name = Development; }; @@ -426,7 +434,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; diff --git a/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.pbxproj b/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 543b9618..4d37299e --- a/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.pbxproj +++ b/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.pbxproj @@ -374,12 +374,13 @@ x86_64, ); CLANG_ENABLE_OBJC_WEAK = YES; - COPY_PHASE_STRIP = YES; + COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = $IODBC_VERSION; "Current project version" = $IODBC_VERSION; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; EXPORTED_SYMBOLS_FILE = ../../mac/drvproxy.exp; FRAMEWORK_SEARCH_PATHS = ( ../../mac/iODBCinst/build/Development, @@ -387,12 +388,14 @@ ); FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_OPTIMIZATION_LEVEL = 2; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "ODBCVER=0x351", _MACX, IODBC_COCOA, + "DEBUG=1", ); HEADER_SEARCH_PATHS = ( ../../include, @@ -402,7 +405,8 @@ INSTALL_PATH = /; LIBRARY_SEARCH_PATHS = ""; LIBRARY_STYLE = Bundle; - MACOSX_DEPLOYMENT_TARGET = 10.9; + LLVM_LTO = NO; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = "-fno-constant-cfstrings"; OTHER_LDFLAGS = ( "-multiply_defined", @@ -453,7 +457,7 @@ INFOPLIST_FILE = "Info-iODBCdrvproxy.plist"; INSTALL_PATH = /; LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = "-fno-constant-cfstrings"; OTHER_LDFLAGS = ( "-multiply_defined", @@ -511,8 +515,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = ""; STRIP_INSTALLED_PRODUCT = NO; }; @@ -553,7 +557,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = ""; }; name = Deployment; diff --git a/mac/iODBCinst/iODBCinst.xcodeproj/project.pbxproj b/mac/iODBCinst/iODBCinst.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 4e16d689..3deb3b8c --- a/mac/iODBCinst/iODBCinst.xcodeproj/project.pbxproj +++ b/mac/iODBCinst/iODBCinst.xcodeproj/project.pbxproj @@ -66,7 +66,7 @@ 71DF013606A3E372007AF56B /* iodbcunix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = iodbcunix.h; path = ../../include/iodbcunix.h; sourceTree = SOURCE_ROOT; }; 7C530B5E07F075A7000BBF8D /* unicode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = unicode.c; path = ../../iodbcinst/unicode.c; sourceTree = SOURCE_ROOT; }; 7C530B6007F075D3000BBF8D /* unicode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = unicode.h; path = ../../iodbcinst/unicode.h; sourceTree = SOURCE_ROOT; }; - CD2616E108B138FD00D9BE06 /* iodbcinst.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = iodbcinst.h; path = ../include/iodbcinst.h; sourceTree = SOURCE_ROOT; }; + CD2616E108B138FD00D9BE06 /* iodbcinst.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = iodbcinst.h; path = ../../include/iodbcinst.h; sourceTree = SOURCE_ROOT; }; CD9487182636F68B00DBD85F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ../en.lproj/InfoPlist.strings; sourceTree = ""; }; CDAE3B100987CDA2003250F8 /* Info-iODBCinst.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iODBCinst.plist"; sourceTree = ""; }; CDAE3B110987CDA2003250F8 /* iODBCinst.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = iODBCinst.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -284,8 +284,8 @@ buildConfigurationList = CDAE3B0C0987CDA2003250F8 /* Build configuration list for PBXNativeTarget "iODBCinst" */; buildPhases = ( CDAE3AD20987CDA2003250F8 /* Headers */, - CDAE3AE30987CDA2003250F8 /* Resources */, CDAE3AE50987CDA2003250F8 /* Sources */, + CDAE3AE30987CDA2003250F8 /* Resources */, CDAE3B090987CDA2003250F8 /* Frameworks */, CDAE3B0B0987CDA2003250F8 /* Rez */, ); @@ -294,7 +294,7 @@ dependencies = ( ); name = iODBCinst; - productInstallPath = /Library/Frameworks; + productInstallPath = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ productName = iODBCinst; productReference = CDAE3B110987CDA2003250F8 /* iODBCinst.framework */; productType = "com.apple.product-type.framework"; @@ -444,8 +444,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; }; name = Development; }; @@ -484,7 +484,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; @@ -496,6 +496,7 @@ CURRENT_PROJECT_VERSION = $IODBC_VERSION; DYLIB_COMPATIBILITY_VERSION = 1.0.0; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; EXPORTED_SYMBOLS_FILE = ../../mac/iodbcinst.exp; FRAMEWORK_SEARCH_PATHS = ( ../../mac/iODBC/build/Deployment, @@ -503,12 +504,14 @@ ); FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEBUGGING = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "ODBCVER=0x351", _MACX, IODBC_COCOA, + "DEBUG=1", ); HEADER_SEARCH_PATHS = ( ../../include, @@ -516,14 +519,20 @@ ../../iodbc, ); INFOPLIST_FILE = "Info-iODBCinst.plist"; - INSTALL_PATH = /Library/Frameworks; + INSTALL_PATH = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ + DYLIB_INSTALL_NAME_BASE = /Library/Frameworks; LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; - OTHER_CFLAGS = "-fno-constant-cfstrings"; + LLVM_LTO = NO; + MACOSX_DEPLOYMENT_TARGET = 10.13; + OTHER_CFLAGS = ( + "-fno-constant-cfstrings", + ); PRODUCT_BUNDLE_IDENTIFIER = org.iodbc.inst; PRODUCT_NAME = iODBCinst; RESMERGER_SOURCES_FORK = data; SECTORDER_FLAGS = ""; + STRIP_INSTALLED_PRODUCT = NO; + STRIP_STYLE = none; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -561,9 +570,10 @@ ../../iodbc, ); INFOPLIST_FILE = "Info-iODBCinst.plist"; - INSTALL_PATH = /Library/Frameworks; + INSTALL_PATH = "."; /* set /Library/Frameworks makefile to avoid cycle errors */ + DYLIB_INSTALL_NAME_BASE = /Library/Frameworks; LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = "-fno-constant-cfstrings"; PRODUCT_BUNDLE_IDENTIFIER = org.iodbc.inst; PRODUCT_NAME = iODBCinst; diff --git a/mac/iODBCtest/iODBCtest.xcodeproj/project.pbxproj b/mac/iODBCtest/iODBCtest.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index fd26f297..02890b43 --- a/mac/iODBCtest/iODBCtest.xcodeproj/project.pbxproj +++ b/mac/iODBCtest/iODBCtest.xcodeproj/project.pbxproj @@ -95,7 +95,7 @@ dependencies = ( ); name = iodbctest; - productInstallPath = "/Library/Application Support/iODBC/bin"; + productInstallPath = "."; /* set "/Library/Application Support/iODBC/bin" in makefile to avoid cycle error */ productName = iodbctest; productReference = CDAE3B380987CEF4003250F8 /* iodbctest */; productType = "com.apple.product-type.tool"; @@ -160,6 +160,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = $IODBC_VERSION; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; FRAMEWORK_SEARCH_PATHS = ( ../../mac/iODBC/build/Development, ../../mac/iODBC/build, @@ -168,12 +169,16 @@ ); FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ""; + GCC_PREPROCESSOR_DEBUGGING = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + ); HEADER_SEARCH_PATHS = ../../include; - INSTALL_PATH = "/Library/Application Support/iODBC/bin"; + INSTALL_PATH = "."; /* set "/Library/Application Support/iODBC/bin" in makefile to avoid cycle error */ LIBRARY_SEARCH_PATHS = ""; + LLVM_LTO = NO; OTHER_CFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = iodbctest; @@ -207,7 +212,7 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = 2; HEADER_SEARCH_PATHS = ../../include; - INSTALL_PATH = "/Library/Application Support/iODBC/bin"; + INSTALL_PATH = "."; /* set "/Library/Application Support/iODBC/bin" in makefile to avoid cycle error */ LIBRARY_SEARCH_PATHS = ""; OTHER_CFLAGS = ""; OTHER_REZFLAGS = ""; @@ -259,8 +264,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; }; name = Development; }; @@ -298,7 +303,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; diff --git a/mac/iODBCtestw/iODBCtestw.xcodeproj/project.pbxproj b/mac/iODBCtestw/iODBCtestw.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 329a9d78..f75271f4 --- a/mac/iODBCtestw/iODBCtestw.xcodeproj/project.pbxproj +++ b/mac/iODBCtestw/iODBCtestw.xcodeproj/project.pbxproj @@ -95,7 +95,7 @@ dependencies = ( ); name = iodbctestw; - productInstallPath = "/Library/Application Support/iODBC/bin"; + productInstallPath = "."; /* set "/Library/Application Support/iODBC/bin" in makefile to avoid cycle error */ productName = iodbctestw; productReference = CDAE3B5A0987CF60003250F8 /* iodbctestw */; productType = "com.apple.product-type.tool"; @@ -155,11 +155,16 @@ CDAE3B570987CF60003250F8 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + arm64, + x86_64, + ); CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = $IODBC_VERSION; DYLIB_CURRENT_VERSION = $IODBC_VERSION; + ENABLE_NS_ASSERTIONS = YES; FRAMEWORK_SEARCH_PATHS = ( ../../mac/iODBC/build/Development, ../../mac/iODBC/build, @@ -168,12 +173,17 @@ ); FRAMEWORK_VERSION = 3.52; GCC_DYNAMIC_NO_PIC = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = UNICODE; + GCC_PREPROCESSOR_DEBUGGING = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + UNICODE, + "DEBUG=1", + ); HEADER_SEARCH_PATHS = ../../include; - INSTALL_PATH = "/Library/Application Support/iODBC/bin"; + INSTALL_PATH = "."; /* set "/Library/Application Support/iODBC/bin" in makefile to avoid cycle error */ LIBRARY_SEARCH_PATHS = ""; + LLVM_LTO = NO; OTHER_CFLAGS = ""; OTHER_REZFLAGS = ""; PRODUCT_NAME = iodbctestw; @@ -192,7 +202,11 @@ CDAE3B580987CF60003250F8 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; + ARCHS = ( + arm64, + x86_64, + ); + CLANG_ENABLE_OBJC_WEAK = YES; COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = $IODBC_VERSION; DYLIB_CURRENT_VERSION = $IODBC_VERSION; @@ -206,7 +220,7 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = 2; HEADER_SEARCH_PATHS = ../../include; - INSTALL_PATH = "/Library/Application Support/iODBC/bin"; + INSTALL_PATH = "."; /* set "/Library/Application Support/iODBC/bin" in makefile to avoid cycle error */ LIBRARY_SEARCH_PATHS = ""; OTHER_CFLAGS = ""; OTHER_REZFLAGS = ""; @@ -258,8 +272,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + ONLY_ACTIVE_ARCH = NO; }; name = Development; }; @@ -297,7 +311,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; }; name = Deployment; }; diff --git a/samples/iodbctest.c b/samples/iodbctest.c index dc222091..8631f839 100644 --- a/samples/iodbctest.c +++ b/samples/iodbctest.c @@ -84,6 +84,7 @@ #include #include #include +#include "odbcinst.h" /* * Prototypes @@ -91,6 +92,7 @@ int ODBC_Connect (char *connStr); int ODBC_Disconnect (void); int ODBC_Errors (char *where); +int ODBC_Errors_Ex (char *where, int neverExit); int ODBC_Test (void); #define MAXCOLS 32 @@ -190,6 +192,9 @@ ODBC_Connect (char *connStr) SQLTCHAR driverInfo[255]; SQLSMALLINT len1, len2; int status; + SQLTCHAR *szDSN = NULL; + SQLTCHAR tokenstr[4096] = { 0 }; + char *p; #ifdef UNICODE SQLWCHAR wdataSource[1024]; #endif @@ -311,18 +316,129 @@ ODBC_Connect (char *connStr) desc, NUMTCHAR (desc), &len2) == SQL_SUCCESS); } + /* Extract DSN name for potential later use with odbc.ini */ + szDSN = NULL; + if (!strncmp((char *)dataSource, "DSN=", 4)) { + char *dsn_start = (char *)dataSource + 4; + char *dsn_end = strchr(dsn_start, ';'); + + if (dsn_end) { + *dsn_end = '\0'; /* Temporarily terminate the DSN name */ +#ifdef UNICODE + OPL_A2W(dsn_start, tokenstr, sizeof(tokenstr)/sizeof(SQLTCHAR)); +#else + strcpy((char *)tokenstr, dsn_start); +#endif + szDSN = tokenstr; + *dsn_end = ';'; /* Restore the semicolon */ + } else { +#ifdef UNICODE + OPL_A2W(dsn_start, tokenstr, sizeof(tokenstr)/sizeof(SQLTCHAR)); +#else + strcpy((char *)tokenstr, dsn_start); +#endif + szDSN = tokenstr; + } + } else if (strchr((char *)dataSource, '=') == NULL) { + /* If no equals sign is found, use dataSource directly as the DSN name */ +#ifdef UNICODE + OPL_A2W((char *)dataSource, tokenstr, sizeof(tokenstr)/sizeof(SQLTCHAR)); +#else + strcpy((char *)tokenstr, dataSource); +#endif + szDSN = tokenstr; + } + + /* First try SQL_DRIVER_COMPLETE approach */ + /* only print errors, don't exit yet */ #ifdef UNICODE strcpy_A2W (wdataSource, (char *) dataSource); status = SQLDriverConnectW (hdbc, 0, (SQLWCHAR *) wdataSource, SQL_NTS, (SQLWCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_COMPLETE); - if (status != SQL_SUCCESS) - ODBC_Errors ("SQLDriverConnectW"); + if (status != SQL_SUCCESS) { + ODBC_Errors_Ex ("SQLDriverConnectW", 1); + printf ("\nTrying SQL_DRIVER_NOPROMPT using parameters from odbc.ini for DSN %S\n", szDSN); #else status = SQLDriverConnect (hdbc, 0, (SQLCHAR *) dataSource, SQL_NTS, (SQLCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_COMPLETE); - if (status != SQL_SUCCESS) - ODBC_Errors ("SQLDriverConnect"); + if (status != SQL_SUCCESS) { + ODBC_Errors_Ex("SQLDriverConnect", 1); + printf ("\nTrying SQL_DRIVER_NOPROMPT using parameters from odbc.ini for DSN %s\n", szDSN); +#endif + } + + /* If SQL_DRIVER_COMPLETE fails and we have a DSN, try SQL_DRIVER_NOPROMPT with parameters from odbc.ini */ + if ((status != SQL_SUCCESS && status != SQL_SUCCESS_WITH_INFO) && szDSN != NULL) { + /* Create a new connection string with parameters from odbc.ini */ + SQLCHAR newConnStr[4096] = {0}; + SQLTCHAR paramBuf[4096] = {0}; + SQLTCHAR valueBuf[1024] = {0}; + SQLSMALLINT paramLen = 0; + + /* Start with original DSN */ +#ifdef UNICODE + sprintf((char *)newConnStr, "DSN=%S", szDSN); +#else + sprintf((char *) newConnStr, "DSN=%s", szDSN); +#endif + + /* Set configuration mode to search in all DSN locations */ + SQLSetConfigMode(ODBC_BOTH_DSN); + + /* Get all parameter names for this DSN from odbc.ini */ + if (SQLGetPrivateProfileString(szDSN, NULL, TEXT(""), + paramBuf, sizeof(paramBuf) / sizeof(SQLTCHAR), TEXT("odbc.ini"))) { + SQLTCHAR *paramName = paramBuf; + + /* Loop through each parameter */ + while (*paramName) { + /* Skip "Driver" parameter if it exists in odbc.ini */ +#ifdef UNICODE + if (wcscasecmp(paramName, L"Driver") != 0) +#else + if (strcasecmp((char *) paramName, "Driver") != 0) #endif + { + /* Get value for this parameter */ + SQLGetPrivateProfileString(szDSN, paramName, TEXT(""), + valueBuf, sizeof(valueBuf) / sizeof(SQLTCHAR), TEXT("odbc.ini")); + + /* Add parameter to connection string */ + strcat((char *) newConnStr, ";"); +#ifdef UNICODE + sprintf((char *)newConnStr + strlen((char *)newConnStr), "%S=%S", + paramName, valueBuf); +#else + sprintf((char *) newConnStr + strlen((char *) newConnStr), "%s=%s", + paramName, valueBuf); +#endif + } + + /* Move to next parameter */ +#ifdef UNICODE + paramName += wcslen(paramName) + 1; +#else + paramName += strlen((char *) paramName) + 1; +#endif + } + } + + /* Now try connecting with the expanded parameters and SQL_DRIVER_NOPROMPT */ + /* If still failing, show error and exit */ + printf ("\nConnection string: %s\n", newConnStr); +#ifdef UNICODE + strcpy_A2W (wdataSource, (char *)newConnStr); + status = SQLDriverConnectW (hdbc, 0, (SQLWCHAR *) wdataSource, SQL_NTS, + (SQLWCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_NOPROMPT); + if (status != SQL_SUCCESS) + ODBC_Errors ("SQLDriverConnectW"); +#else + status = SQLDriverConnect(hdbc, 0, newConnStr, SQL_NTS, + (SQLCHAR *) outdsn, NUMTCHAR (outdsn), &buflen, SQL_DRIVER_NOPROMPT); + if (status != SQL_SUCCESS) + ODBC_Errors ("SQLDriverConnect"); +#endif + } if (status != SQL_SUCCESS && status != SQL_SUCCESS_WITH_INFO) return -1; @@ -434,7 +550,7 @@ ODBC_Disconnect (void) * Perform a disconnect/reconnect using the DSN stored from the original * SQLDriverConnect */ -int +int ODBC_Reconnect (void) { SQLRETURN status; @@ -489,11 +605,23 @@ ODBC_Reconnect (void) } + /* * Show all the error information that is available + * and exits on certain errors */ int -ODBC_Errors (char *where) +ODBC_Errors(char *where) +{ + return ODBC_Errors_Ex(where, 0); +} + +/* + * Show all the error information that is available. + * If neverExit is set, do not exit. + */ +int +ODBC_Errors_Ex (char *where, int neverExit) { SQLTCHAR buf[512]; SQLTCHAR sqlstate[15]; @@ -667,7 +795,7 @@ ODBC_Errors (char *where) /* * Force an exit status */ - if (force_exit) + if (force_exit && !neverExit) exit (-1); return -1; @@ -798,6 +926,12 @@ ODBC_Test () else if (!TXTCMP (request, TEXT ("quit")) || !TXTCMP (request, TEXT ("exit"))) break; /* If you want to quit, just say so */ + else if (!TXTCMP (request, TEXT ("sleep"))) + { /* Sleep for a while to allow debugger to connect */ + fprintf(stderr, "back in 30 seconds...\n"); + sleep(30); + continue; + } else { /* @@ -1002,12 +1136,20 @@ ODBC_Test () sts = SQLGetData (hstmt, colNum, SQL_C_CHAR, fetchBuffer, NUMTCHAR (fetchBuffer), &colIndicator); #endif - if (sts != SQL_SUCCESS_WITH_INFO && sts != SQL_SUCCESS) + if (sts != SQL_SUCCESS_WITH_INFO && sts != SQL_SUCCESS && sts != SQL_NO_DATA) { ODBC_Errors ("SQLGetData"); goto endCursor; } + /* + * Show empty data as empty string + */ + if (sts == SQL_NO_DATA) + { + fetchBuffer[0] = TEXTC ('\0'); + } + /* * Show NULL fields as **** */