Changeset 292:a77ed0e30ac9 in freeDiameter
- Timestamp:
- May 10, 2010, 2:26:42 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_acct/acct_db.c
r285 r292 158 158 159 159 if (acct_config->tsfield) { 160 ADD_EXTEND(" 'now', ");160 ADD_EXTEND("$%d, ", ++idx); 161 161 } 162 162 163 163 for (li = emptyrecords.all.next; li != &emptyrecords.all; li = li->next) { 164 164 struct acct_record_item * i = (struct acct_record_item *)(li->o); 165 idx += 1; 166 ADD_EXTEND("$%d::%s", idx, diam2db_types_mapping[i->param->avptype]); 165 ADD_EXTEND("$%d::%s", ++idx, diam2db_types_mapping[i->param->avptype]); 167 166 168 167 if (li->next != &emptyrecords.all) { … … 207 206 int *val_isbin; 208 207 int idx = 0; 208 int size = 0; 209 209 PGresult *res; 210 210 struct fd_list *li; … … 224 224 } 225 225 226 size = acct_config->tsfield ? records->nball + 1 : records->nball; 227 226 228 /* Alloc the arrays of parameters */ 227 CHECK_MALLOC( val = calloc(records->nball, sizeof(const char *)) ); 228 CHECK_MALLOC( val_len = calloc(records->nball, sizeof(const int)) ); 229 CHECK_MALLOC( val_isbin = calloc(records->nball, sizeof(const int)) ); 229 CHECK_MALLOC( val = calloc(size, sizeof(const char *)) ); 230 CHECK_MALLOC( val_len = calloc(size, sizeof(const int)) ); 231 CHECK_MALLOC( val_isbin = calloc(size, sizeof(const int)) ); 232 233 if (acct_config->tsfield) { 234 val[idx] = "now"; 235 val_len[idx] = 3; 236 val_isbin[idx] = 0; 237 idx++; 238 } 230 239 231 240 /* Now write all the map'd records in these arrays */ … … 265 274 266 275 /* OK, now execute the SQL statement */ 267 res = PQexecPrepared(conn, stmt, records->nball, (const char * const *)val, val_len, val_isbin, 1 /* We actually don't care here */);276 res = PQexecPrepared(conn, stmt, size, (const char * const *)val, val_len, val_isbin, 1 /* We actually don't care here */); 268 277 269 278 /* Done with the parameters */
Note: See TracChangeset
for help on using the changeset viewer.