Changeset: b333e9d1a26f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b333e9d1a26f
Added Files:
        sql/backends/monet5/sql_monet_backend.h
Removed Files:
        sql/backends/monet5/sql.h
Modified Files:
        clients/odbc/driver/CMakeLists.txt
        clients/odbc/driver/SQLColAttribute.c
        clients/odbc/driver/SQLConnect.c
        clients/odbc/driver/SQLGetInfo.c
        clients/odbc/tests/ODBCStmtAttr.c
        clients/odbc/tests/ODBCgetInfo.c
        cmake/Modules/FindSphinx.cmake
        common/stream/stream_internal.h
        monetdb_config.h.in
        sql/backends/monet5/CMakeLists.txt
        sql/backends/monet5/UDF/udf/udf.c
        sql/backends/monet5/dict.c
        sql/backends/monet5/dict.h
        sql/backends/monet5/for.c
        sql/backends/monet5/for.h
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_assert.h
        sql/backends/monet5/sql_bincopy.c
        sql/backends/monet5/sql_bincopyconvert.c
        sql/backends/monet5/sql_cast.c
        sql/backends/monet5/sql_cat.h
        sql/backends/monet5/sql_datetrunc.c
        sql/backends/monet5/sql_execute.h
        sql/backends/monet5/sql_fround.c
        sql/backends/monet5/sql_gencode.h
        sql/backends/monet5/sql_optimizer.h
        sql/backends/monet5/sql_orderidx.h
        sql/backends/monet5/sql_rank.h
        sql/backends/monet5/sql_result.h
        sql/backends/monet5/sql_round.c
        sql/backends/monet5/sql_scenario.h
        sql/backends/monet5/sql_statistics.h
        sql/backends/monet5/sql_subquery.h
        sql/backends/monet5/sql_time.c
        sql/backends/monet5/sql_transaction.h
        sql/backends/monet5/sql_upgrades.h
        sql/backends/monet5/sql_user.h
        sql/backends/monet5/vaults/fits/fits.c
        sql/backends/monet5/vaults/netcdf/netcdf.c
        sql/backends/monet5/vaults/odbc/odbc_loader.c
        sql/backends/monet5/vaults/shp/shp.c
        tools/monetdbe/monetdbe.c
Branch: default
Log Message:

Ported to Cygwin.  Renamed sql.h to sql_monet_backend.h due to conflict.


diffs (truncated from 632 to 300 lines):

