From bffa2be267ab1fdafbc6c9348df053e477e63f49 Mon Sep 17 00:00:00 2001
From: Guo Wenxue <guowenxue@gmail.com>
Date: Fri, 08 Sep 2023 11:18:24 +0800
Subject: [PATCH] update socketd project and test okay

---
 project/socketd/booster/database.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/project/socketd/booster/database.c b/project/socketd/booster/database.c
index 00b10cb..93f386a 100644
--- a/project/socketd/booster/database.c
+++ b/project/socketd/booster/database.c
@@ -125,7 +125,7 @@
         return -2;
     }
 
-    snprintf(sql, sizeof(sql), "insert into %s(packet) values(?)", TABLE_NAME);
+    snprintf(sql, sizeof(sql), "INSERT INTO %s(packet) VALUES(?)", TABLE_NAME);
     rv = sqlite3_prepare_v2(s_clidb, sql, -1, &stat, NULL);
     if(SQLITE_OK!=rv || !stat)
     {
@@ -188,7 +188,7 @@
     }
 
     /* Only query the first packet record */
-    snprintf(sql, sizeof(sql), "select packet from %s limit 0,1;", TABLE_NAME);
+    snprintf(sql, sizeof(sql), "SELECT packet FROM %s WHERE rowid = (SELECT rowid FROM %s LIMIT 1);", TABLE_NAME, TABLE_NAME);
     rv = sqlite3_prepare_v2(s_clidb, sql, -1, &stat, NULL);
     if(SQLITE_OK!=rv || !stat)
     {
@@ -248,7 +248,7 @@
 
     /*  remove packet from db */
     memset(sql, 0, sizeof(sql));
-    snprintf(sql, sizeof(sql), "delete from %s limit 0,1;", TABLE_NAME);
+    snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE rowid = (SELECT rowid FROM %s LIMIT 1);", TABLE_NAME, TABLE_NAME);
     if( SQLITE_OK != sqlite3_exec(s_clidb, sql, NULL, 0, &errmsg) )
     {
         log_error("delete first blob packet from database failure: %s\n", errmsg);

--
Gitblit v1.9.1