Changeset: a4dc5aa47fe3 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a4dc5aa47fe3 Modified Files: sql/backends/monet5/sql.mx sql/backends/monet5/sql_user.c sql/server/rel_dump.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_parser.y sql/server/sql_scan.c sql/storage/bat/bat_storage.c sql/storage/store.c Branch: sciql Log Message:
merged from default diffs (truncated from 11633 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 @@ -516,6 +516,7 @@ MapiMsg mapi_quick_response(MapiHdl hdl, char *mapi_quote(const char *msg, int size); MapiMsg mapi_read_response(MapiHdl hdl); MapiMsg mapi_reconnect(Mapi mid); +MapiMsg mapi_release_id(Mapi mid, int id); char **mapi_resolve(const char *host, int port, const char *pattern); char *mapi_result_error(MapiHdl hdl); mapi_int64 mapi_rows_affected(MapiHdl hdl); @@ -5755,6 +5756,7 @@ str divRef; str doALGfetch(ptr ret, BAT *b, lng *pos); str doneRef; int dropRegist(str sch, str tab, str col, int acc); +void dumpExceptionsToStream(stream *out, str msg); void dumpHelpTable(stream *f, Module s, str text, int flag); void dumpManual(stream *f, Module v, int recursive); void dumpManualFooter(stream *f); diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c --- a/clients/mapiclient/stethoscope.c +++ b/clients/mapiclient/stethoscope.c @@ -162,23 +162,23 @@ usage(void) fprintf(stderr, " -h | --host=<hostname>\n"); fprintf(stderr, "\n"); fprintf(stderr, "The trace options:\n"); - fprintf(stderr, " S = start instruction profiling\n"); - fprintf(stderr, " a = aggregates\n"); - fprintf(stderr, " e = event\n"); - fprintf(stderr, " f = function \n"); - fprintf(stderr, " o = operation called\n"); - fprintf(stderr, " i = interpreter thread\n"); - fprintf(stderr, " T = time\n"); - fprintf(stderr, " t = ticks\n"); - fprintf(stderr, " c = cpu statistics\n"); - fprintf(stderr, " m = memory resources\n"); + fprintf(stderr, " S = monitor start of instruction profiling\n"); + fprintf(stderr, " a = aggregate clock ticks per instruction\n"); + fprintf(stderr, " e = event counter\n"); + fprintf(stderr, " f = function name and pc counter \n"); + fprintf(stderr, " o = module.function operation called\n"); + fprintf(stderr, " i = interpreter thread number\n"); + fprintf(stderr, " T = wall colck time\n"); + fprintf(stderr, " t = ticks in microseconds\n"); + fprintf(stderr, " c = cpu statistics (utime,ctime,stime,cstime)\n"); + fprintf(stderr, " m = memory resources as provided by OS\n"); fprintf(stderr, " r = block reads\n"); fprintf(stderr, " w = block writes\n"); fprintf(stderr, " b = bytes read/written\n"); - fprintf(stderr, " s = statement\n"); - fprintf(stderr, " y = argument types\n"); - fprintf(stderr, " p = page faults, context switches\n"); - fprintf(stderr, " u = user\n"); + fprintf(stderr, " s = MAL statement\n"); + fprintf(stderr, " y = MAL argument types\n"); + fprintf(stderr, " p = process statistics, e.g. page faults, context switches\n"); + fprintf(stderr, " u = user id\n"); } /* Any signal should be captured and turned into a graceful diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1122,6 +1122,17 @@ clean_print(char *msg, const char *prefi if (strncmp(msg, prefix, len) == 0) msg += len; + /* skip SQLSTATE if provided */ + if (strlen(msg) > 6 && msg[5] == '!' && + ((msg[0] >= '0' && msg[0] <= '9') || (msg[0] >= 'A' && msg[0] <= 'Z')) && + ((msg[1] >= '0' && msg[1] <= '9') || (msg[1] >= 'A' && msg[1] <= 'Z')) && + ((msg[2] >= '0' && msg[2] <= '9') || (msg[2] >= 'A' && msg[2] <= 'Z')) && + ((msg[3] >= '0' && msg[3] <= '9') || (msg[3] >= 'A' && msg[3] <= 'Z')) && + ((msg[4] >= '0' && msg[4] <= '9') || (msg[4] >= 'A' && msg[4] <= 'Z'))) + { + msg += 6; + } + /* output line */ fputs(msg, fd); fputc('\n', fd); @@ -1141,6 +1152,18 @@ indented_print(const char *msg, const ch while (p && *p) { fprintf(fd, "%.*s%c", len - 1, s, t); s = " "; + + /* skip SQLSTATE if provided */ + if (strlen(p) > 6 && p[5] == '!' && + ((p[0] >= '0' && p[0] <= '9') || (p[0] >= 'A' && p[0] <= 'Z')) && + ((p[1] >= '0' && p[1] <= '9') || (p[1] >= 'A' && p[1] <= 'Z')) && + ((p[2] >= '0' && p[2] <= '9') || (p[2] >= 'A' && p[2] <= 'Z')) && + ((p[3] >= '0' && p[3] <= '9') || (p[3] >= 'A' && p[3] <= 'Z')) && + ((p[4] >= '0' && p[4] <= '9') || (p[4] >= 'A' && p[4] <= 'Z'))) + { + p += 6; + } + q = strchr(p, '\n'); if (q) { q++; /* also print the newline */ @@ -3035,11 +3058,13 @@ mapi_timeout(Mapi mid, int timeout) } static MapiMsg -mapi_Xcommand(Mapi mid, char *cmdname, char *cmdvalue) +mapi_Xcommand(Mapi mid, const char *cmdname, const char *cmdvalue) { MapiHdl hdl; mapi_check(mid, "mapi_Xcommand"); + if (mid->active && read_into_cache(mid->active, 0) != MOK) + return MERROR; if (mnstr_printf(mid->to, "X" "%s %s\n", cmdname, cmdvalue) < 0 || mnstr_flush(mid->to)) { close_connection(mid); @@ -3387,7 +3412,7 @@ MapiMsg mapi_set_size_header(Mapi mid, int value) { if (mid->languageId != LANG_SQL) { - mapi_setError(mid, "size header only supported in SQL", "mapi_toggle_size_header", MERROR); + mapi_setError(mid, "size header only supported in SQL", "mapi_set_size_header", MERROR); return MERROR; } if (value) @@ -3397,6 +3422,19 @@ mapi_set_size_header(Mapi mid, int value } MapiMsg +mapi_release_id(Mapi mid, int id) +{ + char buf[10]; + + if (mid->languageId != LANG_SQL) { + mapi_setError(mid, "release only supported in SQL", "mapi_release_id", MERROR); + return MERROR; + } + snprintf(buf, sizeof(buf), "%d", id); + return mapi_Xcommand(mid, "release", buf); +} + +MapiMsg mapi_trace(Mapi mid, int flag) { mapi_clrError(mid); diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h --- a/clients/mapilib/mapi.h +++ b/clients/mapilib/mapi.h @@ -166,6 +166,7 @@ mapi_export int mapi_get_autocommit(Mapi mapi_export MapiMsg mapi_log(Mapi mid, const char *nme); mapi_export MapiMsg mapi_setAutocommit(Mapi mid, int autocommit); mapi_export MapiMsg mapi_set_size_header(Mapi mid, int value); +mapi_export MapiMsg mapi_release_id(Mapi mid, int id); mapi_export char *mapi_result_error(MapiHdl hdl); mapi_export MapiMsg mapi_next_result(MapiHdl hdl); mapi_export MapiMsg mapi_needmore(MapiHdl hdl); diff --git a/clients/odbc/driver/ODBCError.c b/clients/odbc/driver/ODBCError.c --- a/clients/odbc/driver/ODBCError.c +++ b/clients/odbc/driver/ODBCError.c @@ -71,31 +71,32 @@ static struct SQLStateMsg { {"01001", "Cursor operation conflict"}, {"01002", "Disconnect error"}, {"01003", "NULL value eliminated in set function"}, - {"01004", "String data, right-truncated"}, + {"01004", "String data, right truncated"}, {"01006", "Privilege not revoked"}, {"01007", "Privilege not granted"}, {"01S00", "Invalid connection string attribute"}, {"01S01", "Error in row"}, {"01S02", "Option value changed"}, - {"01S06", "Attempt to fetch before the result set returned the first rowset"}, + {"01S06", "Attempt to fetch before the result set returned the first " + "rowset"}, {"01S07", "Fractional truncation"}, - {"01S08", "Error saving File DSN"}, + {"01S08", "Error saving file DSN"}, {"01S09", "Invalid keyword"}, - {"07001", "Wrong number of parameters"}, {"07002", "COUNT field incorrect"}, {"07005", "Prepared statement not a cursor-specification"}, {"07006", "Restricted data type attribute violation"}, + {"07007", "Restricted parameter value violation"}, {"07009", "Invalid descriptor index"}, {"07S01", "Invalid use of default parameter"}, {"08001", "Client unable to establish connection"}, {"08002", "Connection name in use"}, - {"08003", "Connection does not exist"}, + {"08003", "Connection not open"}, {"08004", "Server rejected the connection"}, {"08007", "Connection failure during transaction"}, {"08S01", "Communication link failure"}, {"21S01", "Insert value list does not match column list"}, {"21S02", "Degree of derived table does not match column list"}, - {"22001", "String data, right-truncated"}, + {"22001", "String data, right truncated"}, {"22002", "Indicator variable required but not supplied"}, {"22003", "Numeric value out of range"}, {"22007", "Invalid datetime format"}, @@ -109,7 +110,7 @@ static struct SQLStateMsg { {"23000", "Integrity constraint violation"}, {"24000", "Invalid cursor state"}, {"25000", "Invalid transaction state"}, - {"25S01", "Transaction state"}, + {"25S01", "Transaction state unknown"}, {"25S02", "Transaction is still active"}, {"25S03", "Transaction is rolled back"}, {"28000", "Invalid authorization specification"}, @@ -134,7 +135,7 @@ static struct SQLStateMsg { {"HY004", "Invalid SQL data type"}, {"HY007", "Associated statement is not prepared"}, {"HY008", "Operation canceled"}, - {"HY009", "Invalid use of null pointer"}, + {"HY009", "Invalid argument value"}, {"HY010", "Function sequence error"}, {"HY011", "Attribute cannot be set now"}, {"HY012", "Invalid transaction operation code"}, @@ -142,7 +143,8 @@ static struct SQLStateMsg { {"HY014", "Limit on the number of handles exceeded"}, {"HY015", "No cursor name available"}, {"HY016", "Cannot modify an implementation row descriptor"}, - {"HY017", "Invalid use of an automatically allocated descriptor handle"}, + {"HY017", "Invalid use of an automatically allocated descriptor " + "handle"}, {"HY018", "Server declined cancel request"}, {"HY019", "Non-character and non-binary data sent in pieces"}, {"HY020", "Attempt to concatenate a null value"}, @@ -152,7 +154,7 @@ static struct SQLStateMsg { {"HY091", "Invalid descriptor field identifier"}, {"HY092", "Invalid attribute/option identifier"}, {"HY095", "Function type out of range"}, - {"HY096", "Invalid information type"}, + {"HY096", "Information type out of range"}, {"HY097", "Column type out of range"}, {"HY098", "Scope type out of range"}, {"HY099", "Nullable type out of range"}, @@ -166,24 +168,36 @@ static struct SQLStateMsg { {"HY109", "Invalid cursor position"}, {"HY110", "Invalid driver completion"}, {"HY111", "Invalid bookmark value"}, + {"HY114", "Driver does not support connection-level asynchronous " + "function execution"}, + {"HY115", "SQLEndTran is not allowed for an environment that contains " + "a connection with asynchronous function execution enabled"}, + {"HY117", "Connection is suspended due to unknown transaction state. " + "Only disconnect and read-only functions are allowed."}, + {"HY121", "Cursor Library and Driver-Aware Pooling cannot be enabled " + "at the same time"}, {"HYC00", "Optional feature not implemented"}, {"HYT00", "Timeout expired"}, {"HYT01", "Connection timeout expired"}, {"IM001", "Driver does not support this function"}, - {"IM002", "Data source name not found and no default driver specified"}, - {"IM003", "Specified driver could not be loaded"}, + {"IM002", "Data source not found and no default driver specified"}, + {"IM003", "Specified driver could not be connected to"}, {"IM004", "Driver's SQLAllocHandle on SQL_HANDLE_ENV failed"}, {"IM005", "Driver's SQLAllocHandle on SQL_HANDLE_DBC failed"}, {"IM006", "Driver's SQLSetConnectAttr failed"}, {"IM007", "No data source or driver specified; dialog prohibited"}, {"IM008", "Dialog failed"}, - {"IM009", "Unable to load translation DLL"}, + {"IM009", "Unable to connect to translation DLL"}, {"IM010", "Data source name too long"}, {"IM011", "Driver name too long"}, {"IM012", "DRIVER keyword syntax error"}, - {"IM013", "Trace file error"}, - {"IM014", "Invalid name of File DSN"}, - {"IM015", "Corrupt file data source"}, + {"IM014", "The specified DSN contains an architecture mismatch " + "between the Driver and Application"}, + {"IM015", "Driver's SQLConnect on SQL_HANDLE_DBC_INFO_HANDLE failed"}, + {"IM017", "Polling is disabled in asynchronous notification mode"}, + {"IM018", "SQLCompleteAsync has not been called to complete the " + "previous asynchronous operation on this handle."}, + {"S1118", "Driver does not support asynchronous notification"}, {0, 0} }; @@ -198,13 +212,13 @@ getStandardSQLStateMsg(const char *SQLSt assert(SQLState); for (p = SQLStateMsg; p->SQLState; p++) - if (strcmp(p->SQLState, SQLState) == 0) + if (strncmp(p->SQLState, SQLState, 5) == 0) return p->SQLMsg; /* Present a msg to notify the system administrator/programmer */ fprintf(stderr, "\nMonetDB, ODBC Driver, ODBCError.c: " - "No message defined for SQLState: %s. " + "No message defined for SQLState: %.5s. " "Please report this error.\n", SQLState); return SQLState; /* always return a string */ diff --git a/clients/odbc/driver/ODBCStmt.h b/clients/odbc/driver/ODBCStmt.h --- a/clients/odbc/driver/ODBCStmt.h +++ b/clients/odbc/driver/ODBCStmt.h @@ -221,6 +221,6 @@ SQLRETURN SQLPrepare_(ODBCStmt *stmt, SQ SQLINTEGER nSqlStrLength); SQLRETURN SQLSetStmtAttr_(ODBCStmt *stmt, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list