Ignore:
Timestamp:
Aug 4, 2009 4:22:41 AM (4 years ago)
Author:
alec
Message:
  • Use sequence names only with PostgreSQL (#1486018)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_mdb2.php

    r2828 r2834  
    322322   * For Postgres databases, a sequence name is required 
    323323   * 
    324    * @param  string  Sequence name for increment 
     324   * @param  string  Table name (to find the incremented sequence) 
    325325   * @return mixed   ID or FALSE on failure 
    326326   * @access public 
    327327   */ 
    328   function insert_id($sequence = '') 
     328  function insert_id($table = '') 
    329329    { 
    330330    if (!$this->db_handle || $this->db_mode=='r') 
    331331      return FALSE; 
    332332 
    333     $id = $this->db_handle->lastInsertID($sequence); 
     333    // find sequence name 
     334    if ($table && $this->db_provider == 'pgsql') 
     335      $table = get_sequence_name($table); 
     336 
     337    $id = $this->db_handle->lastInsertID($table); 
    334338     
    335339    return $this->db_handle->isError($id) ? null : $id; 
Note: See TracChangeset for help on using the changeset viewer.