📄 mserver.c
字号:
f= newerr; for( e=err+1; *e && l>1; e++) if( *e== '!' && *(e-1)=='\n'){ snprintf(f,l,"MALException:mserver.query:remote error:"); l-= strlen(f); while(*f) f++; } else{ *f++ = *e; l--; } *f=0; throw(MAL, "mserver.query", "remote error: %s", newerr); }}#line 1463 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret = *key; return MAL_SUCCEED;}str SERVERquery_handle(int *ret, int *key, str *qry){ Mapi mid; MapiHdl hdl=0; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.query_handle","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1472 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" mapi_query_handle(SERVERsessions[i].hdl, *qry); #line 1197 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx"{int rn; if ( ( (rn=mapi_error(mid)) == -4 && hdl && mapi_result_error(hdl)) || rn){ str err,newerr; size_t l; char *e,*f; if( hdl && mapi_result_error(hdl)) err= mapi_result_error(hdl); else err= mapi_result_error(SERVERsessions[i].hdl); l= 2*strlen(err)+8192; newerr= (str) alloca(l); if (err == NULL) err = "(no additional error message)"; f= newerr; for( e=err+1; *e && l>1; e++) if( *e== '!' && *(e-1)=='\n'){ snprintf(f,l,"MALException:mserver.query_handle:remote error:"); l-= strlen(f); while(*f) f++; } else{ *f++ = *e; l--; } *f=0; throw(MAL, "mserver.query_handle", "remote error: %s", newerr); }}#line 1474 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret = *key; return MAL_SUCCEED;}strSERVERquery_array(MalBlkPtr mb, MalStkPtr stk, InstrPtr pc){ (void) mb; (void) stk; (void) pc; throw(MAL, "mserver.query_array","not yet implemented");}str SERVERprepare(int *ret, int *key, str *qry){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.prepare","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1487 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" if( SERVERsessions[i].hdl) mapi_close_handle(SERVERsessions[i].hdl); SERVERsessions[i].hdl= mapi_prepare(mid, *qry); if( mapi_error(mid) ) throw(MAL, "mserver.prepare", mapi_result_error(SERVERsessions[i].hdl)); *ret = *key; return MAL_SUCCEED;}str SERVERexecute(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.execute","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1501 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" mapi_execute(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.execute", mapi_result_error(SERVERsessions[i].hdl)); *ret = *key; return MAL_SUCCEED;}str SERVERfinish(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.finish","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1513 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" mapi_finish(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.finish", mapi_result_error(SERVERsessions[i].hdl)); *ret = *key; return MAL_SUCCEED;}str SERVERget_row_count(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.get_row_count","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1525 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret= mapi_get_row_count(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.get_row_count", mapi_result_error(SERVERsessions[i].hdl)); return MAL_SUCCEED;}str SERVERget_field_count(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.get_field_count","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1536 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret= mapi_get_field_count(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.get_field_count", mapi_result_error(SERVERsessions[i].hdl)); return MAL_SUCCEED;}str SERVERrows_affected(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.rows_affected","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1547 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret= mapi_rows_affected(SERVERsessions[i].hdl); return MAL_SUCCEED;}str SERVERfetch_row(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_row","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1555 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret= mapi_fetch_row(SERVERsessions[i].hdl); return MAL_SUCCEED;}str SERVERfetch_all_rows(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_all_rows","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1563 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" *ret= mapi_fetch_all_rows(SERVERsessions[i].hdl); return MAL_SUCCEED;}str SERVERfetch_field_str(str *ret, int *key, int *fnr){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1572 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_field(SERVERsessions[i].hdl,*fnr); *ret= GDKstrdup(fld? fld: str_nil); if( mapi_error(mid) ) throw(MAL, "mserver.fetch_field_str", mapi_result_error(SERVERsessions[i].hdl)); return MAL_SUCCEED;}str SERVERfetch_field_int(int *ret, int *key, int *fnr){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1585 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_field(SERVERsessions[i].hdl,*fnr); *ret= fld? (int) atol(fld): int_nil; if( mapi_error(mid) ) throw(MAL, "mserver.fetch_field_int", mapi_result_error(SERVERsessions[i].hdl)); return MAL_SUCCEED;}str SERVERfetch_field_lng(lng *ret, int *key, int *fnr){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1598 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_field(SERVERsessions[i].hdl,*fnr); *ret= fld? atol(fld): lng_nil; if( mapi_error(mid) ) throw(MAL, "mserver.fetch_field_lng", mapi_result_error(SERVERsessions[i].hdl)); return MAL_SUCCEED;}str SERVERfetch_field_sht(sht *ret, int *key, int *fnr){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1611 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_field(SERVERsessions[i].hdl,*fnr); *ret= fld? (sht) atol(fld): sht_nil; if( mapi_error(mid) ) throw(MAL, "mserver.fetch_field", mapi_result_error(SERVERsessions[i].hdl)); return MAL_SUCCEED;}str SERVERfetch_field_void(oid *ret, int *key, int *fnr){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1623 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" (void) fnr; *ret = oid_nil; throw(MAL, "mserver.fetch_field_void","defaults to nil");}str SERVERfetch_field_oid(oid *ret, int *key, int *fnr){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1633 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_field(SERVERsessions[i].hdl,*fnr); if( mapi_error(mid) ) throw(MAL, "mserver.fetch_field_oid", mapi_result_error(SERVERsessions[i].hdl)); if(fld==0 || strcmp(fld,"nil")==0) *(oid*) ret= void_nil; else *(oid*) ret = (oid) atol(fld); return MAL_SUCCEED;}str SERVERfetch_field_chr(chr *ret, int *key, int *fnr){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_field","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1648 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_field(SERVERsessions[i].hdl,*fnr); if( mapi_error(mid) ) throw(MAL, "mserver.fetch_field_chr", mapi_result_error(SERVERsessions[i].hdl)); if(fld==0 || strcmp(fld,"nil")==0) *(chr*) ret= chr_nil; else *(chr*) ret = *fld; return MAL_SUCCEED;}str SERVERfetch_line(str *ret, int *key){ Mapi mid; int i; str fld; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_line","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1663 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" fld= mapi_fetch_line(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.fetch_line", mapi_result_error(SERVERsessions[i].hdl)); *ret= GDKstrdup(fld? fld:str_nil); return MAL_SUCCEED;}str SERVERnext_result(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.next_result","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1675 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" mapi_next_result(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.next_result", mapi_result_error(SERVERsessions[i].hdl)); *ret= *key; return MAL_SUCCEED;}str SERVERfetch_reset(int *ret, int *key){ Mapi mid; int i; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.fetch_reset","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1687 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" mapi_fetch_reset(SERVERsessions[i].hdl); if( mapi_error(mid) ) throw(MAL, "mserver.fetch_reset", mapi_result_error(SERVERsessions[i].hdl)); *ret= *key; return MAL_SUCCEED;}strSERVERfetch_field_bat(int *bid, int *key){ int i,j,cnt; Mapi mid; char *fld; int o=0; BAT *b; #line 1375 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" for(i=0; i< MAXSESSIONS; i++) if( SERVERsessions[i].c && SERVERsessions[i].key== *key ) break; if( i== MAXSESSIONS) throw(MAL, "mserver.rpc","Access violation," " could not find matching session descriptor"); mid= SERVERsessions[i].mid; (void) mid; /* silence compilers */#line 1703 "/export/scratch0/monet/monet.GNU.64.64.d.14791/MonetDB5/src/modules/mal/mserver.mx" b= BATnew(TYPE_oid,TYPE_str,256); cnt= mapi_get_field_count(SERVERsessions[i].hdl); for(j=0; j< cnt; j++){ fld= mapi_fetch_field(SERVERsessions[i].hdl,j); if( mapi_error(mid) ) { *bid = b->batCacheid; BBPkeepref(*bid); throw(MAL, "mserver.fetch_field_bat",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -