本文整理匯總了PHP中sql::flush方法的典型用法代碼示例。如果您正苦於以下問題:PHP sql::flush方法的具體用法?PHP sql::flush怎麽用?PHP sql::flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sql
的用法示例。
在下文中一共展示了sql::flush方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: insertOrder
function insertOrder()
{
$sql = new sql();
$sql->debugsql = 0;
$sql->setTable("rex_4_order");
$sql->setValue("overallsum", $this->_overallsum);
$sql->setValue("status", $this->_status);
$sql->setValue("date", date("Y-m-d H:i:s"));
$sql->setValue("name", $this->_name);
$sql->setValue("mailtext", $this->_mailtxt);
$sql->insert();
if ($sql->error == "") {
$order_id = $sql->last_insert_id;
$sql->flush();
$counter = 0;
if (is_array($this->_product)) {
for ($i = 0; $i < count($this->_product['pid']); $i++) {
$sql->setTable("rex_4_order_product");
$sql->setValue("order_id", $order_id);
$sql->setValue("product_id", $this->_product['pid'][$i]);
$sql->setValue("product_name", $this->_product['name'][$i]);
$sql->setValue("amount", $this->_product['amount'][$i]);
$sql->setValue("price", $this->_product['price'][$i]);
$sql->insert();
$sql->flush();
if ($sql->error == "") {
$counter++;
}
}
}
if ($counter == count($this->_product['pid'])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例2: sql
// ----> update eines Artikels
$sql->where("id='" . $aid . "' AND clang='{$clang}'");
$sql->update();
if (strlen($sql->error) > 3) {
echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("error"), $message_corpus);
} else {
echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("product_saved"), $message_corpus);
if ($uebernehmen) {
$send = 0;
$function = "edit_article";
} else {
$send = 1;
$function = "";
}
}
$sql->flush();
$sql->setTable("rex_4_article");
$sql->setValue("category", $diecats);
$sql->where("id=" . $aid . " and clang=" . $clang);
$sql->update();
} else {
//----> Neuer Artikel wird angelegt
$sql2 = new sql();
$sql2->setQuery("SELECT MAX(id) as theid from rex_4_article");
$theid = $sql2->getValue("theid");
if ($theid == "") {
$theid = 0;
}
$theid++;
$aid = $theid;
foreach ($REX[CLANG] as $key => $language) {
示例3: REX_SEARCH
function REX_SEARCH($searchtxt, $surroundchars = 20, $categories = "", $surround_tag_start = "<b>", $surround_tag_end = "</b>")
{
###### CHECK WHICH PATHES SHOULD BE SEARCHED
if (!is_array($categories)) {
$ADD_AREA .= "AND rex_article.path like '%-%'";
} else {
$ADD_AREA = "AND (";
foreach ($categories as $var) {
$ADD_AREA .= " rex_article.path like '%-{$var}%' OR ";
}
$ADD_AREA = substr($ADD_AREA, 0, -3) . ")";
}
##### TRIM SEARCHTXT
$searchtxt = trim($searchtxt, " ");
##### CHECK IF SEARCH STRING IS LONG ENOUGH
if (strlen($searchtxt) < 40 and strlen($searchtxt) > 2) {
##### EXPLODE SEARCH STRING
$words = explode(" ", $searchtxt);
$words_count = 0;
if (count($words) > 3) {
$words_count = 3;
$RETURN[msg] = "Es wurden nur die ersten 3 Begriffe benutzt";
} else {
$words_count = count($words);
}
##### START SQL CLASS
$SUCHE = new sql();
#### SEARCH FOR ALL KEYWORDS
for ($i = 0; $i < $words_count; $i++) {
$SUCHE->flush();
$KEYWORD = current($words);
#### SQL QUERY
$sql = "\r\n\t SELECT\r\n\r\n\t rex_article.id,rex_article.name,rex_article.beschreibung,\r\n\r\n\t\t\trex_article_slice.value1,rex_article_slice.value2,rex_article_slice.value3,\r\n\t\t\trex_article_slice.value4,rex_article_slice.value5,rex_article_slice.value6,\r\n\t\t\trex_article_slice.value7,rex_article_slice.value8,rex_article_slice.value9,\r\n\r\n\t (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.name,' ',',')) * 10) +\r\n\t (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.beschreibung,' ',',')) * 5) +\r\n\t (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.suchbegriffe,' ',',')) * 5) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value1,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value2,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value3,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value4,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value5,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value6,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value7,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value8,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value9,' ',','))\r\n\t AS COUNTWORD\r\n\r\n\t FROM rex_article_slice\r\n\r\n\t LEFT JOIN rex_article ON rex_article.id=rex_article_slice.article_id\r\n\r\n\t WHERE\r\n\r\n\t (\r\n\t rex_article.name LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article.beschreibung LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article.suchbegriffe LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value1 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value2 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value3 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value4 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value5 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value6 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value7 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value8 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value9 LIKE ('%{$KEYWORD}%')\r\n\t )\r\n\r\n\t AND status = 1\r\n\r\n\t\t\t{$ADD_AREA}\r\n\r\n\t GROUP BY id\r\n\r\n\t ORDER BY COUNTWORD DESC\r\n\r\n\t LIMIT 0,50\r\n\r\n\t ";
$SUCHE->setQuery($sql);
$count_limit = 0;
###### GO THROUGH RESULTS
for ($j = 0; $j < $SUCHE->getRows(); $j++) {
$ART[$SUCHE->getValue("rex_article.id")][ID] = $SUCHE->getValue("rex_article.id");
$ART[$SUCHE->getValue("rex_article.id")][NAME] = $SUCHE->getValue("rex_article.name");
$ART[$SUCHE->getValue("rex_article.id")][DESC] = $SUCHE->getValue("rex_article.beschreibung");
$ART[$SUCHE->getValue("rex_article.id")][COUNTWORD] = $SUCHE->getValue("COUNTWORD");
$ART[$SUCHE->getValue("rex_article.id")][URL] = $SUCHE->getValue("rex_article.id") . "-" . ModRewriteName($SUCHE->getValue("rex_article.name"));
###### CHECK OCURRENCE OF KEYWORD
for ($val = 1; $val < 10; $val++) {
$regex = "/\\b.{0," . $surroundchars . "}" . $KEYWORD . ".{0," . $surroundchars . "}\\b/im";
preg_match_all($regex, strip_tags($SUCHE->getValue("rex_article_slice.value" . $val)), $matches);
if ($matches[0][0] != '') {
$ART_REGEX[$SUCHE->getValue("rex_article.id")] .= "... " . implode($matches[0], " ... ");
}
}
$SUCHE->next();
}
$SEARCH_WORDS[] = $KEYWORD;
next($words);
}
if (is_array($ART_REGEX)) {
$replace_string = implode("|", $SEARCH_WORDS);
foreach ($ART_REGEX as $key => $var) {
$ART[$key][DESC_REGEX] = preg_replace("/(" . $replace_string . ")/im", $surround_tag_start . "\\1" . $surround_tag_end, $var) . " ...";
}
}
}
return $ART;
}
示例4: elseif
}
}
}
} elseif ($dbanlegen == 4) {
// ----- community0.5 anlegen
$REX[version] = "2.7";
// ----- db anlegen
$file_temp = "include/install/community0.5_redaxo2.7.sql";
$h = fopen($file_temp, "r");
$conts = fread($h, filesize($file_temp));
$all = explode("\n", $conts);
$add = new sql();
// $add->debugsql = 1;
foreach ($all as $hier) {
$add->setquery(Trim(str_replace("||||||+N+||||||", "\n", $hier), ";"));
$add->flush();
}
// ----- dateien anlegen
$file_temp = $REX[INCLUDE_PATH] . "/install/community0.5_redaxo2.7.tar.gz";
$tar = new tar();
$tar->openTAR($file_temp);
if (!$tar->extractTar()) {
$err_msg = $I18N->msg("problem_when_extracting") . "<br>";
if (count($tar->message) > 0) {
$err_msg .= $I18N->msg("create_dirs_manually") . "<br>";
reset($tar->message);
for ($fol = 0; $fol < count($tar->message); $fol++) {
$err_msg .= key($tar->message) . "<br>";
next($tar->message);
}
}
示例5: rex_a1_import_db
/**
* Importiert den SQL Dump $filename in die Datenbank
*
* @param string Pfad + Dateinamen zur SQL-Datei
*
* @return array Gibt ein Assoc. Array zurück.
* 'state' => boolean (Status ob fehler aufgetreten sind)
* 'message' => Evtl. Status/Fehlermeldung
*/
function rex_a1_import_db($filename, $replace_rex = false)
{
global $REX, $I18N_IM_EXPORT;
$return = array();
$return['state'] = false;
$return['message'] = '';
$msg = '';
$error = '';
if ($filename == '') {
$return['message'] = $I18N_IM_EXPORT->msg('no_import_file_chosen_or_wrong_version') . '<br>';
return $return;
}
$h = fopen($filename, "r");
$conts = fread($h, filesize($filename));
fclose($h);
// Versionsstempel prüfen
// ## Redaxo Database Dump Version x.x
$rex_version = strpos($conts, "## Redaxo Database Dump Version " . $REX['VERSION']);
if ($rex_version === FALSE) {
$return['message'] = $I18N_IM_EXPORT->msg("no_valid_import_file") . ". [## Redaxo Database Dump Version " . $REX['VERSION'] . "] is missing";
return $return;
} else {
// Versionsstempel entfernen
$conts = trim(str_replace("## Redaxo Database Dump Version " . $REX['VERSION'], "", $conts));
}
// Prefix prüfen
// ## Prefix rex_
$rex_prefix = strpos($conts, "## Prefix " . $REX['TABLE_PREFIX']);
if ($replace_rex) {
$conts = trim(str_replace("## Prefix rex_", "", $conts));
$conts = str_replace("TABLE rex_", "TABLE " . $REX['TABLE_PREFIX'], $conts);
$conts = str_replace("INTO rex_", "INTO " . $REX['TABLE_PREFIX'], $conts);
$conts = str_replace("EXISTS rex_", "EXISTS " . $REX['TABLE_PREFIX'], $conts);
} elseif ($rex_prefix === FALSE) {
$return['message'] = $I18N_IM_EXPORT->msg("no_valid_import_file") . ". [## Prefix " . $REX['TABLE_PREFIX'] . "] does not match config in master.inc.php";
return $return;
} else {
// Prefix entfernen
$conts = trim(str_replace("## Prefix " . $REX['TABLE_PREFIX'], "", $conts));
}
// Ordner /generated komplett leeren
rex_deleteDir($REX['INCLUDE_PATH'] . '/generated/articles');
rex_deleteDir($REX['INCLUDE_PATH'] . '/generated/files');
rex_deleteDir($REX['INCLUDE_PATH'] . '/generated/templates');
// Datei aufteilen
$lines = explode("\n", $conts);
$add = new sql();
// $add->debugsql = 1;
foreach ($lines as $line) {
$line = trim($line, "\r");
// Windows spezifische extras
$line = trim($line, ";");
// mysql 3.x
$add->setquery($line);
$add->flush();
}
$msg .= $I18N_IM_EXPORT->msg("database_imported") . ". " . $I18N_IM_EXPORT->msg("entry_count", count($lines)) . "<br>";
// CLANG Array aktualisieren
unset($REX['CLANG']);
$db = new sql();
$db->setQuery("select * from " . $REX['TABLE_PREFIX'] . "clang");
for ($i = 0; $i < $db->getRows(); $i++) {
$id = $db->getValue("id");
$name = $db->getValue("name");
$REX['CLANG'][$id] = $name;
$db->next();
}
// prüfen, ob eine user tabelle angelegt wurde
$result = $db->get_array('SHOW TABLES');
$user_table_found = false;
foreach ($result as $row) {
if (in_array($REX['TABLE_PREFIX'] . 'user', $row)) {
$user_table_found = true;
break;
}
}
if (!$user_table_found) {
$create_user_table = '
CREATE TABLE ' . $REX['TABLE_PREFIX'] . 'user
(
user_id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
description text NOT NULL,
login varchar(50) NOT NULL,
psw varchar(50) NOT NULL,
status varchar(5) NOT NULL,
rights text NOT NULL,
login_tries tinyint(4) NOT NULL DEFAULT 0,
createuser varchar(255) NOT NULL,
updateuser varchar(255) NOT NULL,
createdate int(11) NOT NULL DEFAULT 0,
//.........這裏部分代碼省略.........