Changeset 24 for vtcross

Show
Ignore:
Timestamp:
10/22/08 14:16:51 (16 years ago)
Author:
ahe
Message:

clean the code

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/cbr.c

    r23 r24  
    88 
    99#include "cbr.h" 
     10 
    1011 
    1112struct cbr_s { 
     
    1819 
    1920 
    20 // open database or create database is it does not exist 
     21// open a database or create a database if it does not exist 
    2122int OpenDatabase(cbr _cbr){ 
    2223    int rc; 
     
    3940 
    4041 
    41 //int cbr_callback(float *retvals, int argc, char **argv, char **azColName) 
     42// simple callback function, display result 
    4243int callback(void *notUsed, int argc, char **argv, char **azColName){ 
    4344    int i; 
     
    5051 
    5152 
    52 /*int SearchCallback(float *_retvals, int argc, char **argv, char **azColName){ 
    53     int i; 
    54     for(i=0; i<argc; i++){ 
    55         printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); 
    56         sscanf((argv[i] ? argv[i] : "NULL"), "%f", _retvals+i); 
    57     } 
    58     printf("\n"); 
    59     return 0; 
    60 }*/ 
    61  
    62  
    63  
     53// execute command 
    6454int ExecuteCommand(cbr _cbr){ 
    6555    int rc; 
     
    7868 
    7969 
     70// execute search command 
    8071int ExecuteSearchCommand(cbr _cbr, float *_retvals){ 
    8172    int rc; 
     
    10495 
    10596 
    106  
     97// create database 
    10798cbr cbr_create(char * _filename, char * _tablename, char * _cols[], unsigned int _len) 
    10899{ 
     
    148139 
    149140 
     141// free space 
    150142void cbr_free(cbr _cbr) 
    151 { 
    152     // delete table 
    153      
     143 
    154144    // generate command, remove a table with its content 
    155145    strcpy(_cbr->command, "drop table "); 
     
    167157 
    168158 
     159// print  
    169160void cbr_print(cbr _cbr) 
    170161{ 
     
    193184 
    194185 
     186// cbr search 
    195187int cbr_search( 
    196188    cbr _cbr, 
     
    200192    unsigned int _n, 
    201193    float *_retvals) 
    202 { 
    203     // cbr search 
    204      
     194{    
    205195    // generate command 
    206196    strcpy(_cbr->command, "select "); 
     
    241231} 
    242232 
     233 
     234// cbr add a row 
    243235int cbr_add_row(cbr _cbr, char *_cols[], float *_vals, unsigned int _len) 
    244236{