Esempio n. 1
0
 public function loadPage()
 {
     $answer = new PonderAnswer();
     $conn_r = $answer->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT a.* FROM %T a %Q %Q %Q', $answer->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     return $answer->loadAllFromArray($data);
 }
Esempio n. 2
0
 public function execute()
 {
     $answer = new PonderAnswer();
     $conn_r = $answer->establishConnection('r');
     $select = qsprintf($conn_r, 'SELECT r.* FROM %T r', $answer->getTableName());
     $where = $this->buildWhereClause($conn_r);
     $order_by = $this->buildOrderByClause($conn_r);
     $limit = $this->buildLimitClause($conn_r);
     return $answer->loadAllFromArray(queryfx_all($conn_r, '%Q %Q %Q %Q', $select, $where, $order_by, $limit));
 }
<?php

$table = new PonderAnswer();
$conn_w = $table->establishConnection('w');
$iterator = new LiskMigrationIterator($table);
foreach ($iterator as $answer) {
    $id = $answer->getID();
    echo pht('Adding mail key for Answer %d...', $id);
    echo "\n";
    queryfx($conn_w, 'UPDATE %T SET mailKey = %s WHERE id = %d', $table->getTableName(), Filesystem::readRandomCharacters(20), $id);
}
 private function buildJoinsClause(AphrontDatabaseConnection $conn_r)
 {
     $joins = array();
     if ($this->answererPHIDs) {
         $answer_table = new PonderAnswer();
         $joins[] = qsprintf($conn_r, 'JOIN %T a ON a.questionID = q.id AND a.authorPHID IN (%Ls)', $answer_table->getTableName(), $this->answererPHIDs);
     }
     return implode(' ', $joins);
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->answererPHIDs) {
         $answer_table = new PonderAnswer();
         $joins[] = qsprintf($conn, 'JOIN %T a ON a.questionID = q.id AND a.authorPHID IN (%Ls)', $answer_table->getTableName(), $this->answererPHIDs);
     }
     return $joins;
 }