久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='NgIjz'><style id='NgIjz'><dir id='NgIjz'><q id='NgIjz'></q></dir></style></legend>
    <bdo id='NgIjz'></bdo><ul id='NgIjz'></ul>

<small id='NgIjz'></small><noframes id='NgIjz'>

  • <tfoot id='NgIjz'></tfoot>
    <i id='NgIjz'><tr id='NgIjz'><dt id='NgIjz'><q id='NgIjz'><span id='NgIjz'><b id='NgIjz'><form id='NgIjz'><ins id='NgIjz'></ins><ul id='NgIjz'></ul><sub id='NgIjz'></sub></form><legend id='NgIjz'></legend><bdo id='NgIjz'><pre id='NgIjz'><center id='NgIjz'></center></pre></bdo></b><th id='NgIjz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NgIjz'><tfoot id='NgIjz'></tfoot><dl id='NgIjz'><fieldset id='NgIjz'></fieldset></dl></div>

      1. PDO 和 MySQL 全文搜索

        PDO and MySQL Fulltext searches(PDO 和 MySQL 全文搜索)

          <tfoot id='8C4eI'></tfoot>
              <i id='8C4eI'><tr id='8C4eI'><dt id='8C4eI'><q id='8C4eI'><span id='8C4eI'><b id='8C4eI'><form id='8C4eI'><ins id='8C4eI'></ins><ul id='8C4eI'></ul><sub id='8C4eI'></sub></form><legend id='8C4eI'></legend><bdo id='8C4eI'><pre id='8C4eI'><center id='8C4eI'></center></pre></bdo></b><th id='8C4eI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8C4eI'><tfoot id='8C4eI'></tfoot><dl id='8C4eI'><fieldset id='8C4eI'></fieldset></dl></div>
                <bdo id='8C4eI'></bdo><ul id='8C4eI'></ul>

                  <tbody id='8C4eI'></tbody>
                • <small id='8C4eI'></small><noframes id='8C4eI'>

                • <legend id='8C4eI'><style id='8C4eI'><dir id='8C4eI'><q id='8C4eI'></q></dir></style></legend>
                  本文介紹了PDO 和 MySQL 全文搜索的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在將我所有的站點(diǎn)代碼從使用 mysql_* 函數(shù)轉(zhuǎn)換為 PDO.PDO 上的 PHP 文檔不符合我的需要.提供了使用的功能,但在不同場景下不詳細(xì)說明.

                  I'm converting all my sites code from using mysql_* functions to PDO. The PHP documentation on PDO is not clear for my needs. It gives you the functions to use, but does not go into detail to explain them in different scenarios.

                  基本上,我有一個mysql全文搜索:

                  Basically, I have a mysql fulltext search:

                  $sql = "SELECT ... FROM search_table WHERE MATCH(some_field) AGAINST ('{$searchFor}*' IN BOOLEAN MODE)";
                  

                  實際的語句要長得多,但這就是它的基本作用.

                  The actual statements much longer, but this is what it basically does.

                  我的問題是,我如何將其合并到 PDO 中?

                  My question is, how would I incorporate this into PDO?

                  我知道您不打算在位置標(biāo)記周圍使用引號,所以您是否將它們留在 AGAINST() 函數(shù)中?我包括他們嗎?如果我將它們排除在外,通配符等會怎樣?

                  I know you're not meant to use quotes around the place-marker, so do you leave them out in the AGAINST() function? Do I include them? If I leave them out, what happens to the wildcard symbol etc?

                  $sql = $this->db->prepare("SELECT ... FROM search_table WHERE MATCH(some_field) AGAINST(:searchText IN BOOLEAN MODE");
                  $sql->bindValue(':searchText', $searchFor . '*');
                  

                  推薦答案

                  不幸的是,這是使用查詢參數(shù)的一個奇怪的例外(但顯然不是在最近的點(diǎn)發(fā)布每個 MySQL 分支,見下文).

                  This is unfortunately a weird exception to the use of query parameters (edit: but apparently not in the most recent point-release of each MySQL branch, see below).

                  AGAINST() 中的模式必須 是一個常量字符串,而不是一個查詢參數(shù).與 SQL 查詢中的其他常量字符串不同,這里不能使用查詢參數(shù),僅僅是因為 MySQL 中的限制.

                  The pattern in AGAINST() must be a constant string, not a query parameter. Unlike other constant strings in SQL queries, you cannot use a query parameter here, simply because of a limitation in MySQL.

                  要將搜索模式安全地插入到查詢中,請使用 PDO::quote()功能.請注意,PDO 的 quote() 函數(shù)已經(jīng)添加了引號分隔符(與 mysql_real_escape_string() 不同).

                  To interpolate search patterns into queries safely, use the PDO::quote() function. Note that PDO's quote() function already adds the quote delimiters (unlike mysql_real_escape_string()).

                  $quoted_search_text = $this->db->quote('+word +word');
                  
                  $sql = $this->db->prepare("SELECT ... FROM search_table 
                      WHERE MATCH(some_field) AGAINST($quoted_search_text IN BOOLEAN MODE");
                  

                  <小時>

                  來自@YourCommonSense 的重新評論:


                  Re comment from @YourCommonSense:

                  你說得對,我剛剛在 MySQL 5.5.31、5.1.68 和 5.0.96 上測試了這個(MySQL Sandbox 是一個很棒的工具),似乎這些版本確實接受了 AGAINST() 中的查詢參數(shù)動態(tài) SQL 查詢的子句.

                  You're right, I just tested this on MySQL 5.5.31, 5.1.68, and 5.0.96 (MySQL Sandbox is a wonderful tool), and it seems that these versions do accept query parameters in the AGAINST() clause of a dynamic SQL query.

                  我仍然記得過去存在的沖突.也許它已在每個分支的最新版本中得到糾正.例如,我發(fā)現(xiàn)這些相關(guān)的錯誤:

                  I still have a recollection of a conflict existing in the past. Maybe it has been corrected in the most recent point-release of each branch. For example, I find these related bugs:

                  • 在 AGAINST() 子句中使用存儲過程參數(shù)總是返回相同的結(jié)果:http://bugs.mysql.com/bug.php?id=3734
                  • 準(zhǔn)備好的語句、MATCH 和 FULLTEXT 導(dǎo)致崩潰或奇怪的結(jié)果:http://bugs.mysql.com/bug.php?id=14496

                  這篇關(guān)于PDO 和 MySQL 全文搜索的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務(wù)器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數(shù))
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)

                      <tbody id='42KtE'></tbody>
                    • <bdo id='42KtE'></bdo><ul id='42KtE'></ul>

                            <small id='42KtE'></small><noframes id='42KtE'>

                            <i id='42KtE'><tr id='42KtE'><dt id='42KtE'><q id='42KtE'><span id='42KtE'><b id='42KtE'><form id='42KtE'><ins id='42KtE'></ins><ul id='42KtE'></ul><sub id='42KtE'></sub></form><legend id='42KtE'></legend><bdo id='42KtE'><pre id='42KtE'><center id='42KtE'></center></pre></bdo></b><th id='42KtE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='42KtE'><tfoot id='42KtE'></tfoot><dl id='42KtE'><fieldset id='42KtE'></fieldset></dl></div>
                          1. <tfoot id='42KtE'></tfoot>

                            <legend id='42KtE'><style id='42KtE'><dir id='42KtE'><q id='42KtE'></q></dir></style></legend>
                          2. 主站蜘蛛池模板: 欧州一区二区三区 | 国产欧美日韩在线 | 亚洲精品在线免费观看视频 | 欧美国产一区二区 | 拍戏被cao翻了h承欢 | 伊人狠狠 | 久久国| 91精品国产91久久久久久密臀 | 国产精品久久久久久久久久软件 | 久久久精品视频免费 | 毛片a级毛片免费播放100 | 欧美日韩综合 | 欧美视频| 精品一区二区三区四区五区 | 爱高潮www亚洲精品 中文字幕免费视频 | 四季久久免费一区二区三区四区 | 亚洲精品电影在线观看 | 91免费在线看 | 国产精品色综合 | 夜夜爽99久久国产综合精品女不卡 | 国产精品无码久久久久 | 国产精品福利在线 | 亚洲国产精品视频一区 | 成人妇女免费播放久久久 | 亚洲精品免费在线观看 | 国产精品久久久久久久免费观看 | 国产欧美日韩一区二区三区在线 | 国产精品国产精品国产专区不片 | 亚洲高清在线观看 | 97精品国产| 四虎伊人 | 一区二区伦理电影 | 久久久久久久久淑女av国产精品 | 亚洲精品日韩欧美 | 日本中出视频 | www.xxxx欧美| 精品久久伊人 | 999久久久 | 日韩aⅴ在线观看 | 一区二区三区久久 | 成人免费视频网站 |