Translation::__GeneratePhraseId PHP Method

__GeneratePhraseId() private method

Create a unique identifier for a phrase.
private __GeneratePhraseId ( )
    private function __GeneratePhraseId()
    {
        global $g_ado_db;
        $queryStr = 'UPDATE AutoId SET translation_phrase_id=LAST_INSERT_ID(translation_phrase_id + 1)';
        $g_ado_db->executeUpdate($queryStr);
        if ($g_ado_db->affected_rows() <= 0) {
            return 0;
        }
        return (int) $g_ado_db->insert_id();
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Create a translation of a phrase.  If the phrase ID is set in the
  * constructor, we assume that the phrase already exists and we are
  * just creating a translation, and not a new phrase.
  *
  * @param string $p_text
  * 		Optional. The translation text.
  * @return boolean
  */
 public function create($p_text = null)
 {
     if (!isset($this->m_data['phrase_id'])) {
         $this->m_data['phrase_id'] = Translation::__GeneratePhraseId();
     }
     return parent::create(array("translation_text" => $p_text));
 }