fixes on stored proc

master
Bill 2 years ago
parent da901ee7fa
commit 4942dc1f50

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

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

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

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

Loading…
Cancel
Save