trying to implement list_tables

This commit is contained in:
Max Lapshin
2009-10-13 09:00:25 +04:00
parent 690974d808
commit 9a3aea50a7
2 changed files with 25 additions and 20 deletions

View File

@@ -65,22 +65,24 @@ static void outputv(ErlDrvData handle, ErlIOVec *ev) {
ErlDrvBinary* data = ev->binv[1]; ErlDrvBinary* data = ev->binv[1];
int command = data->orig_bytes[0]; // First byte is the command int command = data->orig_bytes[0]; // First byte is the command
// switch(command) { fprintf(stderr, "Command: %s\n", data->orig_bytes);
// case CMD_PUT:
// put(driver_data, ev); switch(command) {
// break; case CMD_LIST_TABLES:
// list_tables(driver_data, ev);
// case CMD_GET: break;
// get(driver_data, ev);
// break; // case CMD_GET:
// // get(driver_data, ev);
// case CMD_DEL: // break;
// del(driver_data, ev); //
// break; // case CMD_DEL:
// // del(driver_data, ev);
// default: // break;
// unkown(driver_data, ev);
// } default:
unkown(driver_data, ev);
}
} }
static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data) static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data)
@@ -88,6 +90,9 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data)
} }
static void list_tables(sqlite3_drv_t *drv, ErlIOVec *ev) {
}
#if 0 #if 0
// Insert or replace record in the database // Insert or replace record in the database
static void put(sqlite3_drv_t *bdb_drv, ErlIOVec *ev) { static void put(sqlite3_drv_t *bdb_drv, ErlIOVec *ev) {

View File

@@ -9,9 +9,9 @@
#define DB_PATH "./store.db" #define DB_PATH "./store.db"
// Binary commands between Erlang VM and Driver // Binary commands between Erlang VM and Driver
#define CMD_PUT 1 #define CMD_LIST_TABLES 1
#define CMD_GET 2 #define CMD_SQL_EXEC 2
#define CMD_DEL 3 // #define CMD_DEL 3
// Number of bytes for each key // Number of bytes for each key
// (160 bits for SHA1 hash) // (160 bits for SHA1 hash)
@@ -29,7 +29,7 @@ static ErlDrvData start(ErlDrvPort port, char* cmd);
static void stop(ErlDrvData handle); static void stop(ErlDrvData handle);
static void outputv(ErlDrvData handle, ErlIOVec *ev); static void outputv(ErlDrvData handle, ErlIOVec *ev);
static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data); static void ready_async(ErlDrvData drv_data, ErlDrvThreadData thread_data);
// static void put(bdb_drv_t *bdb_drv, ErlIOVec *ev); static void list_tables(sqlite3_drv_t *drv, ErlIOVec *ev);
// static void get(bdb_drv_t *bdb_drv, ErlIOVec *ev); // static void get(bdb_drv_t *bdb_drv, ErlIOVec *ev);
// static void del(bdb_drv_t *bdb_drv, ErlIOVec *ev); // static void del(bdb_drv_t *bdb_drv, ErlIOVec *ev);
static void unkown(sqlite3_drv_t *bdb_drv, ErlIOVec *ev); static void unkown(sqlite3_drv_t *bdb_drv, ErlIOVec *ev);