~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to ext/mysql/tests/mysql_fetch_lengths.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
mysql_fetch_lengths()
 
3
--SKIPIF--
 
4
<?php 
 
5
require_once('skipif.inc'); 
 
6
require_once('skipifconnectfailure.inc');
 
7
?>
 
8
--FILE--
 
9
<?php
 
10
include "connect.inc";
 
11
 
 
12
$tmp    = NULL;
 
13
$link   = NULL;
 
14
 
 
15
if (!is_null($tmp = @mysql_fetch_lengths()))
 
16
        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
17
 
 
18
if (NULL !== ($tmp = @mysql_fetch_lengths($link)))
 
19
        printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
20
 
 
21
require('table.inc');
 
22
if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) {
 
23
        printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
 
24
}
 
25
 
 
26
while ($row = mysql_fetch_assoc($res))
 
27
        var_dump(mysql_fetch_lengths($res));
 
28
var_dump(mysql_fetch_lengths($res));
 
29
 
 
30
mysql_free_result($res);
 
31
 
 
32
var_dump(mysql_fetch_lengths($res));
 
33
 
 
34
mysql_close($link);
 
35
print "done!";
 
36
?>
 
37
--EXPECTF--
 
38
array(2) {
 
39
  [0]=>
 
40
  int(1)
 
41
  [1]=>
 
42
  int(1)
 
43
}
 
44
bool(false)
 
45
 
 
46
Warning: mysql_fetch_lengths(): %d is not a valid MySQL result resource in %s on line %d
 
47
bool(false)
 
48
done!