Mysql data generation in skymvc website test jumps to [1] [full screen preview]
$ V) {unset ($ _ SESSION [$ k]) ;}$ this-> onIncrement ();} public function getNum ($ table) {// set the number of records required by the table $ cf = array ("article" => 500000, "test" => 300000, "test2" => 300000 ,); if (! Isset ($ cf [$ table]) {return 300000;} else {return $ cf [$ table] ;}} public function onAutoDelete () {set_time_limit (0 ); ob_implicit_flush (true); $ res = M ("article")-> query ("show tables"); $ data = M ("article")-> fetch_array (PDO :: FETCH_NUM); $ this-> loadClass ("spider"); if ($ data) {$ uk = 0; foreach ($ data as $ k => $ t) {$ tables [] = $ t [0]; $ urls [$ uk] [] = "http ://". $ _ SERVER ['http _ host']. "/index. php? M = test_mysql & a = delete & table = ". str_replace (TABLE_PRE, "", $ t [0]); if ($ k % $ this-> maxThreads ==( $ this-> maxThreads-1 )) {$ uk ++ ;}} echo "start of deletion
"; Echo'0
Script var I = 0; var it = setInterval (function () {I ++; document. querySelector ("# aid "). innerHTML = "executed" + I + "seconds";}, 1000); script '; foreach ($ urls as $ k => $ us) {echo "th ". $ k. "section
"; Flush (); @ ob_flush (); $ this-> spider-> start ($ us, function ($ data) {echo $ data ['URL']."
". $ Data ['content']."
"; Flush (); @ ob_flush () ;}, 600) ;}} echo" end of this deletion
"; Flush (); @ ob_flush (); echo" script setTimeout (function () {window. location. reload () ;}, 1000); script ";}public function onDelete () {$ table = get ('table', 'H'); M ($ table) -> query ("delete from ". table ($ table ). "where 1 = 1 limit 50000"); echo "delete $ table success";}/* update auto-increment id */public function onIncrement () {$ res = M ("article")-> query ("show tables"); $ data = M ("article")-> fetch_array (PDO: FETCH_NUM ); if ($ data) {foreach ($ Data as $ k => $ t) {$ table = str_replace (TABLE_PRE, "", $ t [0]); M ($ table) -> query ("alter table 'sky _". $ table. "'auto_increment = 1;") ;}} echo "update increment";} public function onAutoInsert () {set_time_limit (0); ob_implicit_flush (true ); $ res = M ("article")-> query ("show tables"); $ data = M ("article")-> fetch_array (PDO: FETCH_NUM ); $ tables = array (); if ($ data) {$ uk = 0; foreach ($ data as $ k => $ t) {$ tables [] = $ t [0]; $ urls [$ uk] [] = "h Ttp: // ". $ _ SERVER ['http _ host']."/index. php? M = test_mysql & a = insert & table = ". str_replace (TABLE_PRE, "", $ t [0]); if ($ k % $ this-> maxThreads ==( $ this-> maxThreads-1 )) {$ uk ++ ;}$ this-> loadClass ("spider"); echo "starts
"; Echo'0
Script var I = 0; var it = setInterval (function () {I ++; document. querySelector ("# aid "). innerHTML = "executed" + I + "seconds";}, 1000); script '; foreach ($ urls as $ k => $ us) {echo "th ". $ k. "section
"; Flush (); @ ob_flush (); $ this-> spider-> start ($ us, function ($ data) {echo $ data ['URL']."
". $ Data ['content']."
"; Flush (); @ ob_flush () ;}, 600) ;}echo" ended
"; Flush (); @ ob_flush ();} echo" script setTimeout (function () {window. location. reload () ;}, 1000); script ";}public function onInsert ($ table ='') {$ inauto = true; if (! $ Table) {set_time_limit (0); $ inauto = false;} $ table = $ table? $ Table: get ('table', 'H'); if (! $ Table) {$ table = "article";} $ fields = $ this-> getFIelds ($ table ); // why do I only execute the command to 266 buckets? $ jnum = $ this-> getNum ($ table); for ($ j = 0; $ j <$ this-> maxrow; $ j ++) {$ rscount = M ($ table)-> selectOne (array ("fields" => "count (1 )")); if ($ rscount> $ jnum) {echo $ table. "The test data is sufficient.
"; Break;} if (! Inauto) {echo "inserting number". $ j. "thousands
"; Flush (); @ ob_flush (); ob_clean () ;}$ data = array (); for ($ I = 0; $ I <1000; $ I ++) {$ data [] = $ this-> dbPost ($ table);} $ SQL = "insert ". table ($ table ). "(". implode (",", $ fields ). ") values"; foreach ($ data as $ k = >$ v) {if ($ k> 0) {$ SQL. = "," ;}$ SQL. = "(". _ implode ($ v ). ")";} $ SQL. = ";"; M ($ table)-> query ($ SQL); unset ($ data); unset ($ SQL);} echo "success ";} public function getFIelds ($ table) {$ fields = M ($ table)-> getFields (); foreach ($ fi Elds as $ k =>$ v) {if ($ k = 0) continue; $ data [] = $ v ['field'];} return $ data ;} public function dbPost ($ table, $ msg = '') {if (isset ($ _ SESSION [" field _". $ table]) {$ fields = $ _ SESSION ["field _". $ table];} else {$ fields = M ($ table)-> getFields (); $ _ SESSION ["field _". $ table] = $ fields;} $ msg = $ msg? $ Msg: "skymvc is". date ("Ymdhis"). "the most intimate". date ("Ymdhis"). "php development framework. come and use it! "; $ Data = array (); $ gid = $ this-> getId ($ table); foreach ($ fields as $ k => $ v) {if ($ k = 0) continue; if (preg_match ("/tinyint/I", $ v ['type']) {$ data [$ v ['field'] = rand ();} elseif (preg_match ("/int/I", $ v ['type']) {if ($ v ['field'] = 'Dateline ') {$ data [$ v ['field'] = time ();} else {$ data [$ v ['field'] = $ gid;} elseif (preg_match ("/decimal/I", $ v ['type']) {$ data [$ v ['field'] = rand ();} elseif (preg_match ("/datetime/I", $ v ['Ty Pe ']) {$ data [$ v ['field'] = date ("Y-m-d H: I: s ");} elseif ($ v ['field'] = 'bstatus') {$ data [$ v ['field'] = 1 ;} else {$ data [$ v ['field'] = $ msg;} return $ data;} public function getId ($ table) {if (! Isset ($ _ SESSION ["autoid _ $ table"]) {$ _ SESSION ["autoid _ $ table"] = 1 ;} else {$ _ SESSION ["autoid _ $ table"] ++;} return $ _ SESSION ["autoid _ $ table"] ;}}?>