Changeset: 57575d51f175 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=57575d51f175
Modified Files:
monetdb5/extras/rapi/rapi.R
sql/backends/monet5/UDF/pyapi/CMakeLists.txt
sql/backends/monet5/UDF/pyapi/convert_loops.h
sql/backends/monet5/UDF/pyapi/type_conversion.c
sql/backends/monet5/UDF/pyapi/type_conversion.h
Branch: cmake-fun
Log Message:
Test fixes. "string_copy" function is also defined by another library, use a
non redundant name.
diffs (86 lines):
diff --git a/monetdb5/extras/rapi/rapi.R b/monetdb5/extras/rapi/rapi.R
--- a/monetdb5/extras/rapi/rapi.R
+++ b/monetdb5/extras/rapi/rapi.R
@@ -53,7 +53,7 @@ rewireFunc("q", quit, "base")
rm(rewireFunc)
loopback_query <- function(query) {
- dyn.load(file.path(MONETDB_LIBDIR, "monetdb5", "librapi.so"))
+ dyn.load(file.path(MONETDB_LIBDIR, "monetdb5", "lib_rapi.so"))
res <- .Call("RAPIloopback", paste0(query, "\n;"), package="lib_rapi")
if (is.character(res)) {
stop(res)
diff --git a/sql/backends/monet5/UDF/pyapi/CMakeLists.txt
b/sql/backends/monet5/UDF/pyapi/CMakeLists.txt
--- a/sql/backends/monet5/UDF/pyapi/CMakeLists.txt
+++ b/sql/backends/monet5/UDF/pyapi/CMakeLists.txt
@@ -11,7 +11,6 @@ include_directories(../../../../../clien
../../../../../monetdb5/mal
../../../../../sql/backends/monet5 ../../../../../sql/common
../../../../../sql/include
../../../../../sql/server ../../../../../sql/storage ${PY2_INCLUDE_DIR})
-# TODO check XDEPS
add_library(pyapi MODULE
pyapi.c pyapi.h unicode.c unicode.h pytypes.c pytypes.h
type_conversion.c type_conversion.h formatinput.c
formatinput.h connection.c connection.h undef.h
pyloader.c emit.h emit.c conversion.c conversion.h
diff --git a/sql/backends/monet5/UDF/pyapi/convert_loops.h
b/sql/backends/monet5/UDF/pyapi/convert_loops.h
--- a/sql/backends/monet5/UDF/pyapi/convert_loops.h
+++ b/sql/backends/monet5/UDF/pyapi/convert_loops.h
@@ -455,7 +455,7 @@ convert_and_append(BAT* b, const char* t
goto wrapup;
\
}
\
} else {
\
- if (!string_copy(&data[(index_offset *
ret->count + iu) * \
+ if (!py_string_copy(&data[(index_offset
* ret->count + iu) * \
ret->memory_size], \
utf8_string, ret->memory_size, false)) { \
msg = createException(MAL,
"pyapi.eval", \
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(const char *source, char *dest, size_t max_size, bool
allow_unicode)
+bool py_string_copy(const char *source, char *dest, size_t max_size, bool
allow_unicode)
{
size_t i;
for (i = 0; i < max_size; i++) {
@@ -148,7 +148,7 @@ str pyobject_to_str(PyObject **ptr, size
#ifndef IS_PY3K
if (PyString_CheckExact(obj)) {
char *str = ((PyStringObject *)obj)->ob_sval;
- if (!string_copy(str, utf8_string, len-1, false)) {
+ if (!py_string_copy(str, utf8_string, len-1, false)) {
msg = createException(MAL, "pyapi.eval",
SQLSTATE(PY000) "Invalid string encoding used. Please return "
"a regular
ASCII string, or a Numpy_Unicode "
@@ -159,7 +159,7 @@ str pyobject_to_str(PyObject **ptr, size
#endif
if (PyByteArray_CheckExact(obj)) {
char *str = ((PyByteArrayObject *)obj)->ob_bytes;
- if (!string_copy(str, utf8_string, len-1, false)) {
+ if (!py_string_copy(str, utf8_string, len-1, false)) {
msg = createException(MAL, "pyapi.eval",
SQLSTATE(PY000) "Invalid string encoding used. Please return "
"a regular
ASCII string, or a Numpy_Unicode "
@@ -176,7 +176,7 @@ str pyobject_to_str(PyObject **ptr, size
#endif
#else
const char *str = PyUnicode_AsUTF8(obj);
- if (!string_copy(str, utf8_string, len-1, true)) {
+ if (!py_string_copy(str, utf8_string, len-1, true)) {
msg = createException(MAL, "pyapi.eval",
SQLSTATE(PY000) "Invalid string encoding used. Please return "
"a regular
ASCII string, or a Numpy_Unicode "
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,7 +24,7 @@
//! 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(const char *source, char *dest, size_t max_size, bool
allow_unicode);
+bool py_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);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list