Skip to content

Commit

Permalink
Fixed more unresolved externals
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Feb 12, 2015
1 parent 0cfdfd7 commit 9334392
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ SET(DSN_DIALOG_FILES ${CMAKE_SOURCE_DIR}/dsn/odbc_dsn.c

SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DMAODBC_DEBUG")

INCLUDE(${CMAKE_SOURCE_DIR}/cmake/SearchLibrary.cmake)

IF(WIN32)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/win)
SET(ODBC_LIBS odbc32)
Expand Down Expand Up @@ -75,6 +77,8 @@ IF(WIN32)
SET(MARIADB_CLIENT_FILENAME mariadbclient.lib)
SET(PLATFORM_DEPENDENCIES ws2_32)
ELSE()
SEARCH_LIBRARY(LIB_MATH floor m)
SET(PLATFORM_DEPENDENCIES ${LIB_MATH})
SET (MARIADB_ODBC_SOURCES ${MARIADB_ODBC_SOURCES} ma_platform_posix.c)
SET(MARIADB_CLIENT_FILENAME libmariadbclient.a)
SET(ODBC_LIBS odbc)
Expand Down
23 changes: 23 additions & 0 deletions cmake/SearchLibrary.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)

FUNCTION(SEARCH_LIBRARY library_name function liblist)
IF(${${library_name}})
RETURN()
ENDIF()
CHECK_FUNCTION_EXISTS(${function} ${function}_IS_SYS_FUNC)
# check if function is part of libc
IF(HAVE_${function}_IS_SYS_FUNC)
SET(${library_name} "" PARENT_SCOPE)
RETURN()
ENDIF()
FOREACH(lib ${liblist})
CHECK_LIBRARY_EXISTS(${lib} ${function} "" HAVE_${function}_IN_${lib})
IF(HAVE_${function}_IN_${lib})
SET(${library_name} ${lib} PARENT_SCOPE)
SET(HAVE_${library_name} 1 PARENT_SCOPE)
RETURN()
ENDIF()
ENDFOREACH()
ENDFUNCTION()

6 changes: 6 additions & 0 deletions ma_odbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,10 @@ SQLRETURN MA_SQLSetStmtAttr(SQLHSTMT StatementHandle,
SQLPOINTER ValuePtr,
SQLINTEGER StringLength);

SQLRETURN MA_SQLAllocConnect(SQLHANDLE InputHandle,
SQLHANDLE *OutputHandlePtr);

SQLRETURN MA_SQLAllocStmt(SQLHANDLE InputHandle,
SQLHANDLE *OutputHandlePtr);

#endif /* _ma_odbc_h_ */
16 changes: 14 additions & 2 deletions odbc_3_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,29 @@ SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT HandleType,
/* }}} */

/* {{{ SQLAllocConnect */
SQLRETURN MA_SQLAllocConnect(SQLHANDLE InputHandle,
SQLHANDLE *OutputHandlePtr)
{
return MA_SQLAllocHandle(SQL_HANDLE_DBC, InputHandle, OutputHandlePtr);
}
SQLRETURN SQL_API SQLAllocConnect(SQLHANDLE InputHandle,
SQLHANDLE *OutputHandlePtr)
{
return MA_SQLAllocHandle(SQL_HANDLE_DBC, InputHandle, OutputHandlePtr);
return MA_SQLAllocConnect(InputHandle, OutputHandlePtr);
}
/* }}} */

/* {{{ SQLAllocStmt */
SQLRETURN MA_SQLAllocStmt(SQLHANDLE InputHandle,
SQLHANDLE *OutputHandlePtr)
{
return MA_SQLAllocHandle(SQL_HANDLE_STMT, InputHandle, OutputHandlePtr);
}

SQLRETURN SQL_API SQLAllocStmt(SQLHANDLE InputHandle,
SQLHANDLE *OutputHandlePtr)
{
return MA_SQLAllocHandle(SQL_HANDLE_STMT, InputHandle, OutputHandlePtr);
return MA_SQLAllocStmt(InputHandle, OutputHandlePtr);
}
/* }}} */

Expand Down

0 comments on commit 9334392

Please sign in to comment.