<?php
/**
* 倒库程序雏形,将space的数据分析后导入到现有数据库中
*
*/
class import_export
{
private $dsn="";
private $user="";
private $password="";
private $pdo="";
public function import_export($dsn,$user,$password)
{
$this->dsn = $dsn;
$this->user = $user;
$this->password = $password;
$this->pdo = new PDO($this->dsn, $this->user, $this->password);
}
public function fetch_result($query)
{
$rs = $this->pdo->query($query);
$result_arr = $rs->fetchAll();
return $result_arr;
}
public function insert($insert_sql)
{
$count = $this->pdo->exec($insert_sql);
if($count)
{
return true;
}else{
return false;
}
}
public function get_pdo_obj()
{
return $this->db;
}
public function lastInsertId()
{
return $this->pdo->lastInsertId();
}
}
?>
<?php
$time_begin = time();
$conf_array = array("db_host"=>"localhost","port"=>"3306","dbname"=>"public","user"=>"root","password"=>"");
$dsn = "mysql:host={$conf_array['db_host']};port={$conf_array['port']};dbname={$conf_array['dbname']}";
$user = $conf_array['user'];
$password = $conf_array['password'];
$pdo = new import_export($dsn,$user,$password);
for($i=1;$i<100000000000;$i++)
{
$time_end = time();
if($time_end - $time_begin >= 60)
{
exit;
}
$insert_sql = "INSERT INTO `information` ( `infoid` , `group` , `productid` , `connection` , `invitetype` , `content` , `addition` ) VALUES (NULL , '1', '2', '2', '1', '的的的的的的的的的的的的的的的的的的', '的的的的的的的的的的的的的的的的的的的的的的的的');"; //插入数据库的sql语句
$import_export2 = $pdo->insert($insert_sql);
$insert_id = $pdo->lastInsertId();
$insert_sql2 = "INSERT INTO `relation` ( `id` , `owneruid` , `otheruid` , `type` , `status` , `infoid` , `ctime` , `uniq_key` ) VALUES (NULL , '1', '2', '1', '11', $insert_id, '2008-10-02 20:30:21', '45646546456456456456456456456456465');"; //插入数据库的sql语句
$import_export2 = $pdo->insert($insert_sql2);
}
?>
<?php
$G_MDB_AUTH['dns'] = "mysql:host=10.210.71.81;dbname=public;port=3501;";
$G_MDB_AUTH['user'] = 'public';
$G_MDB_AUTH['pass'] = 'public123';
$date_time=time();
$pdo = new PDO($G_MDB_AUTH['dns'],$G_MDB_AUTH['user'],$G_MDB_AUTH['pass']);
$info = "当 PHP 解析一个文件时,会寻找开始和结束标记,标记告诉 PHP 开始和停止解释其中的代码。此种方式的解析可以使 PHP 嵌入到各种不同的文档中,凡是在一对开始和结束标记之外的内容都会被 PHP 解析器忽略。大多数情况下 PHP 都是嵌入在 HTML 文档中的,如下例所示当 PHP 解析一个文件时,会寻找开始和结束标记,标记告诉 PHP 开始和停止解释其中的代码。此种方式的解析可以使 PHP 嵌入到各种当 PHP 解析一个文件时,";
$sql = "INSERT INTO `information` (`group` ,`productid` ,`connection` ,`invitetype` ,`content` ,`addition`) VALUES (?,'12341234123412341234123412341234', ?, ?, ?, '')";
$sql2 = "INSERT INTO `relation` (owneruid ,otheruid ,type ,status ,infoid ,ctime,uniq_key) VALUES (1, 2, 1, 1, ?, '2008-12-21', '12341234123412341234123412341234')";
$sj = date('Y-m-d H:i:s');
$para = intval($argv[1])*1000000;
$para = $argv[1];
for($i=0;$i<1000000;$i++){
$date_time2 = time();
if($date_time2-$date_time >= 60)
{
exit;
}
$stmt = $pdo->prepare($sql);
$stmt->bindParam(1, $group);
$stmt->bindParam(2, $connection);
$stmt->bindParam(3, $invitetype);
$stmt->bindParam(4, $content);
$group = 1;
$connection = 2;
$invitetype = 3;
$content = 2;
$stmt->execute();
$stmt2 = $pdo->prepare($sql2);
//echo $pdo->lastInsertId()."\n";
$stmt2->bindParam(1, $pdo->lastInsertId());
$stmt2->execute();
}
$G_MDB_AUTH['dns'] = "mysql:host=10.210.71.81;dbname=public;port=3501;";
$G_MDB_AUTH['user'] = 'public';
$G_MDB_AUTH['pass'] = 'public123';
$date_time=time();
$pdo = new PDO($G_MDB_AUTH['dns'],$G_MDB_AUTH['user'],$G_MDB_AUTH['pass']);
$info = "当 PHP 解析一个文件时,会寻找开始和结束标记,标记告诉 PHP 开始和停止解释其中的代码。此种方式的解析可以使 PHP 嵌入到各种不同的文档中,凡是在一对开始和结束标记之外的内容都会被 PHP 解析器忽略。大多数情况下 PHP 都是嵌入在 HTML 文档中的,如下例所示当 PHP 解析一个文件时,会寻找开始和结束标记,标记告诉 PHP 开始和停止解释其中的代码。此种方式的解析可以使 PHP 嵌入到各种当 PHP 解析一个文件时,";
$sql = "INSERT INTO `information` (`group` ,`productid` ,`connection` ,`invitetype` ,`content` ,`addition`) VALUES (?,'12341234123412341234123412341234', ?, ?, ?, '')";
$sql2 = "INSERT INTO `relation` (owneruid ,otheruid ,type ,status ,infoid ,ctime,uniq_key) VALUES (1, 2, 1, 1, ?, '2008-12-21', '12341234123412341234123412341234')";
$sj = date('Y-m-d H:i:s');
$para = intval($argv[1])*1000000;
$para = $argv[1];
for($i=0;$i<1000000;$i++){
$date_time2 = time();
if($date_time2-$date_time >= 60)
{
exit;
}
$stmt = $pdo->prepare($sql);
$stmt->bindParam(1, $group);
$stmt->bindParam(2, $connection);
$stmt->bindParam(3, $invitetype);
$stmt->bindParam(4, $content);
$group = 1;
$connection = 2;
$invitetype = 3;
$content = 2;
$stmt->execute();
$stmt2 = $pdo->prepare($sql2);
//echo $pdo->lastInsertId()."\n";
$stmt2->bindParam(1, $pdo->lastInsertId());
$stmt2->execute();
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/1319/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2008-10-22 20:42
评论列表