Browse files

Merge pull request #99 from datamapper/postgres-bignum-insert-id

Postgres bignum insert
  • Loading branch information...
2 parents 58d0258 + 85eb33b commit 16564e6dba587e92e41aba376b46ef765f3bffea @tpitale tpitale committed May 24, 2016
Showing with 3 additions and 3 deletions.
  1. +3 −3 do_postgres/ext/do_postgres/do_postgres.c
View
6 do_postgres/ext/do_postgres/do_postgres.c
@@ -543,14 +543,14 @@ VALUE do_postgres_cCommand_execute_non_query(int argc, VALUE *argv, VALUE self)
insert_id = Qnil;
}
else {
- insert_id = INT2NUM(atoi(PQgetvalue(response, 0, 0)));
+ insert_id = rb_cstr_to_inum(PQgetvalue(response, 0, 0), 10, 0);
}
- affected_rows = INT2NUM(atoi(PQcmdTuples(response)));
+ affected_rows = rb_cstr_to_inum(PQcmdTuples(response), 10, 0);
}
else if (status == PGRES_COMMAND_OK) {
insert_id = Qnil;
- affected_rows = INT2NUM(atoi(PQcmdTuples(response)));
+ affected_rows = rb_cstr_to_inum(PQcmdTuples(response), 10, 0);
}
else {
do_postgres_raise_error(self, response, query);

0 comments on commit 16564e6

Please sign in to comment.