Changeset: 2b7d5b7edebc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b7d5b7edebc
Modified Files:
monetdb5/mal/mal_linker.c
sql/backends/monet5/UDF/pyapi/type_conversion.c
sql/backends/monet5/UDF/pyapi/type_conversion.h
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/vaults/shp/shp.c
Branch: default
Log Message:
Merge with Aug2018 branch.
diffs (131 lines):
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -233,6 +233,7 @@ loadLibrary(str filename, int flag)
MT_lock_set(&mal_contextLock);
if (lastfile == maxfiles) {
+ MT_lock_unset(&mal_contextLock);
if (handle)
dlclose(handle);
throw(MAL,"mal.linker", "loadModule internal error, too many
modules loaded");
diff --git a/sql/backends/monet5/UDF/pyapi/type_conversion.c
b/sql/backends/monet5/UDF/pyapi/type_conversion.c
--- a/sql/backends/monet5/UDF/pyapi/type_conversion.c
+++ b/sql/backends/monet5/UDF/pyapi/type_conversion.c
@@ -18,7 +18,7 @@
#define PyString_CheckExact PyUnicode_CheckExact
#endif
-bool string_copy(char *source, char *dest, size_t max_size, bool allow_unicode)
+bool string_copy(const char *source, char *dest, size_t max_size, bool
allow_unicode)
{
size_t i;
for (i = 0; i < max_size; i++) {
@@ -175,7 +175,7 @@ str pyobject_to_str(PyObject **ptr, size
ucs2_to_utf8(0, ((PyUnicodeObject *)obj)->length, utf8_string,
str);
#endif
#else
- char *str = PyUnicode_AsUTF8(obj);
+ const char *str = PyUnicode_AsUTF8(obj);
if (!string_copy(str, utf8_string, len-1, true)) {
msg = createException(MAL, "pyapi.eval",
SQLSTATE(PY000) "Invalid string encoding used. Please return "
@@ -206,7 +206,7 @@ wrapup:
}
#define STRING_TO_NUMBER_FACTORY(tpe)
\
- str str_to_##tpe(char *ptr, size_t maxsize, tpe *value)
\
+ str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value)
\
{
\
size_t len = sizeof(tpe);
\
char buf[256];
\
diff --git a/sql/backends/monet5/UDF/pyapi/type_conversion.h
b/sql/backends/monet5/UDF/pyapi/type_conversion.h
--- a/sql/backends/monet5/UDF/pyapi/type_conversion.h
+++ b/sql/backends/monet5/UDF/pyapi/type_conversion.h
@@ -24,12 +24,12 @@
//! Copies the string of size up to max_size from the source to the
destination,
//! returns FALSE if "source" is not a legal ASCII string (i.e. a character is
//! >= 128)
-bool string_copy(char *source, char *dest, size_t max_size, bool
allow_unicode);
+bool string_copy(const char *source, char *dest, size_t max_size, bool
allow_unicode);
#ifdef HAVE_HGE
//! Converts a hge to a string and writes it into the string "str"
int hge_to_string(char *str, hge);
//! Converts a base-10 string to a hge value
-str str_to_hge(char *ptr, size_t maxsize, hge *value);
+str str_to_hge(const char *ptr, size_t maxsize, hge *value);
//! Converts a base-10 utf32-encoded string to a hge value
str unicode_to_hge(Py_UNICODE *utf32, size_t maxsize, hge *value);
//! Converts a PyObject to a hge value
@@ -48,7 +48,7 @@ str pyobject_to_blob(PyObject **ptr, siz
//using macros, create a number of str_to_<type>, unicode_to_<type> and
pyobject_to_<type> functions (we are Java now)
#define CONVERSION_FUNCTION_HEADER_FACTORY(tpe) \
- str str_to_##tpe(char *ptr, size_t maxsize, tpe *value); \
+ str str_to_##tpe(const char *ptr, size_t maxsize, tpe *value); \
str unicode_to_##tpe(Py_UNICODE *ptr, size_t maxsize, tpe *value);
\
str pyobject_to_##tpe(PyObject **ptr, size_t maxsize, tpe *value);
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -403,8 +403,10 @@ SQLinit(Client c)
monet5_user_init(&be_funcs);
msg = MTIMEtimezone(&tz, &gmt);
- if (msg)
+ if (msg) {
+ MT_lock_unset(&sql_contextLock);
return msg;
+ }
(void) tz;
if (debug_str)
SQLdebug = strtol(debug_str, NULL, 10);
@@ -477,14 +479,18 @@ SQLinit(Client c)
buffer* createdb_buf;
stream* createdb_stream;
bstream* createdb_bstream;
- if ((createdb_buf = GDKmalloc(sizeof(buffer))) == NULL)
+ if ((createdb_buf = GDKmalloc(sizeof(buffer))) == NULL) {
+ MT_lock_unset(&sql_contextLock);
throw(MAL, "createdb", SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ }
buffer_init(createdb_buf, createdb_inline, createdb_len);
if ((createdb_stream = buffer_rastream(createdb_buf,
"createdb.sql")) == NULL) {
+ MT_lock_unset(&sql_contextLock);
GDKfree(createdb_buf);
throw(MAL, "createdb", SQLSTATE(HY001) MAL_MALLOC_FAIL);
}
if ((createdb_bstream = bstream_create(createdb_stream,
createdb_len)) == NULL) {
+ MT_lock_unset(&sql_contextLock);
close_stream(createdb_stream);
GDKfree(createdb_buf);
throw(MAL, "createdb", SQLSTATE(HY001) MAL_MALLOC_FAIL);
@@ -580,10 +586,12 @@ SQLinit(Client c)
*m->errstr = 0;
sqlcleanup(m, mvc_status(m));
}
- if ((msg = SQLresetClient(c)) != MAL_SUCCEED)
+
+ msg = SQLresetClient(c);
+ MT_lock_unset(&sql_contextLock);
+ if (msg != MAL_SUCCEED)
return msg;
- MT_lock_unset(&sql_contextLock);
if (MT_create_thread(&sqllogthread, (void (*)(void *)) mvc_logmanager,
NULL, MT_THR_JOINABLE) != 0) {
throw(SQL, "SQLinit", SQLSTATE(42000) "Starting log manager
failed");
}
diff --git a/sql/backends/monet5/vaults/shp/shp.c
b/sql/backends/monet5/vaults/shp/shp.c
--- a/sql/backends/monet5/vaults/shp/shp.c
+++ b/sql/backends/monet5/vaults/shp/shp.c
@@ -17,6 +17,9 @@
#include "sql_mvc.h"
#include "sql.h"
#define HAVE_CXX11 0 /* stupid include file gdal/cpl_port.h */
+#ifndef __clang_major__ /* stupid include file gdal/cpl_port.h
*/
+#define __clang_major__ 0
+#endif
#include "shp.h"
#include <cpl_conv.h> /* for CPLFree */
#include "sql_execute.h"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list