header file workaround for win_flex
This commit is contained in:
parent
1a5ec2e2ba
commit
48b1fd65f1
|
@ -14,9 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "todbc_conv.h"
|
#include "todbc_conv.h"
|
||||||
|
|
||||||
#include "todbc_util.h"
|
#include "todbc_util.h"
|
||||||
|
|
||||||
|
#include "os.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#ifndef _todbc_conv_h_
|
#ifndef _todbc_conv_h_
|
||||||
#define _todbc_conv_h_
|
#define _todbc_conv_h_
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include "todbc_flex_workaround.h"
|
||||||
#include <sqltypes.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "iconv.h"
|
#include "iconv.h"
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _todbc_flex_workaround_h_
|
||||||
|
#define _todbc_flex_workaround_h_
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
#ifndef INT8_MIN
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
#include <sql.h>
|
||||||
|
#include <sqlext.h>
|
||||||
|
|
||||||
|
#endif // _todbc_flex_workaround_h_
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
%{
|
%{
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <sql.h>
|
||||||
|
|
||||||
#include "todbc_util.h"
|
#include "todbc_util.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include "msvcLibgen.h"
|
||||||
|
#define strncasecmp _strnicmp
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct params_s params_t;
|
typedef struct params_s params_t;
|
||||||
struct params_s {
|
struct params_s {
|
||||||
char *key;
|
char *key;
|
||||||
|
@ -68,6 +78,8 @@ do { \
|
||||||
|
|
||||||
%option prefix="todbc_yy"
|
%option prefix="todbc_yy"
|
||||||
%option extra-type="struct params_s *"
|
%option extra-type="struct params_s *"
|
||||||
|
%option nounistd
|
||||||
|
%option never-interactive
|
||||||
%option reentrant
|
%option reentrant
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
%option noinput nounput
|
%option noinput nounput
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
|
|
||||||
#include "iconv.h"
|
#include "iconv.h"
|
||||||
|
|
||||||
#include <sql.h>
|
|
||||||
#include <sqltypes.h>
|
|
||||||
#include <sqlext.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
#ifndef _TODBC_UTIL_H_
|
#ifndef _TODBC_UTIL_H_
|
||||||
#define _TODBC_UTIL_H_
|
#define _TODBC_UTIL_H_
|
||||||
|
|
||||||
|
#include "todbc_flex_workaround.h"
|
||||||
#include "todbc_log.h"
|
#include "todbc_log.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <sql.h>
|
|
||||||
|
|
||||||
const char* sql_sql_type(int type);
|
const char* sql_sql_type(int type);
|
||||||
const char* sql_c_type(int type);
|
const char* sql_c_type(int type);
|
||||||
|
|
|
@ -9,5 +9,5 @@ ENDIF ()
|
||||||
IF (TD_WINDOWS_64)
|
IF (TD_WINDOWS_64)
|
||||||
AUX_SOURCE_DIRECTORY(. SRC)
|
AUX_SOURCE_DIRECTORY(. SRC)
|
||||||
ADD_EXECUTABLE(tcodbc main.c)
|
ADD_EXECUTABLE(tcodbc main.c)
|
||||||
TARGET_LINK_LIBRARIES(tcodbc odbc)
|
# TARGET_LINK_LIBRARIES(tcodbc odbc)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <libgen.h>
|
#include "os.h"
|
||||||
#include <sql.h>
|
#include <sql.h>
|
||||||
#include <sqlext.h>
|
#include <sqlext.h>
|
||||||
|
|
||||||
|
@ -423,7 +423,12 @@ int test_sqls_in_stmt(SQLHENV env, SQLHDBC conn, SQLHSTMT stmt, const char *sqls
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
ssize_t n = getline(&line, &len, f);
|
ssize_t n = 0;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
n = taosGetlineImp(&line, &len, f);
|
||||||
|
#else
|
||||||
|
n = getline(&line, &len, f);
|
||||||
|
#endif
|
||||||
if (n==-1) break;
|
if (n==-1) break;
|
||||||
|
|
||||||
const char *p = NULL;
|
const char *p = NULL;
|
||||||
|
|
Loading…
Reference in New Issue