[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql dc2afbbc1f 221/427: Adjust the Emacsql wire protoc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql dc2afbbc1f 221/427: Adjust the Emacsql wire protocol. |
Date: |
Tue, 13 Dec 2022 02:59:45 -0500 (EST) |
branch: elpa/emacsql
commit dc2afbbc1f37e296311a020e8e6eb3bee55098cb
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Adjust the Emacsql wire protocol.
---
emacsql.el | 18 ++++--------------
sqlite/emacsql.c | 25 +++++++++++++++++--------
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/emacsql.el b/emacsql.el
index d2fab3ba60..c1148e5d6a 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -173,25 +173,15 @@ Subclasses should override this method in order to
provide more
specific error conditions."
(signal 'emacsql-syntax (list code message)))
-(defmethod emacsql-check-error ((connection emacsql-protocol-mixin))
- "Signal the error message from CONNECTION, or return nil."
- (with-current-buffer (emacsql-buffer connection)
- (let ((standard-input (current-buffer)))
- (setf (point) (point-min))
- (when (eql (read) 'error)
- (emacsql-handle connection (read) (read))))))
-
(defmethod emacsql-parse ((connection emacsql-protocol-mixin))
"Parse well-formed output into an s-expression."
- (emacsql-check-error connection)
(with-current-buffer (emacsql-buffer connection)
(setf (point) (point-min))
(let* ((standard-input (current-buffer))
- (num-columns (read)))
- (forward-char 1)
- (cl-loop until (looking-at "#")
- collect (cl-loop repeat num-columns collect (read))
- and do (forward-char 1)))))
+ (value (read)))
+ (if (eql value 'error)
+ (emacsql-handle connection (read) (read))
+ value))))
(provide 'emacsql) ; end of generic function declarations
diff --git a/sqlite/emacsql.c b/sqlite/emacsql.c
index 3a65f540eb..bef407e68b 100644
--- a/sqlite/emacsql.c
+++ b/sqlite/emacsql.c
@@ -102,33 +102,42 @@ int main(int argc, char **argv) {
}
/* Print out rows. */
- int ncolumns = sqlite3_column_count(stmt);
- printf("%d\n", ncolumns);
+ int first = TRUE, ncolumns = sqlite3_column_count(stmt);
+ printf("(");
while (sqlite3_step(stmt) == SQLITE_ROW) {
+ if (first) {
+ printf("(");
+ first = FALSE;
+ } else {
+ printf("\n (");
+ }
for (int i = 0; i < ncolumns; i++) {
+ if (i > 0) {
+ printf(" ");
+ }
int type = sqlite3_column_type(stmt, i);
switch (type) {
case SQLITE_INTEGER:
- printf(" %llu", sqlite3_column_int64(stmt, i));
+ printf("%lld", sqlite3_column_int64(stmt, i));
break;
case SQLITE_FLOAT:
- printf(" %f", sqlite3_column_double(stmt, i));
+ printf("%f", sqlite3_column_double(stmt, i));
break;
case SQLITE_NULL:
- printf(" nil");
+ printf("nil");
break;
case SQLITE_TEXT:
- fputc(' ', stdout);
fwrite(sqlite3_column_text(stmt, i), 1,
sqlite3_column_bytes(stmt, i), stdout);
break;
case SQLITE_BLOB:
- printf(" nil");
+ printf("nil");
break;
}
}
- printf("\n");
+ printf(")");
}
+ printf(")\n");
if (sqlite3_finalize(stmt) != SQLITE_OK) {
fprintf(stderr, "error %d: %s\n",
sqlite3_errcode(db), sqlite3_errmsg(db));
- [nongnu] elpa/emacsql 1ad58cd68d 108/427: Allow substatement in IN operator., (continued)
- [nongnu] elpa/emacsql 1ad58cd68d 108/427: Allow substatement in IN operator., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8fa7c00978 170/427: Add sentinel cleanup to psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6d17256e1b 171/427: Add a mix-in class to reduce code duplication., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 749becb017 181/427: Disable notices and warnings in psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e42d939235 187/427: In SQLite, block for up to 30 seconds on db lock., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3ba9109d45 198/427: Start using real version numbers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql de0bde9a02 207/427: Use Cask package-file directive instead., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bb3dbfc891 213/427: Set a global query timeout., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 394bb062aa 219/427: Add a small library for determining binary to use., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql f030b9952d 224/427: Fix up psql-connection., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql dc2afbbc1f 221/427: Adjust the Emacsql wire protocol.,
ELPA Syncer <=
- [nongnu] elpa/emacsql 6318472b20 223/427: Link the Makefiles together., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a7728339ba 216/427: Switch to custom middleware., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ab53199d07 232/427: Fix escaping issue in middleware., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6ad267f93b 229/427: Change :value to :scalar., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1146f2e26a 233/427: Flesh out the changes in the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ed77eac846 237/427: Add string prepared statements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 847196cafa 226/427: Set tty to raw in psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3e5ce21b0d 242/427: Tweak the new implementation notes., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a459708684 244/427: Move tests into their own directory., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 4db068920d 247/427: Provide MySQL front-end., ELPA Syncer, 2022/12/13