Changeset: db395b2aa6d9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=db395b2aa6d9
Removed Files:
clients/examples/C/sample2.c
clients/examples/C/sample3.c
sql/test/mapi/Tests/sample2.SQL.bat
sql/test/mapi/Tests/sample2.SQL.sh
sql/test/mapi/Tests/sample2.stable.err
sql/test/mapi/Tests/sample2.stable.out
sql/test/mapi/Tests/sample3.SQL.bat
sql/test/mapi/Tests/sample3.SQL.sh
sql/test/mapi/Tests/sample3.stable.err
sql/test/mapi/Tests/sample3.stable.out
Modified Files:
MonetDB.spec
clients/ChangeLog
clients/Tests/exports.stable.out
clients/examples/C/Makefile.ag
clients/mapilib/mapi.c
clients/mapilib/mapi.h
debian/monetdb-client-testing.install
sql/test/mapi/Tests/All
Branch: default
Log Message:
Removed the "array" and "quick" functions from the mapi library.
diffs (truncated from 828 to 300 lines):
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -384,8 +384,6 @@ developer.
%{_bindir}/odbcsample1
%{_bindir}/sample0
%{_bindir}/sample1
-%{_bindir}/sample2
-%{_bindir}/sample3
%{_bindir}/sample4
%{_bindir}/smack00
%{_bindir}/smack01
diff --git a/clients/ChangeLog b/clients/ChangeLog
--- a/clients/ChangeLog
+++ b/clients/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog file for clients
# This file is updated with Maddlog
+* Wed Nov 16 2016 Sjoerd Mullender <[email protected]>
+- Removed the "array" and "quick" functions from the mapi library.
+ To be precise, the removed functions are: mapi_execute_array,
+ mapi_fetch_field_array, mapi_prepare_array, mapi_query_array,
+ mapi_quick_query, mapi_quick_query_array, and mapi_quick_response.
+
* Sun Oct 30 2016 Martin Kersten <[email protected]>
- Added a more elaborate \help command for SQL expressions.
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -510,13 +510,11 @@ MapiMsg mapi_disconnect(Mapi mid);
MapiMsg mapi_error(Mapi mid);
char *mapi_error_str(Mapi mid);
MapiMsg mapi_execute(MapiHdl hdl);
-MapiMsg mapi_execute_array(MapiHdl hdl, char **val);
MapiMsg mapi_explain(Mapi mid, FILE *fd);
MapiMsg mapi_explain_query(MapiHdl hdl, FILE *fd);
MapiMsg mapi_explain_result(MapiHdl hdl, FILE *fd);
mapi_int64 mapi_fetch_all_rows(MapiHdl hdl);
char *mapi_fetch_field(MapiHdl hdl, int fnr);
-char **mapi_fetch_field_array(MapiHdl hdl);
size_t mapi_fetch_field_len(MapiHdl hdl, int fnr);
char *mapi_fetch_line(MapiHdl hdl);
MapiMsg mapi_fetch_reset(MapiHdl hdl);
@@ -562,17 +560,12 @@ MapiMsg mapi_param_string(MapiHdl hdl, i
MapiMsg mapi_param_type(MapiHdl hdl, int fnr, int ctype, int sqltype, void
*ptr);
MapiMsg mapi_ping(Mapi mid);
MapiHdl mapi_prepare(Mapi mid, const char *cmd);
-MapiHdl mapi_prepare_array(Mapi mid, const char *cmd, char **val);
MapiMsg mapi_prepare_handle(MapiHdl hdl, const char *cmd);
MapiHdl mapi_query(Mapi mid, const char *cmd);
-MapiHdl mapi_query_array(Mapi mid, const char *cmd, char **val);
MapiMsg mapi_query_done(MapiHdl hdl);
MapiMsg mapi_query_handle(MapiHdl hdl, const char *cmd);
MapiMsg mapi_query_part(MapiHdl hdl, const char *cmd, size_t size);
MapiHdl mapi_query_prep(Mapi mid);
-MapiHdl mapi_quick_query(Mapi mid, const char *cmd, FILE *fd);
-MapiHdl mapi_quick_query_array(Mapi mid, const char *cmd, char **val, FILE
*fd);
-MapiMsg mapi_quick_response(MapiHdl hdl, FILE *fd);
char *mapi_quote(const char *msg, int size);
MapiMsg mapi_read_response(MapiHdl hdl);
MapiMsg mapi_reconnect(Mapi mid);
diff --git a/clients/examples/C/Makefile.ag b/clients/examples/C/Makefile.ag
--- a/clients/examples/C/Makefile.ag
+++ b/clients/examples/C/Makefile.ag
@@ -12,7 +12,7 @@ MAPI_LIBS = $(SOCKET_LIBS)
BINS = {
CONDINST = HAVE_TESTING
DIR = bindir
- SOURCES = sample0.c sample1.c sample2.c sample3.c sample4.c \
+ SOURCES = sample0.c sample1.c sample4.c \
smack00.c smack01.c
LIBS = $(MAPI_LIBS) ../../mapilib/libmapi \
$(curl_LIBS)
diff --git a/clients/examples/C/sample2.c b/clients/examples/C/sample2.c
deleted file mode 100644
--- a/clients/examples/C/sample2.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 - 2016 MonetDB B.V.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <mapi.h>
-
-#define die(dbh,hdl) do { \
- if (hdl) \
- mapi_explain_result(hdl,stderr); \
- else if (dbh) \
- mapi_explain(dbh,stderr); \
- else \
- fprintf(stderr,"command failed\n"); \
- exit(-1); \
- } while (0)
-
-int
-main(int argc, char **argv)
-{
- /* a parameter binding test */
- char *nme = 0;
- int age = 0;
- char *parm[] = { "peter", 0 };
- char *parm2[] = { "25", 0 };
- char *parm3[] = { "peter", "25", 0 };
- Mapi dbh= NULL;
- MapiHdl hdl = NULL;
-
- if (argc != 4) {
- printf("usage:%s <host> <port> <language>\n", argv[0]);
- exit(-1);
- }
-
- dbh = mapi_connect(argv[1], atoi(argv[2]), "monetdb", "monetdb",
argv[3], NULL);
- if (dbh == NULL || mapi_error(dbh))
- die(dbh, hdl);
-
- /* mapi_trace(dbh,1); */
- if (strcmp(argv[3], "sql") == 0) {
- /* switch of autocommit */
- if (mapi_setAutocommit(dbh, 0) != MOK || mapi_error(dbh))
- die(dbh,NULL);
- if ((hdl = mapi_query(dbh, "create table emp(name varchar(20),
age int)")) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query_array(dbh, "insert into emp values('?',
?)", parm3)) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "select * from emp")) == NULL ||
mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_bind(hdl, 0, &nme))
- die(dbh, hdl);
- if (mapi_bind_var(hdl, 1, MAPI_INT, &age))
- die(dbh, hdl);
- while (mapi_fetch_row(hdl)) {
- printf("%s is %d\n", nme, age);
- }
- } else if (strcmp(argv[3], "mal") == 0) {
- if ((hdl = mapi_query(dbh, "emp := bat.new(:oid,:str);")) ==
NULL || mapi_error(dbh))
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "age := bat.new(:oid,:int);")) ==
NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query_array(dbh, "bat.append(emp,\"?\");",
parm)) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if ((hdl = mapi_query_array(dbh, "bat.append(age,?);", parm2))
== NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "io.print(emp,age);")) == NULL ||
mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_bind(hdl, 1, &nme))
- die(dbh, hdl);
- if (mapi_bind_var(hdl, 2, MAPI_INT, &age))
- die(dbh, hdl);
- while (mapi_fetch_row(hdl)) {
- printf("%s is %d\n", nme, age);
- }
- } else {
- fprintf(stderr, "%s: unknown language, only mal and sql
supported\n", argv[0]);
- exit(1);
- }
-
- if (mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- mapi_destroy(dbh);
-
- return 0;
-}
diff --git a/clients/examples/C/sample3.c b/clients/examples/C/sample3.c
deleted file mode 100644
--- a/clients/examples/C/sample3.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 - 2016 MonetDB B.V.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <mapi.h>
-#ifdef _MSC_VER
-#define LLFMT "%I64d"
-#else
-#define LLFMT "%lld"
-#endif
-
-#define die(dbh,hdl) do { \
- if (hdl) \
- mapi_explain_result(hdl,stderr); \
- else if (dbh) \
- mapi_explain(dbh,stderr); \
- else \
- fprintf(stderr,"command failed\n"); \
- exit(-1); \
- } while (0)
-
-int
-main(int argc, char **argv)
-{
- Mapi dbh;
- MapiHdl hdl = NULL;
- mapi_int64 rows, i;
- char *parm[] = { "peter", 0 };
- char *parm2[] = { "25", 0 };
- int j;
-
- if (argc != 4) {
- printf("usage:%s <host> <port> <language>\n", argv[0]);
- exit(-1);
- }
-
- dbh = mapi_connect(argv[1], atoi(argv[2]), "monetdb", "monetdb",
argv[3], NULL);
- if (dbh == NULL || mapi_error(dbh))
- die(dbh, hdl);
-
- /* mapi_trace(dbh, 1); */
- if (strcmp(argv[3], "sql") == 0) {
- /* switch of autocommit */
- if (mapi_setAutocommit(dbh, 0) != MOK || mapi_error(dbh))
- die(dbh,NULL);
- if ((hdl = mapi_query(dbh, "create table emp(name varchar(20),
age int)")) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "insert into emp values('John',
23)")) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "insert into emp values('Mary',
22)")) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "select * from emp")) == NULL ||
mapi_error(dbh))
- die(dbh, hdl);
- } else if (strcmp(argv[3], "mal") == 0) {
- if ((hdl = mapi_query(dbh, "emp := bat.new(:oid,:str);")) ==
NULL || mapi_error(dbh))
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "age := bat.new(:oid,:int);")) ==
NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query_array(dbh, "bat.append(emp,\"?\");",
parm)) == NULL || mapi_error(dbh))
- die(dbh, hdl);
- if ((hdl = mapi_query_array(dbh, "bat.append(age,?);", parm2))
== NULL || mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- if ((hdl = mapi_query(dbh, "io.print(emp,age);")) == NULL ||
mapi_error(dbh))
- die(dbh, hdl);
- } else {
- fprintf(stderr, "%s: unknown language, only mal and sql
supported\n", argv[0]);
- exit(1);
- }
-
- /* Retrieve all tuples in the client cache first */
- rows = mapi_fetch_all_rows(hdl);
- if (mapi_error(dbh))
- die(dbh, hdl);
- printf("rows received " LLFMT " with %d fields\n", rows,
mapi_get_field_count(hdl));
-
- /* Interpret the cache as a two-dimensional array */
- for (i = 0; i < rows; i++) {
- if (mapi_seek_row(hdl, i, MAPI_SEEK_SET) || mapi_fetch_row(hdl)
== 0)
- break;
- for (j = 0; j < mapi_get_field_count(hdl); j++) {
- printf("%s=%s ", mapi_get_name(hdl, j),
mapi_fetch_field(hdl, j));
- }
- printf("\n");
- }
- if (mapi_error(dbh))
- die(dbh, hdl);
- if (mapi_close_handle(hdl) != MOK)
- die(dbh, hdl);
- mapi_destroy(dbh);
-
- return 0;
-}
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -267,13 +267,11 @@
* @item mapi_disconnect() @tab Disconnect from server
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list