Changeset: 7efb668e97d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7efb668e97d6
Added Files:
        clients/mapilib/mapi_prompt.h
        clients/mapilib/mapi_querytype.h
Removed Files:
        sql/include/sql_querytype.h
Modified Files:
        MonetDB.spec
        NT/monetdb_config.h.in
        clients/mapilib/Makefile.ag
        clients/mapilib/mapi.c
        clients/mapilib/mapi.h
        debian/libmonetdb-client-dev.install
        monetdb5/extras/rapi/Makefile.ag
        monetdb5/mal/mal_client.c
        monetdb5/modules/mal/tablet.c
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/UDF/udf/Makefile.ag
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/sql_result.h
        sql/backends/monet5/vaults/fits/Makefile.ag
        sql/backends/monet5/vaults/lidar/Makefile.ag
        sql/backends/monet5/vaults/netcdf/Makefile.ag
        sql/backends/monet5/vaults/shp/Makefile.ag
        sql/common/Makefile.ag
        sql/include/Makefile.ag
        sql/include/sql_catalog.h
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/server/sql_qc.c
        sql/server/sql_qc.h
        sql/server/sql_scan.c
        sql/storage/Makefile.ag
        sql/storage/bat/Makefile.ag
        sql/storage/bat/res_table.c
        sql/storage/sql_storage.h
        tools/mserver/Makefile.ag
Branch: default
Log Message:

Don't put internal stuff in mapi.h; have a single definition of Q_* values.


