[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 // Base class for dico business persistence abstraction. 20 // 21 22 if (defined("_BD_INDEX_DICO_MYSQL")) 23 return; 24 25 define("_BD_INDEX_DICO_MYSQL", "1"); 26 27 require_once dirname(__FILE__). "/../index_dico.php"; 28 29 /** 30 * BD_index_dico_mysql is an implementation for MySQL of BD_index_dico business class. 31 * @package BD_mysql 32 * @author Erwan Le Bescond <elebescond@clever-age.com> 33 * @access public 34 */ 35 class BD_index_dico_mysql extends BD_index_dico { 36 37 // {{{ addDico() 38 39 /** 40 * This method is used to add a character string required from the database ignoring the Key value of the table 41 * @access public 42 */ 43 44 function addDico ($mots = array()) { 45 $db = &$this->_getDB(); 46 47 if (DB::isError($db)) { 48 return PEAR::raiseError("[" . get_class($this). " DB_index_dico : addDico()] " . $db->getMessage(). "", 49 null, 50 null, 51 null, 52 null, 53 null, 54 false); 55 } 56 57 while (list(, $monMot) = each($mots)) { 58 $query 59 = "INSERT IGNORE INTO " . $GLOBALS['table_prefix']. "_index_dico (" . INDEX_DICO_ALL_FIELDS . ") VALUES " . "('" . $db->quoteString( 60 $monMot['hash']). "', " . "'" . $monMot['dico']. "')"; 61 62 $result = $db->query($query); 63 if (DB::isError($result)) { 64 return PEAR::raiseError( 65 "[" . get_class($this). " DB_index_dico : addDico()] " . $result->getMessage(). "", null, 66 null, null, 67 null, null, 68 false); 69 } 70 } 71 } 72 73 // }}} 74 75 // {{{ composeResearchInIndex($dico) 76 77 /** 78 * This method is used to compose a research in the dictionary 79 * @access public 80 * @param String $dico the character string required to load 81 */ 82 83 function composeResearchInIndex ($dico) { 84 $hashIds = array(); 85 86 $db = &$this->_getDB(); 87 88 if (DB::isError($db)) { 89 return $db; 90 } 91 92 $query = "SELECT hash AS hx FROM " . $GLOBALS['table_prefix']. "_index_dico WHERE " . join(" OR ", $dico); 93 94 //echo "<br>$query<br>"; 95 96 $result = $db->query($query); 97 98 if (DB::isError($result)) { 99 return $result; 100 } 101 102 while ($row = $result->fetchRow()) { 103 $hashIds[] = "'" . $row['hx']. "'"; 104 } 105 106 $result->free(); 107 108 return $hashIds; 109 } 110 111 // }}} 112 113 } 114 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |