annotate DataTables-1.9.4/media/unit_testing/performance/large.php @ 7:0f2b740536fb draft

Uploaded
author saskia-hiltemann
date Mon, 21 Aug 2017 09:16:07 -0400
parents ac5f9272033b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 <?php
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 /* MySQL connection */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); /* ;-) */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 die( 'Could not open connection to server' );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 die( 'Could not select database '. $gaSql['db'] );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 <html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico" />
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 <title>DataTables example</title>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 <style type="text/css" title="currentStyle">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 @import "../../css/demo_page.css";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 @import "../../css/demo_table.css";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 </style>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 <script type="text/javascript" language="javascript" src="../../js/jquery.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 <script type="text/javascript" language="javascript" src="../../js/jquery.dataTables.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 <script type="text/javascript" charset="utf-8">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 $(document).ready(function() {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 var oTable = $('#example').dataTable();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 var iStart = new Date().getTime();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 //if ( typeof console != 'undefined' ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 // console.profile();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 //}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 for ( var i=0 ; i<10 ; i++ )
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 var oTable = $('#example').dataTable({"bDestroy": true});
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 //if ( typeof console != 'undefined' ) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 // console.profileEnd();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 //}
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 //oTable.fnSort( [[ 1, 'asc' ]] );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 //oTable.fnSort( [[ 1, 'asc' ]] );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 //oTable.fnSort( [[ 2, 'asc' ]] );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 //oTable.fnSort( [[ 1, 'asc' ]] );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 //oTable.fnSort( [[ 2, 'asc' ]] );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 var iEnd = new Date().getTime();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 document.getElementById('output').innerHTML = "Test took "+(iEnd-iStart)+" mS";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 <body id="dt_example">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 <div id="container">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 <div class="full_width big">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 <i>DataTables</i> performance test - draw
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 <div id="output"></div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 <div id="demo">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 <thead>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 <tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 <th>id</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 <th>name</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 <th>phone</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 <th>email</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 <th>city</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 <th>zip</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 <th>state</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 <th>country</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 <th>zip2</th>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 </tr>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 </thead>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 <tbody>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 <?php
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 $sQuery = "
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 SELECT *
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 FROM testData
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 LIMIT 2000
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 ";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 $rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 while ( $aRow = mysql_fetch_array( $rResult ) )
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 echo '<tr>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 echo '<td><a href="1">'.$aRow['id'].'</a></td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 echo '<td>'.$aRow['name'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 echo '<td>'.$aRow['phone'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 echo '<td>'.$aRow['email'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 echo '<td>'.$aRow['city'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 echo '<td>'.$aRow['zip'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 echo '<td>'.$aRow['state'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 echo '<td>'.$aRow['country'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 echo '<td>'.$aRow['zip2'].'</td>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 echo '</tr>';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 ?>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 </tbody>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 </table>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 <div class="spacer"></div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 <div id="footer" style="text-align:center;">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 <span style="font-size:10px;">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 DataTables &copy; Allan Jardine 2008-2009.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 </span>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 </html>