Lines Matching defs:db

26     protected $db;
36 $this->db = new SQLiteDB('aichat', DOKU_PLUGIN . 'aichat/db/');
37 $this->db->getPdo()->sqliteCreateFunction('COSIM', $this->sqliteCosineSimilarityCallback(...), 2);
48 $record = $this->db->queryRecord('SELECT * FROM embeddings WHERE id = ?', [$chunkID]);
66 $this->db->exec('DELETE FROM embeddings');
68 $this->db->exec('DELETE FROM clusters');
81 $this->db->exec('DELETE FROM embeddings WHERE page = ?', [$page]);
88 $this->db->saveRecord('embeddings', [
107 $this->db->exec('VACUUM');
120 $result = $this->db->queryAll(
147 $result = $this->db->queryAll(
175 $items = $this->db->queryValue('SELECT COUNT(*) FROM embeddings');
176 $size = $this->db->queryValue(
183 $clusters = $this->db->queryKeyValueList($query);
188 'db size' => filesize_h($size),
234 $result = $this->db->queryAll('SELECT DISTINCT lang FROM embeddings');
253 $where = 'WHERE lang = ' . $this->db->getPdo()->quote($lang);
259 $this->db->getPdo()->beginTransaction();
263 $this->db->exec($query);
265 $this->db->exec($query);
269 $result = $this->db->queryAll($query, [self::SAMPLE_SIZE]);
280 $total = $this->db->queryValue($query);
306 $this->db->exec($query, [$lang, json_encode($centroid, JSON_THROW_ON_ERROR)]);
309 $this->db->getPdo()->commit();
312 $this->db->getPdo()->rollBack();
326 $handle = $this->db->query($query);
332 $this->db->exec($query, [$cluster, $record['id']]);
350 $where = 'WHERE lang = ' . $this->db->getPdo()->quote($lang);
361 $result = $this->db->queryRecord($query, [json_encode($vector, JSON_THROW_ON_ERROR)]);
373 return $this->db->queryValue($query) > 0;
386 $handle = $this->db->query($query);