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


PHP Connection::query方法代码示例

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


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

示例1: getTables

 /**
  * Returns list of tables.
  */
 public function getTables()
 {
     $tables = array();
     foreach ($this->connection->query('SELECT * FROM cat') as $row) {
         if ($row[1] === 'TABLE' || $row[1] === 'VIEW') {
             $tables[] = array('name' => $row[0], 'view' => $row[1] === 'VIEW');
         }
     }
     return $tables;
 }
开发者ID:riskatlas,项目名称:micka,代码行数:13,代码来源:OciDriver.php

示例2: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     $this->schemas = (require __DIR__ . '/db/schemas.php');
     $this->fixtures = (require __DIR__ . '/db/fixtures.php');
     $this->connection = Manager::getConnection(['driver' => 'pdo_sqlite']);
     foreach ($this->schemas as $table => $definition) {
         $this->connection->query('CREATE TABLE ' . $table . ' (' . join(', ', $definition) . ')');
     }
     foreach ($this->fixtures as $table => $fixtures) {
         foreach ($fixtures as $data) {
             $this->connection->insert($table, $data);
         }
     }
 }
开发者ID:marcojetson,项目名称:freckle,代码行数:17,代码来源:TestCase.php

示例3: load

 public function load(Connection $connection)
 {
     if (!$connection->isConnected) {
         $connection->Connect();
     }
     if (!$connection->query($this->medicationQuery)) {
         return false;
     } else {
         $result = null;
         $medication = null;
         while ($result = $connection->getObject()) {
             $medication = new Medication();
             $medication->setCommonDose($result->commonDose);
             $medication->setGenericName($result->genericName);
             $medication->setRoute($result->route);
             $medication->setUnit($result->unit);
             $medication->setMedicationID($result->medicationId);
             $medication->setActive($result->active);
             $medication->setConfirmed($result->confirmed);
             $medication->setConfirmedBy($result->confirmedBy);
             array_push($this->medicationList, $medication);
         }
     }
     return true;
 }
开发者ID:nathanfl,项目名称:medtele,代码行数:25,代码来源:MAR.php

示例4: testGetAffectedRowsDelete

 public function testGetAffectedRowsDelete()
 {
     $this->createTable();
     $statement = $this->connection->query("INSERT INTO cat (name, colour) VALUES (?, ?)", array('Nennek', 'black'));
     $statement = $this->connection->query("DELETE FROM cat WHERE id = ?", array(1));
     $this->assertEquals(1, $this->connection->getAffectedRows());
 }
开发者ID:renq,项目名称:Simqel,代码行数:7,代码来源:PDOTest.php

示例5: Connection

 function __construct()
 {
     if (!isset($_SESSION['username'])) {
         if (isset($_POST['login'])) {
             $connection = new Connection();
             $this->username = $connection->validate_string($_POST['username']);
             $password = $connection->validate_string($_POST['password']);
             $query = "\n\t\t\t\tSELECT p_password, p_barcode\n\t\t\t\tFROM people\n\t\t\t\tWHERE p_username = '{$this->username}';";
             $connection->query($query);
             if ($connection->result_size() == 1) {
                 $row = $connection->fetch_row();
                 if ($row[0] == $password && $password != "") {
                     $_SESSION['username'] = $this->username;
                     $_SESSION['barcode'] = $row[1];
                     $_SESSION['user'] = true;
                     $_SESSION['admin'] = true;
                 } else {
                     $this->loginError();
                     exit(0);
                 }
             } else {
                 $this->loginError();
                 exit(0);
             }
         } else {
             $this->printLoginScreen();
             exit(0);
         }
     }
     $this->username = $_SESSION['username'];
     $this->barcode = $_SESSION['barcode'];
     $this->user = $_SESSION['user'];
     $this->admin = $_SESSION['admin'];
 }
开发者ID:kitsune,项目名称:ConAsset,代码行数:34,代码来源:User.php

示例6: getUsers

