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


PHP PDO::Quote方法代码示例

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


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

示例1: array

 // ---------------
 // Add table index
 // ---------------
 $Output->Append("<table>\n");
 $Output->Append("<tr><th><strong>Table</strong></th><th><strong>Description</strong></th><th><strong>Doc Status</strong></th></tr>\n");
 $tables = $db->Query("SHOW TABLE STATUS")->fetchAll();
 $tables_simplified = array();
 foreach ($tables as $table) {
     $tables_simplified[] = $table["Name"];
     $Output->Append("<tr>");
     if (isset($table_doc[$schema][$table["Name"]])) {
         $Output->Append("<td>@subpage {$MakeRef($schema, $table["Name"])} \"{$table["Name"]}\" </td><td>{$table_doc[$schema][$table["Name"]]["brief"]}</td>");
     } else {
         $Output->Append("<td>@subpage {$MakeRef($schema, $table["Name"])} \"{$table["Name"]}\" </td><td></td>");
     }
     $cols_in_table = $db->Query("SELECT COLUMN_NAME FROM `information_schema`.`columns` WHERE `TABLE_SCHEMA` = '{$schema}' AND `TABLE_NAME` = {$db->Quote($table["Name"])}")->fetchAll(PDO::FETCH_NUM);
     $documented_cols = $db->Query("SELECT `column` FROM `documentation`.`column` WHERE `schema` = '{$schema}' AND `table` = {$db->Quote($table["Name"])}")->fetchAll(PDO::FETCH_NUM);
     $real_documented_cols = 0;
     $cols_in_table_simplified = array();
     foreach ($cols_in_table as $col) {
         $cols_in_table_simplified[] = $col[0];
     }
     foreach ($documented_cols as $col) {
         if (!in_array($col[0], $cols_in_table_simplified)) {
             print "WARNING: Column {$col[0]} is documented for table {$table["Name"]} but doesn't exist!\n";
         } else {
             ++$real_documented_cols;
         }
     }
     $pct = $real_documented_cols / count($cols_in_table) * 100;
     //if (ceil($pct) >= 100 && $real_documented_cols < count($cols_in_table))
开发者ID:lyrl,项目名称:OregonCore,代码行数:31,代码来源:generator.php

示例2: unlink

     unlink($filename);
     die("{$prog}: internal error: no tables for bin: {$bin} (check case is correct)\n");
 }
 if ($export == "all") {
     $cmd = "{$bin_mysqldump} --skip-add-drop-table --default-character-set=utf8mb4 -u{$dbuser} -h {$hostname} {$database} {$string} >> {$filename}";
 } else {
     $cmd = "{$bin_mysqldump} --skip-add-drop-table --no-data --default-character-set=utf8mb4 -u{$dbuser} -h {$hostname} {$database} {$string} >> {$filename}";
 }
 system($cmd);
 /* Now append the dump with TCAT table information */
 $fh = fopen($filename, "a");
 fputs($fh, "\n");
 fputs($fh, "--\n");
 fputs($fh, "-- DMI-TCAT - Update TCAT tables\n");
 fputs($fh, "--\n");
 $sql = "INSERT INTO tcat_query_bins ( querybin, `type`, active, access ) values ( " . $dbh->Quote($bin) . ", " . $dbh->Quote($bintype) . ", 0, 0 );";
 fputs($fh, $sql . "\n");
 if ($bintype == 'track') {
     // Notice: We do not export information from the tcat_captured_phrases table here. Because we allow adding of phrasing and querybins to an existing tcat installation,
     //         the phrase IDs will change and it would not be safe to simply copy the data (phrase id <-> phrase text would no longer match)
     foreach ($phrases as $phrase) {
         $sql = "INSERT INTO tcat_query_phrases ( phrase ) values ( " . $dbh->Quote($phrase) . " );";
         fputs($fh, $sql . "\n");
     }
     foreach ($phrases as $phrase) {
         $starttime = $phrase_starttime[$phrase];
         $endtime = $phrase_endtime[$phrase];
         $sql = "INSERT INTO tcat_query_bins_phrases SET " . " starttime = '{$starttime}', " . " endtime = '{$endtime}', " . " phrase_id = ( select MIN(id) from tcat_query_phrases where phrase = " . $dbh->Quote($phrase) . " ), " . " querybin_id = ( select MAX(id) from tcat_query_bins );";
         fputs($fh, $sql . "\n");
     }
     // we could have just now inserted duplicate phrases in the database, the next two queries resolve that problem
开发者ID:pwikstrom,项目名称:dmi-tcat,代码行数:31,代码来源:export.php

示例3: die

        die("Empty bin name would dump the complete database. Exiting!\n");
    }
    $cmd = "{$bin_mysqldump} --default-character-set=utf8mb4 -u{$dbuser} -h {$hostname} {$database} {$string} > {$filename}";
    system($cmd);
} else {
    touch($filename);
}
/* Now append the dump with TCAT table information */
$fh = fopen($filename, "a");
fputs($fh, "\n");
fputs($fh, "--\n");
fputs($fh, "-- DMI-TCAT - Update TCAT tables\n");
fputs($fh, "--\n");
/* Lock TCAT tables */
fputs($fh, "LOCK TABLES `tcat_query_bins` WRITE, `tcat_query_phrases` WRITE, `tcat_query_bins_periods` WRITE, `tcat_query_users` WRITE, `tcat_query_bins_phrases` WRITE, `tcat_query_bins_users` WRITE;\n");
$sql = "INSERT INTO tcat_query_bins ( querybin, `type`, active, visible ) values ( " . $dbh->Quote($bin) . ", " . $dbh->Quote($bintype) . ", 0, 1 );";
fputs($fh, $sql . "\n");
if ($bintype == 'track') {
    $sql = "CREATE TEMPORARY TABLE temp_phrase_ids ( phrase_id bigint primary key, phrase varchar(512) );";
    fputs($fh, $sql . "\n");
    foreach ($phrases as $phrase) {
        $sql = "INSERT INTO tcat_query_phrases ( phrase ) values ( " . $dbh->Quote($phrase) . " );";
        fputs($fh, $sql . "\n");
        $sql = "INSERT INTO temp_phrase_ids ( phrase_id, phrase ) values ( LAST_INSERT_ID(), " . $dbh->Quote($phrase) . " );";
        fputs($fh, $sql . "\n");
    }
    foreach ($phrases as $phrase) {
        $starttime = $phrase_starttime[$phrase];
        $endtime = $phrase_endtime[$phrase];
        $sql = "INSERT INTO tcat_query_bins_phrases SET " . " starttime = '{$starttime}', " . " endtime = '{$endtime}', " . " phrase_id = ( select phrase_id from temp_phrase_ids where phrase = " . $dbh->Quote($phrase) . " ), " . " querybin_id = ( select MAX(id) from tcat_query_bins );";
        fputs($fh, $sql . "\n");
开发者ID:petethegreek,项目名称:dmi-tcat,代码行数:31,代码来源:export.php

示例4: escape

 /**
  * @param string $input
  * @return string
  */
 public function escape($input)
 {
     if (is_null($this->db)) {
         $this->connect_db();
     }
     return $this->db->Quote($input);
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:11,代码来源:database.class.php


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