Example #1
0
 public function init($catalogue_name)
 {
     $q = new Query();
     $catalogue = $q->sql("SELECT * FROM {catalogues} WHERE name = ?", $catalogue_name)->fetch();
     if (!$catalogue) {
         $q->sql("INSERT INTO {catalogues} (name) VALUES (?)", $catalogue_name)->execute();
         $this->catalogue_id = $q->insertId();
     } else {
         $this->catalogue_id = $catalogue['id'];
     }
     #Get keys to prevent them to be erased
     $keys = $q->sql("SELECT msgid FROM {messages}\n                     WHERE catalogue_id=? AND msgstr != ''", $this->catalogue_id)->fetchCol();
     #Hashmap for perfs
     if (is_array($keys)) {
         foreach ($keys as $key) {
             $this->filled_keys[$key] = $key;
         }
     }
 }