當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sql::getError方法代碼示例

本文整理匯總了PHP中sql::getError方法的典型用法代碼示例。如果您正苦於以下問題:PHP sql::getError方法的具體用法?PHP sql::getError怎麽用?PHP sql::getError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sql的用法示例。


在下文中一共展示了sql::getError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _rex_installDump

function _rex_installDump($file, $debug = false)
{
    $sql = new sql();
    $sql->debugsql = $debug;
    $error = '';
    foreach (readSqlDump($file) as $query) {
        $sql->setQuery($query);
        if (($sqlerr = $sql->getError()) != '') {
            $error .= $sqlerr . "\n<br/>";
        }
    }
    return $error;
}
開發者ID:BackupTheBerlios,項目名稱:gbforredaxo,代碼行數:13,代碼來源:function_rex_installation.inc.php

示例2: sql

 /**
  * @access protected
  * @return Returns <code>true</code> on success or <code>false</code> on error
  */
 function _delete()
 {
     global $REX;
     $qry = 'DELETE FROM ' . $this->_getTableName() . ' WHERE file_id = ' . $this->getId() . ' LIMIT 1';
     $sql = new sql();
     //        $sql->debugsql = true;
     $sql->query($qry);
     ### todo - loeschen des files
     unlink($REX['INCLUDE_PATH'] . "/../../files/" . $this->getFileName());
     return $sql->getError();
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:15,代碼來源:class.oomedia.inc.php

示例3: foreach

 /**
  * @access protected
  * @return Returns <code>true</code> on success or <code>false</code> on error
  */
 function _delete($recurse = false)
 {
     // Rekursiv löschen?
     if ($recurse) {
         if ($this->hasChildren()) {
             $childs = $this->getChildren();
             foreach ($childs as $child) {
                 $child->_delete($recurse);
             }
         }
     }
     // Alle Dateien löschen
     if ($this->hasFiles()) {
         $files = $this->getFiles();
         foreach ($files as $file) {
             $file->_delete();
         }
     }
     $qry = 'DELETE FROM ' . $this->_getTableName() . ' WHERE id = ' . $this->getId() . ' LIMIT 1';
     $sql = new sql();
     //        $sql->debugsql = true;
     //        echo $qry;
     //        return;
     $sql->query($qry);
     return $sql->getError();
 }
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:30,代碼來源:class.oomediacategory.inc.php

示例4: rex_a1_import_db


//.........這裏部分代碼省略.........
    $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,
       updatedate int(11) NOT NULL DEFAULT 0,
       lasttrydate int(11) NOT NULL DEFAULT 0,
       session_id varchar(255) NOT NULL,
       PRIMARY KEY(user_id)
     ) TYPE=MyISAM;';
        $db->setQuery($create_user_table);
        $error = $db->getError();
        if ($error != '') {
            // evtl vorhergehende meldungen löschen, damit nur der fehler angezeigt wird
            $msg = '';
            $msg .= $error;
        }
    }
    // generated neu erstellen, wenn kein Fehler aufgetreten ist
    if ($error == '') {
        $msg .= rex_generateAll();
        $return['state'] = true;
    }
    $return['message'] = $msg;
    return $return;
}
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:101,代碼來源:function_import_export.inc.php


注:本文中的sql::getError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。