我们正在使用具有多个数据库概念的单一来源。我正在尝试将db(.sql文件)还原到客户端数据库,除触发器和存储过程外,所有表都恢复正常。
public function import_database(){
$data = $this->input->post();
if(!empty($data))
{
$config_app = array(
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => $data['cmp_db_name'],
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE
);
$this->db =$this->load->database($config_app,TRUE); // open client database connection
$filename=$_FILES["database"]["tmp_name"];
$templine = '';
$lines = file($filename);
foreach ($lines as $line)
{
if (substr($line, 0, 2) == '--' || $line == '')
continue;
$templine .= $line;
if (substr(trim($line), -1) == ';')
{
$this->db->query($templine);
$templine = '';
}
}
}
}
我遇到以下错误:
错误编号:1064您的SQL语法错误;检查与您的MariaDB服务器版本相对应的手册以获取正确的语法以在'DELIMITER $$ CREATE DEFINER = root @ localhost PROCEDURE audt_pro(IN coumn_n')附近使用DELIMITER $$ CREATE DEFINER = root @ localhost` PRODED audt_pro(IN coumn_nm TEXT,IN Deleted_id TEXT,IN tbl_nm VARCHAR(50))开始声明qry文本;