function getUsers()
{
    $db = new Connection(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    $result = $db->query('SELECT name FROM users');
    while ($row = mysql_fetch_assoc($result)) {
        echo $row['name'] . '<br>';
    }
}
开发者ID:BK-Star,项目名称:GuruCoder-Tutorials,代码行数:8,代码来源:functions.php

示例7: save

 public function save()
 {
     $oCon = new Connection();
     if ($this->iPostID == 0) {
         $sSQL = "INSERT INTO tbposts (PostContent, TopicID, MemberID) VALUES (\n            '" . $this->sPostContent . "',\n            '" . $this->iTopicID . "',\n            '" . $this->iMemberID . "')";
         $bResult = $oCon->query($sSQL);
         if ($bResult == true) {
             $this->iPostID = $oCon->getInsertID();
         } else {
             die($sSQL . " did not run");
         }
     } else {
         $sSQL = 'UPDATE tbposts SET Active = ' . $this->iActive . ' WHERE PostID=' . $this->iPostID;
         $bResult = $oCon->query($sSQL);
     }
     $oCon->close();
 }
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:17,代码来源:posts.php

示例8: remove

 public function remove($id_mensaje)
 {
     $db = new Connection();
     $dateLeaving = date("m.d.y");
     $query = "UPDATE MENSAJE SET fecha_baja = {$dateLeaving} where id_mensaje = {$id_mensaje}";
     $results = $db->query($query) or die('Error dando de baja el mensaje: ' . mysqli_error($this->db));
     $db->close();
 }
开发者ID:JonaVillarroel,项目名称:tp-seguridad-calidad,代码行数:8,代码来源:Message.php

示例9: query

 /**
  * @return Result
  */
 private function query($args)
 {
     $res = $this->connection->query($args);
     foreach ($this->setups as $setup) {
         call_user_func_array([$res, array_shift($setup)], $setup);
     }
     return $res;
 }
开发者ID:janlanger,项目名称:dibi,代码行数:11,代码来源:Fluent.php

示例10: exists

 /**
  * @param null $sql
  *
  * @return bool
  */
 public function exists($sql = null)
 {
     if (null == $sql) {
         $sql = $this->prepareExists();
     }
     $result = $this->_connection->query($sql);
     return $result->one() != null;
 }
开发者ID:kendolabdev,项目名称:kendoplatform,代码行数:13,代码来源:SqlSelect.php

示例11: getForeignKeys

 /**
  * Returns metadata for all foreign keys in a table.
  */
 public function getForeignKeys($table)
 {
     /* Not for multi-column foreign keys */
     $keys = array();
     foreach ($this->connection->query("\n\t\t\tSELECT\n\t\t\t\ttc.constraint_name AS name,\n\t\t\t\tkcu.column_name AS local,\n\t\t\t\tccu.table_name AS table,\n\t\t\t\tccu.column_name AS foreign\n\t\t\tFROM\n\t\t\t\tinformation_schema.table_constraints AS tc\n\t\t\t\tJOIN information_schema.key_column_usage AS kcu USING(constraint_catalog, constraint_schema, constraint_name)\n\t\t\t\tJOIN information_schema.constraint_column_usage AS ccu USING(constraint_catalog, constraint_schema, constraint_name)\n\t\t\tWHERE\n\t\t\t\tconstraint_type = 'FOREIGN KEY'\n\t\t\t\tAND\n\t\t\t\ttc.table_name = {$this->connection->quote($table)}\n\t\t\tORDER BY\n\t\t\t\tkcu.ordinal_position\n\t\t") as $row) {
         $keys[] = (array) $row;
     }
     return $keys;
 }
开发者ID:riskatlas,项目名称:micka,代码行数:12,代码来源:PgSqlDriver.php

示例12: load

 public function load($iGenreID)
 {
     $oCon = new Connection();
     $sSQL = "SELECT GenreID, GenreName, DisplayOrder \n\t\t\tFROM tbgenres \n\t\t\tWHERE GenreID = " . $iGenreID;
     $oResultSet = $oCon->query($sSQL);
     $aRow = $oCon->fetchArray($oResultSet);
     $this->iGenreID = $aRow['GenreID'];
     $this->sGenreName = $aRow['GenreName'];
     $this->iDisplayOrder = $aRow['DisplayOrder'];
     $sSQL = "SELECT RecordID\n\t\t\tFROM tbrecords \n\t\t\tWHERE GenreID = " . $iGenreID;
     $oResultSet = $oCon->query($sSQL);
     while ($aRow = $oCon->fetchArray($oResultSet)) {
         $iRecordID = $aRow["RecordID"];
         $oRecord = new Record();
         $oRecord->load($iRecordID);
         $this->aRecords[] = $oRecord;
     }
     $oCon->close();
 }
开发者ID:wasim01,项目名称:theRecordBreakers,代码行数:19,代码来源:genre.php

示例13: query

 /**
  * @param string $table
  * @param mixed $hash
  * @param Context\Query $context
  * @return \Riverline\DynamoDB\Collection
  */
 public function query($table, $hash, Context\Query $context = null)
 {
     $collection = new Collection();
     do {
         try {
             $items = $this->connection->query($table, $hash, $context);
             $collection->merge($items);
             if ($items->more()) {
                 $context = $items->getNextContext();
             } else {
                 // End
                 break;
             }
         } catch (\Riverline\DynamoDB\Exception\ProvisionedThroughputExceededException $e) {
             // Continue
         }
     } while (true);
     return $collection;
 }
开发者ID:16hands,项目名称:riverline-dynamodb,代码行数:25,代码来源:Repeater.php

示例14: save

 public function save()
 {
     $oCon = new Connection();
     if ($this->iCategoryID == 0) {
         $sSQL = 'INSERT INTO tbcategory (CategoryName, CategoryDesc)
         VALUES(
             "' . $this->sCategoryName . '",
             "' . $this->sCategoryDesc . '")';
         $bResult = $oCon->query($sSQL);
         if ($bResult == true) {
             $this->iCategoryID = $oCon->getInsertID();
         } else {
             die($sSQL . " did not run");
         }
     } else {
         $sSQL = 'UPDATE tbcategory SET Active = ' . $this->iActive . ' WHERE CategoryID=' . $this->iCategoryID;
         $bResult = $oCon->query($sSQL);
     }
     $oCon->close();
 }
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:20,代码来源:categories.php

示例15: selectAll

 function selectAll()
 {
     $claseConexion = new Connection();
     $resultado = $claseConexion->query("\n            SELECT Id_horario, Hora_ini, Hora_fin, Dia, Id_materia, Id_aula\n            FROM horario");
     $listaHorario = array();
     while ($row = $resultado->fetch(PDO::FETCH_ASSOC)) {
         $objResultado = $this->rowToDto($row);
         $listaHorario[] = $objResultado;
     }
     return $listaHorario;
 }
开发者ID:jmacboy,项目名称:electiva-programacion-2-2015-nur,代码行数:11,代码来源:HorarioBLL.php


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