Ticket #767 (closed Bug: fixed)
Pgsql_result -> insert_id() Always returns false
| Reported by: | alexflofig | Owned by: | Shadowhand |
|---|---|---|---|
| Priority: | major | Milestone: | 2.2.1 |
| Component: | Libraries:Database | Version: | SVN HEAD |
| Keywords: | insert_id,pgsql | Cc: |
Description
In the constructor of class: Pgsql_Result This expression returns "insert " with a whitespace at the end.
preg_match('/^(?:delete|insert|replace|update)\s+/i', trim($sql), $matches)
So when this line is executed:
$this->insert_id = (strtolower($matches[0]) == 'insert') ? $this->get_insert_id($link) : FALSE;
It always return false, to fix the issue, we only need to add the trim function:
$this->insert_id = (trim(strtolower($matches[0])) == 'insert') ? $this->get_insert_id($link) : FALSE;
Thanks.
Change History
Note: See
TracTickets for help on using
tickets.
