Added a basic TCP server that provides access to an sqlite database. (0.37.58)
This commit is contained in:
parent
8478c49240
commit
b513cf0463
5 changed files with 502 additions and 1 deletions
35
examples/sqlited/protocol.md
Normal file
35
examples/sqlited/protocol.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
Fun SQL TCP Demo Protocol (TSV, line-based)
|
||||
|
||||
- Client sends exactly one line with the SQL text terminated by a newline ("\n"). The server reads up to 64 KiB.
|
||||
|
||||
Responses
|
||||
|
||||
1) Query returning rows (e.g., SELECT):
|
||||
RESULT
|
||||
col1\tcol2\t...\n
|
||||
v11\tv12\t...\n
|
||||
...
|
||||
END
|
||||
|
||||
Notes:
|
||||
- First line is the literal word RESULT followed by a newline.
|
||||
- Second line is a header with column names separated by a single tab ("\t").
|
||||
- Each subsequent line is one row; fields are tab-separated. Nil/NULL are encoded as empty strings.
|
||||
- The block terminates with a line containing the literal END.
|
||||
|
||||
2) Exec/DDL (e.g., INSERT/UPDATE/CREATE):
|
||||
OK rc
|
||||
|
||||
Notes:
|
||||
- rc is the sqlite3 result code (0 indicates success).
|
||||
|
||||
3) Error:
|
||||
ERROR message
|
||||
|
||||
Notes:
|
||||
- The error message is human-readable and not machine-stable.
|
||||
|
||||
General
|
||||
- Newlines are Unix style ("\n").
|
||||
- Tabs and newlines in data are replaced with spaces for TSV safety.
|
||||
- The server closes the connection after sending the response.
|
||||
Loading…
Add table
Add a link
Reference in a new issue