| | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | |
| | | /* 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) |
| | | { |
| | |
| | | |
| | | /* 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); |