public function _sqlite_increment_trigger($pkey) {
        $table = $this->db->quotekey($this->name);
        $pkey = $this->db->quotekey($pkey);
        $triggerName = $this->db->quotekey($this->name.'_insert');
        $queries[] = "DROP TRIGGER IF EXISTS $triggerName;";
        $queries[] = 'CREATE TRIGGER '.$triggerName.' AFTER INSERT ON '.$table.
                     ' WHEN (NEW.'.$pkey.' IS NULL) BEGIN'.
                     ' UPDATE '.$table.' SET '.$pkey.' = ('.
                     ' select coalesce( max( '.$pkey.' ), 0 ) + 1 from '.$table.
                     ') WHERE ROWID = NEW.ROWID;'.
                     ' END;';
        return $queries;
    }
public function _sqlite_increment_trigger($pkey) {
        $table = $this->db->quotekey($this->name);
        $pkey = $this->db->quotekey($pkey);
        $triggerName = $this->db->quotekey($this->name.'_insert');
        $queries[] = "DROP TRIGGER IF EXISTS $triggerName;";
        $queries[] = 'CREATE TRIGGER '.$triggerName.' AFTER INSERT ON '.$table.
                     ' WHEN (NEW.'.$pkey.' IS NULL) BEGIN'.
                     ' UPDATE '.$table.' SET '.$pkey.' = ('.
                     ' select coalesce( max( '.$pkey.' ), 0 ) + 1 from '.$table.
                     ') WHERE ROWID = NEW.ROWID;'.
                     ' END;';
        return $queries;
    }
public function _sqlite_increment_trigger ( $ pkey ) { $ table = $ this -> db -> quotekey ( $ this -> name ) ; $ pkey = $ this -> db -> quotekey ( $ pkey ) ; $ triggerName = $ this -> db -> quotekey ( $ this -> name . '_insert' ) ; $ queries [ ] = "DROP TRIGGER IF EXISTS $triggerName;" ; $ queries [ ] = 'CREATE TRIGGER ' . $ triggerName . ' AFTER INSERT ON ' . $ table . ' WHEN (NEW.' . $ pkey . ' IS NULL) BEGIN' . ' UPDATE ' . $ table . ' SET ' . $ pkey . ' = (' . ' select coalesce( max( ' . $ pkey . ' ), 0 ) + 1 from ' . $ table . ') WHERE ROWID = NEW.ROWID;' . ' END;' ; return $ queries ; }
create an insert trigger to work-a-round auto-incrementation in composite primary keys
@param $pkey
@return array
create an insert trigger to work - a - round auto - incrementation in composite primary keys