Update to upstream version 4.94
[Packages/TYPO3.CMS.git] / typo3 / sysext / adodb / adodb / tests / testpaging.php
1 <?php
2 /*
3 V4.80 8 Mar 2006 (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
4 Released under both BSD license and Lesser GPL library license.
5 Whenever there is any discrepancy between the two licenses,
6 the BSD license will take precedence.
7 Set tabs to 4 for best viewing.
8
9 Latest version is available at http://adodb.sourceforge.net
10 */
11
12 error_reporting(E_ALL);
13
14
15 include_once('../adodb.inc.php');
16 include_once('../adodb-pager.inc.php');
17
18 $driver = 'oci8';
19 $sql = 'select ID, firstname as "First Name", lastname as "Last Name" from adoxyz order by id';
20 //$sql = 'select count(*),firstname from adoxyz group by firstname order by 2 ';
21 //$sql = 'select distinct firstname, lastname from adoxyz order by firstname';
22
23 if ($driver == 'postgres') {
24 $db = NewADOConnection('postgres');
25 $db->PConnect('localhost','tester','test','test');
26 }
27
28 if ($driver == 'access') {
29 $db = NewADOConnection('access');
30 $db->PConnect("nwind", "", "", "");
31 }
32
33 if ($driver == 'ibase') {
34 $db = NewADOConnection('ibase');
35 $db->PConnect("localhost:e:\\firebird\\examples\\employee.gdb", "sysdba", "masterkey", "");
36 $sql = 'select distinct firstname, lastname from adoxyz order by firstname';
37
38 }
39 if ($driver == 'mssql') {
40 $db = NewADOConnection('mssql');
41 $db->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind');
42 }
43 if ($driver == 'oci8') {
44 $db = NewADOConnection('oci8');
45 $db->Connect('','scott','natsoft');
46
47 $sql = "select * from (select ID, firstname as \"First Name\", lastname as \"Last Name\" from adoxyz
48 order by 1)";
49 }
50
51 if ($driver == 'access') {
52 $db = NewADOConnection('access');
53 $db->Connect('nwind');
54 }
55
56 if (empty($driver) or $driver == 'mysql') {
57 $db = NewADOConnection('mysql');
58 $db->Connect('localhost','root','','test');
59 }
60
61 //$db->pageExecuteCountRows = false;
62
63 $db->debug = true;
64
65 if (0) {
66 $rs = &$db->Execute($sql);
67 include_once('../toexport.inc.php');
68 print "<pre>";
69 print rs2csv($rs); # return a string
70
71 print '<hr />';
72 $rs->MoveFirst(); # note, some databases do not support MoveFirst
73 print rs2tab($rs); # return a string
74
75 print '<hr />';
76 $rs->MoveFirst();
77 rs2tabout($rs); # send to stdout directly
78 print "</pre>";
79 }
80
81 $pager = new ADODB_Pager($db,$sql);
82 $pager->showPageLinks = true;
83 $pager->linksPerPage = 10;
84 $pager->cache = 60;
85 $pager->Render($rows=7);
86 ?>