diff --git a/README.md b/README.md index 20400d0..e6cec8f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AQuery++ DB +## Introduction -AQuery++ Database is an In-Memory Column-Store Database that incorporates compiled query execution. +AQuery++ Database is a cross-platform, In-Memory Column-Store Database that incorporates compiled query execution. Compiler frontend built on top of [mo-sql-parsing](https://github.com/klahnakoski/mo-sql-parsing). ## Roadmap @@ -24,8 +25,20 @@ Compiler frontend built on top of [mo-sql-parsing](https://github.com/klahnakosk - [ ] C++ Meta-Programming: Elimilate template recursions as much as possible. - [ ] IPC: Better ways to communicate between Interpreter (Python) and Executer (C++). - [ ] Sockets? stdin/stdout capture? -## Introduction ## Requirements +Recent version of Linux, Windows or MacOS, with recent C++ compiler that has C++17 (1z) support (e.g. gcc 6.0, MSVC 2017, clang 6.0), and python 3.6 or above. ## Usage +`python3 prompt.py` will launch the interactive command prompt. The server binary will be autometically rebuilt and started. +#### Commands: +- ``: parse sql statement +- `f `: parse all sql statements in file +- `print`: printout parsed sql statements +- `exec`: execute last parsed statement(s) +- `r`: run the last generated code snippet +- `save `: save current code snippet. will use random filename if not specified. +- `exit`: quit the prompt +#### Example: + `f moving_avg.a`
+ `exec` \ No newline at end of file diff --git a/msc-plugin/msc-plugin.vcxproj b/msc-plugin/msc-plugin.vcxproj index 8e000f0..682cfb8 100644 --- a/msc-plugin/msc-plugin.vcxproj +++ b/msc-plugin/msc-plugin.vcxproj @@ -93,7 +93,7 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpplatest Console @@ -109,7 +109,7 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpplatest Console @@ -125,7 +125,7 @@ true _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpplatest Console @@ -141,7 +141,7 @@ true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpplatest Console diff --git a/prompt.py b/prompt.py index 94fbd62..e956c3a 100644 --- a/prompt.py +++ b/prompt.py @@ -92,6 +92,8 @@ cxt = None while test_parser: try: if server.poll() is not None: + mm.seek(0,os.SEEK_SET) + mm.write(b'\x01\x00') server = subprocess.Popen(["./server.bin", shm]) q = input() if q == 'exec': @@ -128,6 +130,15 @@ while test_parser: mm.seek(0,os.SEEK_SET) mm.write(b'\x01\x01') continue + elif q.startswith('save'): + filename = re.split(' |\t', q) + if (len(filename) > 1): + filename = filename[1] + else: + filename = f'out_{base62uuid(4)}.cpp' + with open(filename, 'wb') as outfile: + outfile.write((cxt.finalize()).encode('utf-8')) + continue trimed = ws.sub(' ', q.lower()).split(' ') if trimed[0].startswith('f'): fn = 'stock.a' if len(trimed) <= 1 or len(trimed[1]) == 0 \ diff --git a/server/server.vcxproj b/server/server.vcxproj index 92de8fb..0c38f23 100644 --- a/server/server.vcxproj +++ b/server/server.vcxproj @@ -23,32 +23,32 @@ Win32Proj {031352c2-afbb-45aa-9518-dbc1f9ef2af3} server - 10.0 + 10.0.19041.0 Application true - v143 + v141 Unicode Application false - v143 + v141 true Unicode Application true - v143 + v141 Unicode Application false - v143 + v141 true Unicode @@ -88,9 +88,9 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp20 true true + stdcpplatest Console @@ -105,9 +105,9 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp20 true true + stdcpplatest Console @@ -122,9 +122,9 @@ true _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp20 true true + stdcpplatest Console @@ -139,9 +139,9 @@ true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp20 true true + stdcpplatest Console diff --git a/stock.a b/stock.a index 6d05fc8..395727e 100644 --- a/stock.a +++ b/stock.a @@ -29,4 +29,4 @@ SELECT price, timestamp FROM stocks where price - timestamp > 1 and not (price*t /* "q4"*/ SELECT max(price-mins(price)) FROM stocks - ASSUMING ASC price + ASSUMING DESC timestamp