Path: blob/master/src/applications/harbormaster/storage/HarbormasterString.php
12256 views
<?php12final class HarbormasterString3extends HarbormasterDAO {45protected $stringIndex;6protected $stringValue;78protected function getConfiguration() {9return array(10self::CONFIG_TIMESTAMPS => false,11self::CONFIG_COLUMN_SCHEMA => array(12'stringIndex' => 'bytes12',13'stringValue' => 'text',14),15self::CONFIG_KEY_SCHEMA => array(16'key_string' => array(17'columns' => array('stringIndex'),18'unique' => true,19),20),21) + parent::getConfiguration();22}2324public static function newIndex($string) {25$index = PhabricatorHash::digestForIndex($string);2627$table = new self();28$conn = $table->establishConnection('w');2930queryfx(31$conn,32'INSERT IGNORE INTO %R (stringIndex, stringValue) VALUES (%s, %s)',33$table,34$index,35$string);3637return $index;38}3940public static function newIndexMap(array $indexes) {41$table = new self();42$conn = $table->establishConnection('r');4344$rows = queryfx_all(45$conn,46'SELECT stringIndex, stringValue FROM %R WHERE stringIndex IN (%Ls)',47$table,48$indexes);4950return ipull($rows, 'stringValue', 'stringIndex');51}5253}545556