Changeset 457 for vtcross/trunk/src/cognitive_engines/OSSIE_DEMO_CE/cbr.c
- Timestamp:
- 09/02/09 18:33:48 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/cognitive_engines/OSSIE_DEMO_CE/cbr.c
r449 r457 57 57 char *zErrMsg = 0; 58 58 59 //printf("command: %s\n", _cbr->command);59 printf("command: %s\n", _cbr->command); 60 60 rc = sqlite3_exec(_cbr->db, _cbr->command, callback, 0, &zErrMsg); 61 61 if( rc!=SQLITE_OK){ … … 63 63 sqlite3_free(zErrMsg); 64 64 } else{ 65 //printf("command executed.\n");65 printf("command executed.\n"); 66 66 } 67 67 return rc; … … 129 129 strcat(_cbr->command, ", "); 130 130 } 131 strcat(_cbr->command, ", timestamp DATE );");131 strcat(_cbr->command, ", timestamp DATE, PRIMARY KEY(biterrorrate,tx_power));"); 132 132 133 133 // execute create table command … … 202 202 unsigned int i; 203 203 char str_buffer[64]; 204 printf("number of ops %d:\n", _n);204 //printf("number of ops %d:\n", _n); 205 205 for (i=0; i<_n; i++) { 206 206 // ensure valid ops value … … 212 212 strcat(_cbr->command, _names[i]); 213 213 strcat(_cbr->command, ops_str[_ops[i]]); 214 printf("search command: %s\n", _cbr->command);215 214 sprintf(str_buffer, "%E", _vals[i]); 216 215 strcat(_cbr->command, str_buffer); … … 220 219 strcat(_cbr->command, " AND "); 221 220 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); 226 225 227 226 //ExecuteCommand(_cbr); 228 227 rc = ExecuteSearchCommand(_cbr, _retvals); 229 228 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++) 232 231 printf("%f, ",_retvals[i]); 233 printf("\n"); */232 printf("\n"); 234 233 235 234 return rc; … … 258 257 } 259 258 260 strcat(_cbr->command, " timestamp = DATETIME('NOW')");259 strcat(_cbr->command, ", timestamp = DATETIME('NOW')"); 261 260 262 261 strcat(_cbr->command, " WHERE "); … … 272 271 strcat(_cbr->command, ";"); 273 272 274 //printf(" searchcommand: %s\n", _cbr->command);273 //printf("update command: %s\n", _cbr->command); 275 274 // execute add command 276 275 ExecuteCommand(_cbr); … … 286 285 // generate command 287 286 //printf("%s\n", _cbr->command); 288 strcpy(_cbr->command, " insertinto ");287 strcpy(_cbr->command, "replace into "); 289 288 strcat(_cbr->command, _cbr->tablename); 290 289