Changeset 28 for vtcross

Show
Ignore:
Timestamp:
11/13/08 15:40:16 (16 years ago)
Author:
ahe
Message:

incorporate ezxml with cbr

Location:
vtcross/trunk
Files:
4 added
3 modified

Legend:

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

    r26 r28  
    5656    char *zErrMsg = 0; 
    5757 
    58     //printf("command: %s\n", _cbr->command); 
     58    printf("command: %s\n", _cbr->command); 
    5959    rc = sqlite3_exec(_cbr->db, _cbr->command, callback, 0, &zErrMsg); 
    6060    if( rc!=SQLITE_OK){ 
     
    6262        sqlite3_free(zErrMsg); 
    6363    } else{ 
    64         //printf("command executed.\n"); 
     64        printf("command executed.\n"); 
    6565    } 
    6666    return rc; 
     
    7474    unsigned int i; 
    7575 
    76     //printf("command: %s\n", _cbr->command); 
     76    printf("command: %s\n", _cbr->command); 
    7777    sqlite3_stmt * pStatement; 
    7878    rc = sqlite3_prepare_v2(_cbr->db, _cbr->command, -1, &pStatement, NULL); 
     
    8080        for (i=0; i<_cbr->num_columns; ++i) 
    8181            _retvals[i] = sqlite3_column_double(pStatement, i); 
    82     } else { 
    83         //printf("no row found\n"); 
    84         return 0; 
    8582    } 
    8683    sqlite3_finalize(pStatement); 
     
    9491    }*/ 
    9592 
    96     return 1; 
     93    return rc; 
    9794} 
    9895 
     
    224221 
    225222    //ExecuteCommand(_cbr); 
    226     return ExecuteSearchCommand(_cbr, _retvals); 
    227      
    228 #if 0 
     223    ExecuteSearchCommand(_cbr, _retvals); 
     224     
    229225    printf("search result: "); 
    230226    for (i=0; i<_cbr->num_columns; i++) 
     
    233229 
    234230    return 0; 
    235 #endif 
    236231} 
    237232 
     
    243238     
    244239    // generate command 
    245     //printf("%s\n", _cbr->command); 
     240    printf("%s\n", _cbr->command); 
    246241    strcpy(_cbr->command, "insert into "); 
    247242    strcat(_cbr->command, _cbr->tablename); 
  • vtcross/trunk/src/cbr.h

    r16 r28  
    44 
    55#include "sqlite3.h" 
     6#include "ezxml.h" 
    67 
    78//#define CBR_LEN_FILENAME 64 
  • vtcross/trunk/src/main_cbr.c

    r25 r28  
    77 
    88int main() { 
    9     unsigned int num_cols = 7; 
    10     char * cols[] = { 
     9    unsigned int num_cols = 7;  
     10    unsigned int i; 
     11 
     12    ezxml_t f1 = ezxml_parse_file("another.xml"), engine, column; 
     13    char * cols[num_cols]; 
     14     
     15    for (engine = ezxml_child(f1, "engine"); engine; engine = engine->next){ 
     16        i = 0; 
     17        for (column = ezxml_child(engine, "column"); column; column = column->next){ 
     18            cols[i] = ezxml_child(column, "name")->txt; 
     19            i++; 
     20        } 
     21    } 
     22 
     23 
     24    free(f1); 
     25                             
     26    /* char * cols[] = { 
    1127        "BER", "throughput", 
    1228        "mod_scheme", "tx_power", 
    1329        "noise_power", "path_loss", 
    1430        "utility" 
    15     }; 
     31    };*/ 
     32     
     33    for (i = 0; i<num_cols; i++){ 
     34        printf(" %s",cols[i]); 
     35    } 
     36    printf("\n"); 
     37 
    1638    float vals[num_cols]; 
    1739    vals[0] = 1e-3f;    // BER 
     
    4062    float retvals[num_cols]; 
    4163    rc = cbr_search(mycbr, search_names, search_ops, search_vals, 2, retvals); 
    42     if (rc) 
    43         printf("solution found!\n"); 
    44     else 
    45         printf("warning! no solution found\n"); 
    4664 
    4765    // clean up