Skip to content

Split conversion functions into own module #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3f51084
added setup API to the driver
bpintea Jul 29, 2018
2b31e19
fix formater script for more portability
bpintea Jul 30, 2018
23d9055
isolate GUI actions in two functions
bpintea Jul 30, 2018
edb0413
b/f: move content from builds/.gitignore into top
bpintea Jul 30, 2018
41f09f8
add a sammple DSN with the installation
bpintea Jul 31, 2018
e7585f1
b/f: fix buffer indexing with registry values
bpintea Aug 1, 2018
c3e3f5f
fix: changed DSN attrs to static alloc
bpintea Aug 7, 2018
9ad91cc
b/f: add ending quote in case string ends w/o WS
bpintea Aug 7, 2018
14fb508
(reindents)
bpintea Aug 7, 2018
4495dba
start on SQLGetData
bpintea Aug 7, 2018
7b0ba46
add the fetching resuming logic to SQLGetData()
bpintea Aug 9, 2018
817436a
small refactoring of xstr trasnfer function
bpintea Aug 10, 2018
52b5ceb
split conversion functions in separate module
bpintea Aug 10, 2018
a0ed4dd
fix compile warnings on x86
bpintea Aug 12, 2018
8739db5
b/f: fix crash in certain cases
bpintea Aug 12, 2018
ae49f5b
fix END error level returning
bpintea Aug 13, 2018
1e90181
fix gitignore: no * needed to ignore dir sub-cont.
bpintea Aug 13, 2018
aedca96
Merge pull request #14 from bpintea/feature/getdata
bpintea Aug 13, 2018
b6ea3e3
split conversion functions in separate module
bpintea Aug 10, 2018
3a7e880
fix compile warnings on x86
bpintea Aug 12, 2018
0ff94b1
b/f: fix crash in certain cases
bpintea Aug 12, 2018
c7160b1
Merge branch 'feature/convert_split' of github.com:bpintea/elasticsea…
bpintea Aug 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.swp
driver/*.swp
builds/
cscope.out
.vs
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ if (${WIN32})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_WARNINGS")
# don't complain about non-constant aggregate initializer (C4204)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ze")
# parallel building
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")

# 2MB stack size
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:2097152")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /F 2097152")

if (${IS_UNICODE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DUNICODE /D_UNICODE")
Expand Down Expand Up @@ -208,7 +214,6 @@ add_custom_target(curlclean
WORKING_DIRECTORY "${LIBCURL_PATH_SRC}/winbuild"
)


message("Driver source files: ${DRV_SRC} .")
message("Driver include paths: " ${ODBC_INC} ${DRV_SRC_DIR}
${LIBCURL_INC_PATH} ${UJSON4C_INC} ${CTIMESTAMP_PATH_SRC})
Expand All @@ -223,7 +228,7 @@ target_compile_definitions(${DRV_NAME} PRIVATE "DRIVER_BUILD")
include_directories(${ODBC_INC} ${DRV_SRC_DIR} ${LIBCURL_INC_PATH}
${UJSON4C_INC} ${CTIMESTAMP_PATH_SRC})

target_link_libraries(${DRV_NAME} libcurl)
target_link_libraries(${DRV_NAME} odbccp32 legacy_stdio_definitions libcurl)

# add testing project/target
enable_testing()
Expand Down
42 changes: 23 additions & 19 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ REM
REM presence of 'help'/'?': invoke USAGE "function" and exit
if /i not [%ARG:help=%] == [%ARG%] (
call:USAGE %0
goto end
goto END
) else if not [%ARG:?=%] == [%ARG%] (
call:USAGE %0
goto end
goto END
)

REM presence of 'proper' or 'clean': invoke respective "functions"
if /i not [%ARG:proper=%] == [%ARG%] (
call:PROPER
goto end
goto END
) else if /i not [%ARG:clean=%] == [%ARG%] (
call:CLEAN
)
Expand All @@ -69,7 +69,7 @@ if /i not [%ARG:setup=%] == [%ARG%] (
echo.
echo ERROR: building environment not set. Run with /? to see options.
echo.
goto end
goto END
)
)

Expand Down Expand Up @@ -136,10 +136,6 @@ if /i not [%ARG:regdel=%] == [%ARG%] (
REM Invoked without 'regadd': registry adding skipped.
)

:end
exit /b 0



REM
REM "Functions"
Expand Down Expand Up @@ -211,7 +207,7 @@ REM function to check and set cmake binary (if installed)
echo ERROR: needed cmake executable not found: when installed,
echo either set it in path or in environment variable CMAKE
echo.
goto end
goto END
)
) else (
set CMAKE=cmake.exe
Expand All @@ -231,7 +227,7 @@ REM USAGE function: output a usage message
echo setup : invoke MSVC's build environment setup script before
echo building (requires 2017 version or later^).
echo clean : remove all the files in the build dir.
echo proper : clean both the libs and builds dirs and exit.
echo proper : clean libs, builds and project dirs and exit.
echo nobuild : skip project building (the default is to build^).
echo type=T : selects the build type; T can be one of Debug/Release/
echo RelWithDebInfo/MinSizeRel^); defaults to Debug.
Expand Down Expand Up @@ -276,6 +272,8 @@ REM PROPER function: clean up the build and libs dir.
MSBuild %BUILD_DIR%\curlclean.vcxproj
)
call:CLEAN
REM delete VisualStudio files
rmdir /S /Q .vs

goto:eof

Expand Down Expand Up @@ -347,19 +345,18 @@ REM BUILD function: build various targets
) else if /i not [%ARG:all=%] == [%ARG%] (
echo Building all the project.
MSBuild ALL_BUILD.vcxproj %MSBUILD_ARGS%
) else if /i not [%ARG:suites=%] == [%ARG%] (
) else if /i not [%ARG:suiteS=%] == [%ARG%] (
echo Building the test projects only.
for %%i in (test\test_*.vcxproj) do (
MSBuild %%~fi %MSBUILD_ARGS%
if not ERRORLEVEL 1 (
if ERRORLEVEL 1 (
goto END
) else (
echo Running test\%CFG_INTDIR%\%%~ni.exe :
test\%CFG_INTDIR%\%%~ni.exe
if ERRORLEVEL 1 (
goto:eof
goto END
)
) else (
echo Building %%~fi failed.
goto:eof
)
)
) else if /i not [%ARG:suite==%] == [%ARG%] (
Expand All @@ -372,7 +369,9 @@ REM BUILD function: build various targets
echo Building and running one suite: !SUITE!
echo MSBuild test\%%a.vcxproj %MSBUILD_ARGS%
MSBuild test\%%a.vcxproj %MSBUILD_ARGS%
if not ERRORLEVEL 1 (
if ERRORLEVEL 1 (
goto END
) else (
test\%CFG_INTDIR%\%%a.exe
)
goto:eof
Expand All @@ -385,7 +384,7 @@ REM BUILD function: build various targets
REM file name expansion, cmd style...
for /f %%i in ("%DRIVER_BASE_NAME%*.vcxproj") do MSBuild %%~nxi %MSBUILD_ARGS%

if not ERRORLEVEL 1 if /i not [%ARG:symbols=%] == [%ARG%] (
if ERRORLEVEL 0 if /i not [%ARG:exports=%] == [%ARG%] (
dumpbin /exports %CFG_INTDIR%\%DRIVER_BASE_NAME%*.dll
)
)
Expand Down Expand Up @@ -440,7 +439,7 @@ REM REGADD function: add driver into the registry
REM check if driver exists, otherwise the filename is unknown
if not exist %BUILD_DIR%\%CFG_INTDIR%\%DRIVER_BASE_NAME%*.dll (
echo Error: Driver can only be added into the registry once built.
goto end
goto END
)
for /f %%i in ("%BUILD_DIR%\%CFG_INTDIR%\%DRIVER_BASE_NAME%*.dll") do set DRVNAME=%%~nxi

Expand Down Expand Up @@ -472,4 +471,9 @@ REM REGDEL function: remove driver from the registry

goto:eof



:END
exit /b %ERRORLEVEL%

endlocal
2 changes: 0 additions & 2 deletions builds/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion devtools/astyle-c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi
# Ensure astyle is available and is of the right version to have all below
# parameters supported.
#
if ! which -s astyle ; then
if ! which astyle &>/dev/null ; then
echo "ERROR: The astyle code formatter is not available. Exiting."
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion driver/build_def.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ REM Helper script to generate the definition file of symbols to export in DLL
@echo off

REM TODO: find out a smart way for this filtering
set FILTER="Select-String -Pattern 'SQLRETURN\s+SQL_API\s+\w+' *.c | %%{ [regex]::split($_, '\s+')[2]; } | %%{ [regex]::split($_, '\(')[0]; }"
set FILTER="Select-String -Pattern '^\w+\s+SQL_API\s+\w+(\(|$)' *.c | %%{ [regex]::split($_, '\s+')[2]; } | %%{ [regex]::split($_, '\(')[0]; }"

set DRV_NAME=%1
set OUTFILE=%2
Expand Down
4 changes: 4 additions & 0 deletions driver/catalogue.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// TODO add schema, when supported
#define SQL_COLUMNS(...) "SYS COLUMNS" __VA_ARGS__ \
" TABLE LIKE " ESODBC_STRING_DELIM WPFWP_LDESC ESODBC_STRING_DELIM \
" ESCAPE '" ESODBC_PATTERN_ESCAPE "' " \
" LIKE " ESODBC_STRING_DELIM WPFWP_LDESC ESODBC_STRING_DELIM
#define SQL_COL_CAT \
" CATALOG " ESODBC_STRING_DELIM WPFWP_LDESC ESODBC_STRING_DELIM \
Expand Down Expand Up @@ -159,6 +160,9 @@ size_t quote_tokens(SQLWCHAR *src, size_t len, SQLWCHAR *dest)
}
*pos ++ = src[i];
}
if (copying) {
*pos ++ = L'\''; /* end last token */
}
/* should not overrun */
assert(i < 2/*see typ_buf below*/ * ESODBC_MAX_IDENTIFIER_LEN);
return pos - dest;
Expand Down
Loading