Ticket #696: SC_Query.test.php

File SC_Query.test.php, 1.4 KB (added by miningbrownie, 11 years ago)

速度検証用 インストール済みEC-CUBEのdata/classに入れて CLIで使う

Line 
1<?php
2require_once('../../htdocs/require.php');
3$objQuery = new SC_Query("mysql:host=localhost;dbname=hakosuke,hakosuke,hakosuke");
4echo "\n==================================================================================== old method";
5run(true,$objQuery);
6echo "\n==================================================================================== new method";
7run(false,$objQuery);
8
9function run($old = false,$objQuery){
10  $objQuery->query("TRUNCATE TABLE dtb_order");
11  $starttime = microtime(true);
12  echo "\n";
13  flush();
14  ob_flush();
15  $currenttime = $starttime;
16  for($i = 0;$i < 99999;$i++){
17    $nextkey = $objQuery->get_auto_increment("dtb_order",$old);
18    $data = array(
19      "order_id" => $nextkey,
20      "create_date" => date("Y-m-d H:i:s"),
21      "customer_id" => "0",
22      "order_temp_id" => "dfghjkjhgfghjdsfadsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
23      );
24      $objQuery->insert("dtb_order",$data);
25      $lasttime = $currenttime;
26      $currenttime = microtime(true);
27      $diff = $currenttime - $lasttime;
28      echo $i.",".$diff."\n";
29      flush();
30      ob_flush();
31  }
32  echo date("Y-m-d H:i:s");
33}
34