diff --git a/clients/odbc/driver/CMakeLists.txt 
b/clients/odbc/driver/CMakeLists.txt
--- a/clients/odbc/driver/CMakeLists.txt
+++ b/clients/odbc/driver/CMakeLists.txt
@@ -130,7 +130,7 @@ target_link_libraries(MonetODBC
   monetdb_config_header
   mapi
   mutils
-  ${ODBCINST_LIBRARIES})
+  $<$<BOOL:${ODBCinst_FOUND}>:${ODBCINST_LIBRARIES}>)
 
 install(TARGETS
   MonetODBC
diff --git a/clients/odbc/driver/SQLColAttribute.c 
b/clients/odbc/driver/SQLColAttribute.c
--- a/clients/odbc/driver/SQLColAttribute.c
+++ b/clients/odbc/driver/SQLColAttribute.c
@@ -317,8 +317,15 @@ SQLColAttribute(SQLHSTMT StatementHandle
 
 SQLRETURN SQL_API
 SQLColAttributeA(SQLHSTMT StatementHandle,
+#ifdef _IODBCUNIX_H
+                /* iODBC, at least on Cygwin, uses SQLUSMALLINT */
+                SQLUSMALLINT ColumnNumber,
+                SQLUSMALLINT FieldIdentifier,
+#else
+                /* UNIXodbc and Windows ODBC use SQLSMALLINT */
                 SQLSMALLINT ColumnNumber,
                 SQLSMALLINT FieldIdentifier,
+#endif
                 SQLPOINTER CharacterAttributePtr,
                 SQLSMALLINT BufferLength,
                 SQLSMALLINT *StringLengthPtr,
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -40,7 +40,7 @@
 #endif
 
 #ifndef HAVE_SQLGETPRIVATEPROFILESTRING
-#define 
SQLGetPrivateProfileString(section,entry,default,buffer,bufferlen,filename)    
((int) strlcpy(buffer,default,bufferlen))
+#define 
SQLGetPrivateProfileString(section,entry,default,buffer,bufferlen,filename)    
((void) section, (int) strlcpy(buffer,default,bufferlen))
 #endif
 
 static SQLRETURN
diff --git a/clients/odbc/driver/SQLGetInfo.c b/clients/odbc/driver/SQLGetInfo.c
--- a/clients/odbc/driver/SQLGetInfo.c
+++ b/clients/odbc/driver/SQLGetInfo.c
@@ -223,7 +223,9 @@ MNDBGetInfo(ODBCDbc *dbc,
                        SQL_CVT_DECIMAL |
                        SQL_CVT_DOUBLE |
                        SQL_CVT_FLOAT |
+#ifdef SQL_CVT_GUID
                        SQL_CVT_GUID |
+#endif
                        SQL_CVT_INTEGER |
                        SQL_CVT_INTERVAL_DAY_TIME |
                        SQL_CVT_INTERVAL_YEAR_MONTH |
@@ -313,12 +315,14 @@ MNDBGetInfo(ODBCDbc *dbc,
                        SQL_CVT_TIMESTAMP |
                        SQL_CVT_VARCHAR;
                break;
+#ifdef SQL_CONVERT_GUID
        case SQL_CONVERT_GUID:
                nValue =SQL_CVT_CHAR |
                        SQL_CVT_GUID |
                        SQL_CVT_LONGVARCHAR |
                        SQL_CVT_VARCHAR;
                break;
+#endif
        case SQL_CONVERT_FUNCTIONS:
                nValue = SQL_FN_CVT_CAST | SQL_FN_CVT_CONVERT;
                break;
diff --git a/clients/odbc/tests/ODBCStmtAttr.c 
b/clients/odbc/tests/ODBCStmtAttr.c
--- a/clients/odbc/tests/ODBCStmtAttr.c
+++ b/clients/odbc/tests/ODBCStmtAttr.c
@@ -21,6 +21,15 @@
 #include <sql.h>
 #include <sqlext.h>
 
+#ifndef SIZEOF_LONG_INT
+#include <limits.h>
+#if LONG_MAX > INT_MAX
+#define SIZEOF_LONG_INT 8
+#else
+#define SIZEOF_LONG_INT 4
+#endif
+#endif
+
 static void
 prerr(SQLSMALLINT tpe, SQLHANDLE hnd, const char *func, const char *pref)
 {
diff --git a/clients/odbc/tests/ODBCgetInfo.c b/clients/odbc/tests/ODBCgetInfo.c
--- a/clients/odbc/tests/ODBCgetInfo.c
+++ b/clients/odbc/tests/ODBCgetInfo.c
@@ -212,6 +212,9 @@ const struct {
                .info = SQL_CONVERT_BIGINT,
                .name = "SQL_CONVERT_BIGINT",
                .type = INTEGER,
+#ifndef SQL_CVT_GUID
+#define SQL_CVT_GUID 0
+#endif
                .i = SQL_CVT_BIGINT | SQL_CVT_BIT | SQL_CVT_CHAR | 
SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | 
SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | 
SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | 
SQL_CVT_VARCHAR,
        },
        {
diff --git a/cmake/Modules/FindSphinx.cmake b/cmake/Modules/FindSphinx.cmake
--- a/cmake/Modules/FindSphinx.cmake
+++ b/cmake/Modules/FindSphinx.cmake
@@ -8,17 +8,19 @@
 # For copyright information, see the file debian/copyright.
 #]]
 
-find_program(SPHINX_EXECUTABLE NAMES sphinx-build
-  HINTS
-  $ENV{SPHINX_DIR}
-  PATH_SUFFIXES bin
-  DOC "Sphinx documentation generator"
-)
- 
-include(FindPackageHandleStandardArgs)
- 
-find_package_handle_standard_args(Sphinx DEFAULT_MSG
-  SPHINX_EXECUTABLE
-)
- 
-mark_as_advanced(SPHINX_EXECUTABLE)
+if(NOT CYGWIN)
+  find_program(SPHINX_EXECUTABLE NAMES sphinx-build
+    HINTS
+    $ENV{SPHINX_DIR}
+    PATH_SUFFIXES bin
+    DOC "Sphinx documentation generator"
+    )
+
+  include(FindPackageHandleStandardArgs)
+
+  find_package_handle_standard_args(Sphinx DEFAULT_MSG
+    SPHINX_EXECUTABLE
+    )
+
+  mark_as_advanced(SPHINX_EXECUTABLE)
+endif()
diff --git a/common/stream/stream_internal.h b/common/stream/stream_internal.h
--- a/common/stream/stream_internal.h
+++ b/common/stream/stream_internal.h
@@ -172,10 +172,6 @@ struct stream {
        char errmsg[1024]; // avoid allocation on error. We don't have THAT 
many streams..
 };
 
-#ifdef __CYGWIN__
-#define __visibility__(a)
-#endif
-
 void mnstr_va_set_error(stream *s, mnstr_error_kind kind, const char *fmt, 
va_list ap)
        __attribute__((__visibility__("hidden")));
 
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -35,8 +35,8 @@
 
 #endif
 
-#if !defined(_XOPEN_SOURCE) && defined(__CYGWIN__)
-#define _XOPEN_SOURCE 700
+#if !defined(_GNU_SOURCE) && defined(__CYGWIN__)
+#define _GNU_SOURCE 1
 #endif
 
 #include <stdlib.h>
@@ -119,10 +119,6 @@
 
 #endif /* _MSC_VER */
 
-#if !defined(WIN32) && defined(__CYGWIN__)
-#define WIN32 1
-#endif
-
 // functions that may or may not be available
 #cmakedefine HAVE_ACCEPT4 1
 #cmakedefine HAVE_ASCTIME_R 1
@@ -429,6 +425,8 @@ typedef __uint128_t uint128_t;
 #endif
 #if !__has_attribute(__visibility__)
 #define __visibility__(...)
+#elif defined(__CYGWIN__)
+#define __visibility__(...)
 #endif
 #if !__has_attribute(__warn_unused_result__)
 #define __warn_unused_result__
@@ -458,7 +456,7 @@ typedef __uint128_t uint128_t;
  * version, so that won't fly.  Instead we look at __USE_GNU which only
  * the GNU library defines (if _GNU_SOURCE is defined) and is the one
  * actually used in the GNU header file to make the distinction. */
-#if defined(__USE_GNU) && defined(HAVE_STRERROR_R)
+#if (defined(__USE_GNU) || defined(__GNU_VISIBLE)) && defined(HAVE_STRERROR_R)
 #define STRERROR_R_CHARP 1
 #endif
 
diff --git a/sql/backends/monet5/CMakeLists.txt 
b/sql/backends/monet5/CMakeLists.txt
--- a/sql/backends/monet5/CMakeLists.txt
+++ b/sql/backends/monet5/CMakeLists.txt
@@ -133,7 +133,7 @@ create_include_object(
 
 target_sources(sql
   PRIVATE
-  sql.c sql.h
+  sql.c sql_monet_backend.h
   mal_backend.c
   sql_user.c sql_user.h
   sql_scenario.c sql_scenario.h
diff --git a/sql/backends/monet5/UDF/udf/udf.c 
b/sql/backends/monet5/UDF/udf/udf.c
--- a/sql/backends/monet5/UDF/udf/udf.c
+++ b/sql/backends/monet5/UDF/udf/udf.c
@@ -10,7 +10,7 @@
 
 /* monetdb_config.h must be the first include in each .c file */
 #include "monetdb_config.h"
-#include "sql.h"
+#include "sql_monet_backend.h"
 #include "str.h"
 #include <string.h>
 
diff --git a/sql/backends/monet5/dict.c b/sql/backends/monet5/dict.c
--- a/sql/backends/monet5/dict.c
+++ b/sql/backends/monet5/dict.c
@@ -9,7 +9,7 @@
  */
 
 #include "monetdb_config.h"
-#include "sql.h"
+#include "sql_monet_backend.h"
 #include "mal.h"
 #include "mal_client.h"
 
diff --git a/sql/backends/monet5/dict.h b/sql/backends/monet5/dict.h
--- a/sql/backends/monet5/dict.h
+++ b/sql/backends/monet5/dict.h
@@ -11,7 +11,7 @@
 #ifndef _DICT_H
 #define _DICT_H
 
-#include "sql.h"
+#include "sql_monet_backend.h"
 
 extern str FORcompress_col(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
 extern str FORdecompress(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
diff --git a/sql/backends/monet5/for.c b/sql/backends/monet5/for.c
--- a/sql/backends/monet5/for.c
+++ b/sql/backends/monet5/for.c
@@ -9,7 +9,7 @@
  */
 
 #include "monetdb_config.h"
-#include "sql.h"
+#include "sql_monet_backend.h"
 #include "mal.h"
 #include "mal_client.h"
 
diff --git a/sql/backends/monet5/for.h b/sql/backends/monet5/for.h
--- a/sql/backends/monet5/for.h
+++ b/sql/backends/monet5/for.h
@@ -11,7 +11,7 @@
 #ifndef _FOR_H
 #define _FOR_H
 
-#include "sql.h"
+#include "sql_monet_backend.h"
 
 //extern BAT *FORdecompress_(BAT *o, lng minval, int type, role_t role);
 extern str FORcompress_col(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -16,7 +16,7 @@
  * from the Version 4 code base.
  */
 #include "monetdb_config.h"
-#include "sql.h"
+#include "sql_monet_backend.h"
 #include "mapi_prompt.h"
 #include "sql_result.h"
 #include "sql_query.h"
diff --git a/sql/backends/monet5/sql_assert.h b/sql/backends/monet5/sql_assert.h
--- a/sql/backends/monet5/sql_assert.h
+++ b/sql/backends/monet5/sql_assert.h
@@ -10,7 +10,7 @@
 
 #ifndef _SQL_ASSERT_H_
 #define _SQL_ASSERT_H_
-#include "sql.h"
+#include "sql_monet_backend.h"
 
 extern str SQLassert(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 extern str SQLassertInt(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci);
diff --git a/sql/backends/monet5/sql_bincopy.c 
b/sql/backends/monet5/sql_bincopy.c
--- a/sql/backends/monet5/sql_bincopy.c
+++ b/sql/backends/monet5/sql_bincopy.c
@@ -15,7 +15,7 @@
 #include "monetdb_config.h"
 #include "mapi_prompt.h"
 #include "gdk.h"
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to