当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseConnection::select方法代码示例

本文整理汇总了PHP中DatabaseConnection::select方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::select方法的具体用法?PHP DatabaseConnection::select怎么用?PHP DatabaseConnection::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseConnection的用法示例。


在下文中一共展示了DatabaseConnection::select方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: find

 /**
  * {@inheritdoc}
  */
 public function find($string, $prefix = true, $limit = 20)
 {
     if ($prefix) {
         $escaped = db_like($string) . '%';
     } else {
         $escaped = '%' . db_like($string) . '%';
     }
     $map = $this->db->select('node', 'n')->fields('n', ['nid', 'title'])->condition('n.type', $this->bundle)->condition('n.title', $escaped, 'LIKE')->orderBy('n.title')->range(0, $limit)->execute()->fetchAllKeyed();
     $ret = [];
     foreach ($map as $id => $title) {
         $ret[] = new EntityFinderResult('node', $id, $title, $this->getLabel());
     }
     return $ret;
 }
开发者ID:makinacorpus,项目名称:drupal-ulink,代码行数:17,代码来源:NodeFinder.php

示例2: loadWithConditions

 /**
  * {@inheritdoc}
  */
 public function loadWithConditions($conditions)
 {
     $q = $this->db->select('umenu', 'um')->fields('um');
     foreach ($conditions as $key => $value) {
         $q->condition('um.' . $key, $value);
     }
     $r = $q->execute();
     $r->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, Menu::class);
     $ret = [];
     while ($menu = $r->fetch()) {
         $ret[$menu->getName()] = $menu;
     }
     return $ret;
 }
开发者ID:makinacorpus,项目名称:drupal-umenu,代码行数:17,代码来源:DrupalMenuStorage.php

示例3: getStudentIds

function getStudentIds()
{
    $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school");
    $sql = "SELECT id FROM students";
    $string = array();
    $res = $db->select($sql, $string, false, '');
    return $res;
}
开发者ID:PumpkinSeed,项目名称:beadando,代码行数:8,代码来源:test_data_marks.php

示例4: addNewStudent

function addNewStudent($login_code, $name, $birth, $pass, $email, $pn, $city, $subj)
{
    $sql = "INSERT INTO teachers VALUES ('', ?, ?, ?, ?, ?, ?, ?)";
    $string = array($login_code, $name, $birth, $pass, $email, $pn, $city);
    $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school");
    $db->queryWithoutResult($sql, $string, true, "sssssss");
    $sql = 'SELECT id FROM teachers WHERE code = ?';
    $string = array($login_code);
    $res = $db->select($sql, $string, true, 's');
    $sql = "INSERT INTO teacher_subj VALUES (?,?)";
    $string = array($res[0]['id'], $subj);
    $db->queryWithoutResult($sql, $string, true, "is");
    return true;
}
开发者ID:PumpkinSeed,项目名称:beadando,代码行数:14,代码来源:test_data_teachers.php

示例5: addNewStudent

function addNewStudent($login_code, $name, $birth, $resi, $pass, $email, $ppn, $year, $class, $s_hostel, $allowance)
{
    $sql = "INSERT INTO students VALUES ('', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    $string = array($login_code, $name, $birth, $resi, $s_hostel, $allowance, $pass, $email, $ppn, $year, strtolower($class));
    $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school");
    $db->queryWithoutResult($sql, $string, true, "ssssiisssis");
    $sql = 'SELECT id FROM students WHERE login_code = ?';
    $string = array($login_code);
    $res = $db->select($sql, $string, true, 's');
    $zero = mt_rand(0, 18);
    $sql = "INSERT INTO misses VALUES (?,?)";
    $string = array($res[0]['id'], $zero);
    $db->queryWithoutResult($sql, $string, true, "ii");
    return true;
}
开发者ID:PumpkinSeed,项目名称:beadando,代码行数:15,代码来源:test_data_students.php

示例6: getSubjectIds

 public static function getSubjectIds()
 {
     $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school");
     $sql = "SELECT id FROM subjects";
     $string = array();
     return $db->select($sql, $string, false, '');
 }
开发者ID:PumpkinSeed,项目名称:beadando,代码行数:7,代码来源:abstractions.php

示例7: getMisses

 public function getMisses()
 {
     $id = $this->getId();
     $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school");
     $sql = "SELECT number FROM misses WHERE id = ?";
     $string = array($id);
     $res = $db->select($sql, $string, true, 'i');
     return $res[0]['number'];
 }
开发者ID:PumpkinSeed,项目名称:beadando,代码行数:9,代码来源:model.php

示例8: pathHasMatchingAlias

 /**
  * {@inheritdoc}
  */
 public function pathHasMatchingAlias($initial_substring)
 {
     $query = $this->db->select('url_alias', 'u');
     $query->addExpression(1);
     return (bool) $query->condition('u.source', $this->db->escapeLike($initial_substring) . '%', 'LIKE')->range(0, 1)->execute()->fetchField();
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:9,代码来源:DefaultAliasStorage.php

示例9: getSubject

 public function getSubject($id)
 {
     $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school");
     $sql = "SELECT name FROM subjects WHERE id = ?";
     $string = array($id);
     $res = $db->select($sql, $string, true, 'i');
     return $res[0]['name'];
 }
开发者ID:PumpkinSeed,项目名称:beadando,代码行数:8,代码来源:model.php

示例10: select

 public function select($table, $alias = NULL, array $options = array())
 {
     return $this->connection->select($table, $alias, $options);
 }
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:4,代码来源:Connection.php

示例11: select

 /**
  * @see DatabaseConnection::select
  */
 public function select($columns = '*', $where = '', $whereArgs = array(), $orderBy = null, $limit = null)
 {
     return $this->dbc->select($this->tblname, $columns, $where, $whereArgs, $orderBy, $limit);
 }
开发者ID:tniessen,项目名称:tinyIt,代码行数:7,代码来源:TableAdapter.php


注:本文中的DatabaseConnection::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。