Changeset: 98eb33106405 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=98eb33106405
Modified Files:
clients/Tests/exports.stable.out
clients/mapiclient/mclient.c
common/stream/stream.c
gdk/gdk_batop.c
java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
monetdb5/optimizer/opt_reorder.c
Branch: jit
Log Message:
Merge with default
diffs (truncated from 310 to 300 lines):
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
@@ -211,7 +211,13 @@ size_t GDK_mem_maxsize;
size_t GDK_vm_maxsize;
int GDK_vm_trim;
int GDKatomcnt;
+size_t GDKbatcopy(char *dest, BAT *bat, str colname);
+size_t GDKbatcopysize(BAT *bat, str colname);
+size_t GDKbatread(char *src, BAT **bat, str *colname);
+gdk_return GDKchangesemval(int sem_id, int number, int change, str *msg);
+gdk_return GDKchangesemval_timeout(int sem_id, int number, int change, int
timeout_mseconds, bool *succeed, str *msg);
gdk_return GDKcreatedir(const char *nme);
+gdk_return GDKcreatesem(int id, int count, int *semid, str *msg);
int GDKdebug;
void GDKerror(_In_z_ _Printf_format_string_ const char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
void GDKexit(int status) __attribute__((__noreturn__));
@@ -229,7 +235,10 @@ char *GDKgetenv(const char *name);
int GDKgetenv_int(const char *name, int def);
int GDKgetenv_istrue(const char *name);
int GDKgetenv_isyes(const char *name);
+gdk_return GDKgetsem(int sem_id, int count, int *semid, str *msg);
+gdk_return GDKgetsemval(int sem_id, int number, int *semval, str *msg);
int GDKinit(opt *set, int setlen);
+gdk_return GDKinitmmap(size_t id, size_t size, void **return_ptr, size_t
*return_size, str *msg);
BAT *GDKkey;
ATOMIC_TYPE volatile GDKlockcnt;
ATOMIC_TYPE volatile GDKlockcontentioncnt;
@@ -241,6 +250,7 @@ void *GDKmalloc(size_t size) __attribute
size_t GDKmem_cursize(void);
gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar);
void *GDKmmap(const char *path, int mode, size_t len);
+gdk_return GDKmmapfile(str buffer, size_t max, size_t id);
int GDKms(void);
int GDKnr_threads;
void GDKprepareExit(void);
@@ -248,6 +258,8 @@ void GDKqsort(void *h, void *t, const vo
void GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int
ts, int tpe);
void *GDKrealloc(void *pold, size_t size)
__attribute__((__warn_unused_result__));
void GDKregister(MT_Id pid);
+gdk_return GDKreleasemmap(void *ptr, size_t size, size_t id, str *msg);
+gdk_return GDKreleasesem(int sem_id, str *msg);
void GDKreset(int status);
void GDKsetenv(str name, str value);
ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t
len);
@@ -255,6 +267,7 @@ str GDKstrdup(const char *s) __attribute
str GDKstrndup(const char *s, size_t n)
__attribute__((__warn_unused_result__));
void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...)
__attribute__((__format__(__printf__, 1, 2)));
ThreadRec GDKthreads[THREADS];
+size_t GDKuniqueid(size_t offset);
gdk_return GDKupgradevarheap(BAT *b, var_t v, int copyall, int mayshare);
lng GDKusec(void);
BAT *GDKval;
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1995,6 +1995,8 @@ doFileBulk(Mapi mid, stream *fp)
buf = malloc(bufsize + 1);
if (!buf) {
fprintf(stderr, "cannot allocate memory for send buffer\n");
+ if (fp)
+ close_stream(fp);
return 1;
}
@@ -2067,6 +2069,8 @@ doFileBulk(Mapi mid, stream *fp)
free(buf);
mnstr_flush(toConsole);
+ if (fp)
+ close_stream(fp);
return errseen;
}
@@ -2637,11 +2641,12 @@ doFile(Mapi mid, stream *fp, int useinse
* convert filename from UTF-8
* to locale */
if ((s = open_rastream(line)) == NULL ||
- mnstr_errnr(s))
+ mnstr_errnr(s)) {
+ if (s)
+ close_stream(s);
fprintf(stderr, "%s: cannot
open\n", line);
- else
+ } else
doFile(mid, s, 0, 0, 0);
- close_stream(s);
continue;
}
case '>':
@@ -2832,6 +2837,7 @@ doFile(Mapi mid, stream *fp, int useinse
if (prompt)
deinit_readline();
#endif
+ close_stream(fp);
return errseen;
}
@@ -3381,7 +3387,9 @@ main(int argc, char **argv)
stream *s;
if (fp == NULL &&
- (fp = fopen(argv[optind], "r")) == NULL) {
+ (fp = (strcmp(argv[optind], "-") == 0 ?
+ stdin :
+ fopen(argv[optind], "r"))) == NULL) {
fprintf(stderr, "%s: cannot open\n",
argv[optind]);
c |= 1;
} else if ((s = file_rastream(fp, argv[optind])) ==
NULL) {
@@ -3389,7 +3397,6 @@ main(int argc, char **argv)
c |= 1;
} else {
c |= doFile(mid, s, useinserts, interactive,
save_history);
- close_stream(s);
}
fp = NULL;
optind++;
@@ -3400,7 +3407,6 @@ main(int argc, char **argv)
if (!has_fileargs && command == NULL) {
stream *s = file_rastream(stdin, "<stdin>");
c = doFile(mid, s, useinserts, interactive, save_history);
- mnstr_destroy(s);
}
mapi_destroy(mid);
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -4575,6 +4575,8 @@ cb_destroy(stream *s)
if (cb->destroy)
(*cb->destroy)(cb->private);
+ free(cb);
+ s->stream_data.p = NULL;
destroy(s);
}
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -189,15 +189,20 @@ insert_string_bat(BAT *b, BAT *n, int fo
tt = TYPE_sht;
tp = &tsv;
break;
+#if SIZEOF_VAR_T == 8
case 4:
tt = TYPE_int;
tp = &tiv;
break;
-#if SIZEOF_VAR_T == 8
case 8:
tt = TYPE_lng;
tp = &v;
break;
+#else
+ case 4:
+ tt = TYPE_int;
+ tp = &v;
+ break;
#endif
default:
assert(0);
diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
@@ -1190,7 +1190,7 @@ public class MonetDatabaseMetaData exten
*/
@Override
public boolean supportsStoredProcedures() {
- return false;
+ return true;
}
/**
@@ -2476,7 +2476,7 @@ public class MonetDatabaseMetaData exten
if (table != null) {
query.append(" AND \"tables\".\"name\"
").append(composeMatchPart(table));
}
- if (scope != DatabaseMetaData.bestRowSession) {
+ if (scope != DatabaseMetaData.bestRowSession && scope !=
DatabaseMetaData.bestRowTransaction && scope !=
DatabaseMetaData.bestRowTemporary) {
query.append(" AND 1 = 0");
}
if (!nullable) {
diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -345,11 +345,14 @@ public class MonetResultSet extends Mone
public InputStream getAsciiStream(String columnName) throws
SQLException {
throw newSQLFeatureNotSupportedException("getAsciiStream");
}
+
@Override
+ @Deprecated
public InputStream getUnicodeStream(int columnIndex) throws
SQLException {
throw newSQLFeatureNotSupportedException("getUnicodeStream");
}
@Override
+ @Deprecated
public InputStream getUnicodeStream(String columnName) throws
SQLException {
throw newSQLFeatureNotSupportedException("getUnicodeStream");
}
@@ -633,6 +636,7 @@ public class MonetResultSet extends Mone
* @throws SQLException if a database access error occurs
*/
@Override
+ @Deprecated
public BigDecimal getBigDecimal(int columnIndex, int scale)
throws SQLException
{
@@ -675,6 +679,7 @@ public class MonetResultSet extends Mone
* @throws SQLException if a database access error occurs
*/
@Override
+ @Deprecated
public BigDecimal getBigDecimal(String columnName, int scale)
throws SQLException
{
@@ -1574,32 +1579,29 @@ public class MonetResultSet extends Mone
*/
@Override
public String getColumnClassName(int column) throws
SQLException {
- try {
- if (conn == null) {
- // prevent NullPointerException
when statement is null (i.c. MonetVirtualResultSet)
- if (getStatement() != null) {
- // first time, get a
Connection object and cache it for all next columns
- conn =
getStatement().getConnection();
- }
+ final String MonetDBtype =
getColumnTypeName(column);
+ Class<?> type = null;
+ if (conn == null) {
+ // prevent NullPointerException when
statement is null (i.c. MonetVirtualResultSet)
+ if (getStatement() != null) {
+ // first time, get a Connection
object and cache it for all next columns
+ conn =
getStatement().getConnection();
}
- if (conn != null) {
- Class type = null;
- Map map = conn.getTypeMap();
- if (map != null &&
map.containsKey(types[column - 1])) {
- type =
(Class)map.get(types[column - 1]);
- } else {
- type =
getClassForType(getJavaType(types[column - 1]));
- }
- if (type != null)
- return type.getName();
+ }
+ if (conn != null) {
+ Map map = conn.getTypeMap();
+ if (map != null &&
map.containsKey(MonetDBtype)) {
+ type =
(Class)map.get(MonetDBtype);
}
- throw new SQLException("column type
mapping null: " + types[column - 1], "M0M03");
- } catch (IndexOutOfBoundsException e) {
- throw new SQLException("No such column
" + column, "M1M05");
- } catch (NullPointerException npe) {
- /* do nothing */
}
- return "";
+ if (type == null) {
+ // fallback to the standard Class
mappings
+ type =
getClassForType(getJavaType(MonetDBtype));
+ }
+ if (type != null) {
+ return type.getName();
+ }
+ throw new SQLException("column type mapping
null: " + MonetDBtype, "M0M03");
}
/**
@@ -1797,8 +1799,6 @@ public class MonetResultSet extends Mone
throw new SQLException(ie.getMessage(),
"M0M27");
} catch (IllegalAccessException iae) {
throw new SQLException(iae.getMessage(),
"M0M27");
- } catch (IllegalArgumentException ige) {
- throw new SQLException(ige.getMessage(),
"M0M27");
} catch (InvocationTargetException ite) {
throw new SQLException(ite.getMessage(),
"M0M27");
}
@@ -2013,7 +2013,7 @@ public class MonetResultSet extends Mone
* This switch returns the types as objects according to table
B-3 from
* Oracle's JDBC specification 4.1
*/
- // keep this switch aligned with getObject(int, Map) !
+ // keep this switch regarding the returned classes aligned with
getObject(int, Map) !
switch(type) {
case Types.CHAR:
case Types.VARCHAR:
@@ -2022,9 +2022,9 @@ public class MonetResultSet extends Mone
case Types.NUMERIC:
case Types.DECIMAL:
return BigDecimal.class;
- case Types.BIT: // we don't use type BIT, it's here for
completeness
case Types.BOOLEAN:
return Boolean.class;
+ case Types.BIT: // MonetDB doesn't support type BIT,
it's here for completeness
case Types.TINYINT:
case Types.SMALLINT:
return Short.class;
diff --git a/monetdb5/optimizer/opt_reorder.c b/monetdb5/optimizer/opt_reorder.c
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list