Ticket #767 (closed Bug: fixed)

Opened 3 months ago

Last modified 5 weeks ago

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

Changed 6 weeks ago by Shadowhand

  • priority changed from minor to major
  • milestone changed from 2.3 to 2.2.1

Changed 5 weeks ago by Shadowhand

  • owner changed from zombor to Shadowhand
  • status changed from new to assigned

Changed 5 weeks ago by Shadowhand

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in r3618, and merged in r3619.

Note: See TracTickets for help on using tickets.