Line
Link Here
|
0 |
-- src/dm_db.c |
0 |
++ src/dm_db.c |
Lines 511-526
Link Here
|
511 |
assert(r); |
511 |
assert(r); |
512 |
db_result_next(r); |
512 |
db_result_next(r); |
513 |
|
513 |
|
514 |
// lastRowId is always zero for pgsql tables without OIDs |
514 |
if (db_params.db_driver == DM_DRIVER_POSTGRESQL) |
515 |
// or possibly for sqlite after calling executeQuery but |
515 |
{ |
516 |
// before calling db_result_next |
516 |
id = db_result_get_u64(r, 0); |
517 |
|
517 |
} |
518 |
if ((id = (uint64_t )Connection_lastRowId(c)) == 0) { // mysql |
518 |
else |
519 |
// but if we're using 'RETURNING id' clauses on inserts |
519 |
{ |
520 |
// or we're using the sqlite backend, we can do this |
520 |
// lastRowId is always zero for pgsql tables without OIDs |
521 |
|
521 |
// or possibly for sqlite after calling executeQuery but |
|
|
522 |
// before calling db_result_next |
523 |
|
522 |
if ((id = (uint64_t )Connection_lastRowId(c)) == 0) // sqlite |
524 |
if ((id = (uint64_t )Connection_lastRowId(c)) == 0) // sqlite |
523 |
id = db_result_get_u64(r, 0); // postgresql |
525 |
id = db_result_get_u64(r, 0); // postgresql |
|
|
526 |
id = (uint64_t )Connection_lastRowId(c); |
524 |
} |
527 |
} |
525 |
assert(id); |
528 |
assert(id); |
526 |
return id; |
529 |
return id; |