diffs (truncated from 651 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -314,7 +314,7 @@ This package contains the files needed t
 %defattr(-,root,root)
 %dir %{_includedir}/monetdb
 %{_libdir}/libmapi.so
-%{_includedir}/monetdb/mapi.h
+%{_includedir}/monetdb/mapi*.h
 %{_libdir}/pkgconfig/monetdb-mapi.pc
 
 %package client-odbc
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -874,8 +874,4 @@ typedef __uint128_t uhge;
 #define HAVE_MAPI 1
 #endif
 
-#define PROMPT1                "\001\001\n"    /* prompt: ready for new query 
*/
-#define PROMPT2                "\001\002\n"    /* prompt: more data needed */
-#define PROMPT3                "\001\003\n"    /* prompt: get file content */
-
 #endif /* _SEEN_MONETDB_CONFIG_H */
diff --git a/clients/mapilib/Makefile.ag b/clients/mapilib/Makefile.ag
--- a/clients/mapilib/Makefile.ag
+++ b/clients/mapilib/Makefile.ag
@@ -11,7 +11,7 @@ INCLUDES = ../../common/stream ../../com
 
 lib_mapi = {
        VERSION = $(MAPI_VERSION)
-       SOURCES = mapi.c mapi.rc
+       SOURCES = mapi.c mapi_prompt.h mapi.rc
        LIBS = ../../common/utils/libmcrypt \
                WIN32?../../common/stream/libstream \
                WIN32?../../common/utils/libmutils \
@@ -22,7 +22,7 @@ lib_mapi = {
 headers_mapi = {
        DIR = includedir/monetdb
        HEADERS = h
-       SOURCES = mapi.h
+       SOURCES = mapi.h mapi_querytype.h
 }
 
 headers_pc = {
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -687,6 +687,7 @@
 #include "stream.h"            /* include before mapi.h */
 #include "stream_socket.h"
 #include "mapi.h"
+#include "mapi_prompt.h"
 #include "mcrypt.h"
 #include "matomic.h"
 #include "mstring.h"
@@ -735,9 +736,56 @@
 
 #define MAPIBLKSIZE    256     /* minimum buffer shipped */
 
+#define MAPI_AUTO      0       /* automatic type detection */
+#define MAPI_TINY      1
+#define MAPI_UTINY     2
+#define MAPI_SHORT     3
+#define MAPI_USHORT    4
+#define MAPI_INT       5
+#define MAPI_UINT      6
+#define MAPI_LONG      7
+#define MAPI_ULONG     8
+#define MAPI_LONGLONG  9
+#define MAPI_ULONGLONG 10
+#define MAPI_CHAR      11
+#define MAPI_VARCHAR   12
+#define MAPI_FLOAT     13
+#define MAPI_DOUBLE    14
+#define MAPI_DATE      15
+#define MAPI_TIME      16
+#define MAPI_DATETIME  17
+#define MAPI_NUMERIC   18
+
+#define PLACEHOLDER    '?'
+
 /* number of elements in an array */
 #define NELEM(arr)     (sizeof(arr) / sizeof(arr[0]))
 
+/* three structures used for communicating date/time information */
+/* these structs are deliberately compatible with the ODBC versions
+   SQL_DATE_STRUCT, SQL_TIME_STRUCT, and SQL_TIMESTAMP_STRUCT */
+typedef struct {               /* used by MAPI_DATE */
+       short year;
+       unsigned short month;
+       unsigned short day;
+} MapiDate;
+
+typedef struct {               /* used by MAPI_TIME */
+       unsigned short hour;
+       unsigned short minute;
+       unsigned short second;
+} MapiTime;
+
+typedef struct {               /* used by MAPI_DATETIME */
+       short year;
+       unsigned short month;
+       unsigned short day;
+       unsigned short hour;
+       unsigned short minute;
+       unsigned short second;
+       unsigned int fraction;  /* in 1000 millionths of a second (10e-9) */
+} MapiDateTime;
+
 /* information about the columns in a result set */
 struct MapiColumn {
        char *tablename;
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -13,27 +13,7 @@
 #include <stdint.h>            /* for int64_t */
 #include <stdbool.h>           /* for bool */
 
-#define MAPI_AUTO      0       /* automatic type detection */
-#define MAPI_TINY      1
-#define MAPI_UTINY     2
-#define MAPI_SHORT     3
-#define MAPI_USHORT    4
-#define MAPI_INT       5
-#define MAPI_UINT      6
-#define MAPI_LONG      7
-#define MAPI_ULONG     8
-#define MAPI_LONGLONG  9
-#define MAPI_ULONGLONG 10
-#define MAPI_CHAR      11
-#define MAPI_VARCHAR   12
-#define MAPI_FLOAT     13
-#define MAPI_DOUBLE    14
-#define MAPI_DATE      15
-#define MAPI_TIME      16
-#define MAPI_DATETIME  17
-#define MAPI_NUMERIC   18
-
-#define PLACEHOLDER    '?'
+#include "mapi_querytype.h"
 
 #define MAPI_SEEK_SET  0
 #define MAPI_SEEK_CUR  1
@@ -47,12 +27,6 @@ typedef int MapiMsg;
 #define MMORE          (-3)
 #define MSERVER                (-4)
 
-/* prompts for MAPI protocol, also in monetdb_config.h.in */
-#define PROMPTBEG      '\001'  /* start prompt bracket */
-#define PROMPT1                "\001\001\n"    /* prompt: ready for new query 
*/
-#define PROMPT2                "\001\002\n"    /* prompt: more data needed */
-#define PROMPT3                "\001\003\n"    /* prompt: get file content */
-
 /*
  * The table field information is extracted from the table headers
  * obtained from the server. This list may be extended in the future.
@@ -62,17 +36,6 @@ typedef int MapiMsg;
  */
 typedef struct MapiStruct *Mapi;
 
-/* this definition is a straight copy from sql/include/sql_query.h */
-typedef enum sql_query_t {
-       Q_PARSE = 0,
-       Q_TABLE = 1,
-       Q_UPDATE = 2,
-       Q_SCHEMA = 3,
-       Q_TRANS = 4,
-       Q_PREPARE = 5,
-       Q_BLOCK = 6
-} sql_query_t;
-
 typedef struct MapiStatement *MapiHdl;
 
 #ifdef __cplusplus
@@ -90,31 +53,6 @@ extern "C" {
 #define mapi_export extern
 #endif
 
-/* three structures used for communicating date/time information */
-/* these structs are deliberately compatible with the ODBC versions
-   SQL_DATE_STRUCT, SQL_TIME_STRUCT, and SQL_TIMESTAMP_STRUCT */
-typedef struct {               /* used by MAPI_DATE */
-       short year;
-       unsigned short month;
-       unsigned short day;
-} MapiDate;
-
-typedef struct {               /* used by MAPI_TIME */
-       unsigned short hour;
-       unsigned short minute;
-       unsigned short second;
-} MapiTime;
-
-typedef struct {               /* used by MAPI_DATETIME */
-       short year;
-       unsigned short month;
-       unsigned short day;
-       unsigned short hour;
-       unsigned short minute;
-       unsigned short second;
-       unsigned int fraction;  /* in 1000 millionths of a second (10e-9) */
-} MapiDateTime;
-
 /* connection-oriented functions */
 mapi_export Mapi mapi_mapi(const char *host, int port, const char *username, 
const char *password, const char *lang, const char *dbname);
 mapi_export Mapi mapi_mapiuri(const char *url, const char *user, const char 
*pass, const char *lang);
diff --git a/clients/mapilib/mapi_prompt.h b/clients/mapilib/mapi_prompt.h
new file mode 100644
--- /dev/null
+++ b/clients/mapilib/mapi_prompt.h
@@ -0,0 +1,18 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#ifndef _MAPI_PROMPT_H_INCLUDED
+#define _MAPI_PROMPT_H_INCLUDED 1
+
+/* prompts for MAPI protocol, also in monetdb_config.h.in */
+#define PROMPTBEG      '\001'  /* start prompt bracket */
+#define PROMPT1                "\001\001\n"    /* prompt: ready for new query 
*/
+#define PROMPT2                "\001\002\n"    /* prompt: more data needed */
+#define PROMPT3                "\001\003\n"    /* prompt: get file content */
+
+#endif /* _MAPI_PROMPT_H_INCLUDED */
diff --git a/clients/mapilib/mapi_querytype.h b/clients/mapilib/mapi_querytype.h
new file mode 100644
--- /dev/null
+++ b/clients/mapilib/mapi_querytype.h
@@ -0,0 +1,23 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0.  If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
+ */
+
+#ifndef _MAPI_QUERYTYPE_H_INCLUDED
+#define _MAPI_QUERYTYPE_H_INCLUDED 1
+
+/* this definition is a straight copy from sql/include/sql_query.h */
+typedef enum {
+       Q_PARSE = 0,
+       Q_TABLE = 1,
+       Q_UPDATE = 2,
+       Q_SCHEMA = 3,
+       Q_TRANS = 4,
+       Q_PREPARE = 5,
+       Q_BLOCK = 6
+} mapi_query_t;
+
+#endif /* _MAPI_QUERYTYPE_H_INCLUDED */
diff --git a/debian/libmonetdb-client-dev.install 
b/debian/libmonetdb-client-dev.install
--- a/debian/libmonetdb-client-dev.install
+++ b/debian/libmonetdb-client-dev.install
@@ -1,3 +1,3 @@
 debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so usr/lib/x86_64-linux-gnu
-debian/tmp/usr/include/monetdb/mapi.h usr/include/monetdb
+debian/tmp/usr/include/monetdb/mapi*.h usr/include/monetdb
 debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig/monetdb-mapi.pc 
usr/lib/x86_64-linux-gnu/pkgconfig
diff --git a/monetdb5/extras/rapi/Makefile.ag b/monetdb5/extras/rapi/Makefile.ag
--- a/monetdb5/extras/rapi/Makefile.ag
+++ b/monetdb5/extras/rapi/Makefile.ag
@@ -7,6 +7,7 @@
 INCLUDES = \
        ../../../common/stream \
        ../../../common/utils \
+       ../../../clients/mapilib \
        ../../../gdk \
        ../../mal \
        ../../modules/kernel \
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -46,6 +46,7 @@
 #include "mal_private.h"
 #include "mal_runtime.h"
 #include "mal_authorize.h"
+#include "mapi_prompt.h"
 
 int MAL_MAXCLIENTS = 0;
 ClientRec *mal_clients = NULL;
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -39,6 +39,7 @@
 #include "streams.h"
 #include "tablet.h"
 #include "algebra.h"
+#include "mapi_prompt.h"
 
 #include <string.h>
 #include <ctype.h>
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to