Show
Ignore:
Timestamp:
09/02/09 18:33:48 (15 years ago)
Author:
cdietric
Message:

updates for CROSS-OSSIE demo

Files:
1 modified

Legend:

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

    r449 r457  
    5757    char *zErrMsg = 0; 
    5858 
    59     //printf("command: %s\n", _cbr->command); 
     59    printf("command: %s\n", _cbr->command); 
    6060    rc = sqlite3_exec(_cbr->db, _cbr->command, callback, 0, &zErrMsg); 
    6161    if( rc!=SQLITE_OK){ 
     
    6363        sqlite3_free(zErrMsg); 
    6464    } else{ 
    65         //printf("command executed.\n"); 
     65        printf("command executed.\n"); 
    6666    } 
    6767    return rc; 
     
    129129            strcat(_cbr->command, ", "); 
    130130    } 
    131     strcat(_cbr->command, ", timestamp DATE);"); 
     131    strcat(_cbr->command, ", timestamp DATE, PRIMARY KEY(biterrorrate,tx_power));"); 
    132132 
    133133    // execute create table command 
     
    202202    unsigned int i; 
    203203    char str_buffer[64]; 
    204     printf("number of ops %d:\n", _n); 
     204    //printf("number of ops %d:\n", _n); 
    205205    for (i=0; i<_n; i++) { 
    206206        // ensure valid ops value 
     
    212212        strcat(_cbr->command, _names[i]); 
    213213        strcat(_cbr->command, ops_str[_ops[i]]); 
    214     printf("search command: %s\n", _cbr->command); 
    215214        sprintf(str_buffer, "%E", _vals[i]); 
    216215        strcat(_cbr->command, str_buffer); 
     
    220219            strcat(_cbr->command, " AND "); 
    221220        else 
    222             strcat(_cbr->command, " order by utility, timestamp desc );"); 
    223     } 
    224  
    225     //printf("search command: %s\n", _cbr->command); 
     221            strcat(_cbr->command, " order by abs(utility) asc, timestamp desc;"); 
     222    } 
     223 
     224    printf("search command: %s\n", _cbr->command); 
    226225 
    227226    //ExecuteCommand(_cbr); 
    228227    rc = ExecuteSearchCommand(_cbr, _retvals); 
    229228     
    230     /*printf("search result: "); 
    231     for (i=0; i<_cbr->num_columns; i++) 
     229    printf("search result: "); 
     230    for (i=0; i<_cbr->num_columns +1; i++) 
    232231        printf("%f, ",_retvals[i]); 
    233     printf("\n");*/ 
     232    printf("\n"); 
    234233 
    235234    return rc; 
     
    258257    } 
    259258    
    260     strcat(_cbr->command, "timestamp = DATETIME('NOW')"); 
     259    strcat(_cbr->command, ", timestamp = DATETIME('NOW')"); 
    261260     
    262261    strcat(_cbr->command, " WHERE "); 
     
    272271    strcat(_cbr->command, ";"); 
    273272     
    274     //printf("search command: %s\n", _cbr->command); 
     273    //printf("update command: %s\n", _cbr->command); 
    275274    // execute add command 
    276275    ExecuteCommand(_cbr); 
     
    286285    // generate command 
    287286    //printf("%s\n", _cbr->command); 
    288     strcpy(_cbr->command, "insert into "); 
     287    strcpy(_cbr->command, "replace into "); 
    289288    strcat(_cbr->command, _cbr->tablename); 
    290289