fixes on stored proc

master
Bill 2 years ago
parent da901ee7fa
commit 4942dc1f50

@ -4,10 +4,10 @@ MonetDB_INC =
Defines =
CXXFLAGS = --std=c++2a
ifeq ($(AQ_DEBUG), 1)
OPTFLAGS = -g3 -fsanitize=address -fsanitize=leak
OPTFLAGS = -g3 #-fsanitize=address
LINKFLAGS =
else
OPTFLAGS = -O3 -DNDEBUG -fno-stack-protector
OPTFLAGS = -Ofast -DNDEBUG -fno-stack-protector
LINKFLAGS = -flto -s
endif
SHAREDFLAGS = -shared

@ -2,7 +2,7 @@
## GLOBAL CONFIGURATION FLAGS
version_string = '0.5.4a'
version_string = '0.6.0a'
add_path_to_ldpath = True
rebuild_backend = False
run_backend = True

@ -117,7 +117,7 @@ class build_manager:
else:
mgr.cxx = os.environ['CXX']
if 'AQ_DEBUG' not in os.environ:
os.environ['AQ_DEBUG'] = '0' if mgr.OptimizationLv else '1'
os.environ['AQ_DEBUG'] = ('0' if mgr.OptimizationLv != '0' else '1')
def libaquery_a(self):
self.build_cmd = [['rm', 'libaquery.a'],['make', 'libaquery']]
@ -184,7 +184,7 @@ class build_manager:
def __init__(self) -> None:
self.method = 'make'
self.cxx = ''
self.OptimizationLv = '0' # [O0, O1, O2, O3, Ofast]
self.OptimizationLv = '4' # [O0, O1, O2, O3, Ofast]
self.Platform = 'amd64'
self.PCH = os.environ['PCH'] if 'PCH' in os.environ else 1
self.StaticLib = 1

@ -503,6 +503,7 @@ start:
};
const auto& load_proc_fromfile = [&](StoredProcedure& p) {
auto config_name = procedure_root + p.name + ".aqp";
puts(p.name);
auto fp = fopen(config_name.c_str(), "rb");
if(fp == nullptr){
puts("ERROR: Procedure not found on disk.");
@ -517,12 +518,14 @@ start:
p.queries = static_cast<char**>(malloc(sizeof(char*) * p.cnt));
p.queries[0] = static_cast<char*>(malloc(sizeof(char) * queries_size));
fread(&p.queries[0], queries_size, 1, fp);
fread(p.queries[0], 1, queries_size, fp);
for(uint32_t j = 1; j < p.cnt; ++j){
p.queries[j] = p.queries[j-1];
while(*p.queries[j] != '\0')
while(*(p.queries[j]) != '\0')
++p.queries[j];
++p.queries[j];
puts(p.queries[j-1]);
}
fclose(fp);
return load_modules(p);
@ -553,18 +556,22 @@ start:
auto _proc = cxt->stored_proc.find(proc_name);
if (_proc == cxt->stored_proc.end()){
printf("Procedure %s not found. Trying load from disk.\n", proc_name);
if (load_proc_fromfile(current_procedure)){
current_procedure.name = copy_lpstr(proc_name);
if (!load_proc_fromfile(current_procedure)){
cxt->stored_proc.insert_or_assign(proc_name, current_procedure);
}
else {
continue;
}
}
else{
current_procedure = _proc->second;
n_recv = current_procedure.cnt;
n_recvd = current_procedure.queries;
load_modules(current_procedure);
procedure_replaying = true;
goto start; // yes, I know, refactor later!!
}
n_recv = current_procedure.cnt;
n_recvd = current_procedure.queries;
load_modules(current_procedure);
procedure_replaying = true;
goto start; // yes, I know, refactor later!!
}
break;
case 'D': // delete procedure
@ -572,6 +579,9 @@ start:
case 'S': //save procedure
break;
case 'L': //load procedure
if (!load_proc_fromfile(current_procedure)) {
cxt->stored_proc.insert_or_assign(proc_name, current_procedure);
}
break;
case 'd': // display all procedures
for(const auto& p : cxt->stored_proc){

Loading…
Cancel
Save