xref: /PHP-5.5/ext/sybase_ct/tests/test_types.phpt (revision a14c6644)
1--TEST--
2Sybase-CT select and types
3--SKIPIF--
4<?php require('skipif.inc'); ?>
5--FILE--
6<?php
7/* This file is part of PHP test framework for ext/sybase_ct
8 *
9 * $Id$
10 */
11
12  require('test.inc');
13
14  define('LONG_MAX', is_int(2147483648) ? 9223372036854775807 : 2147483647);
15  define('LONG_MIN', -LONG_MAX - 1);
16
17  $db= sybase_connect_ex();
18  var_dump(sybase_select_ex($db, 'select
19    1 as "integer",
20    '.(LONG_MIN).' as "integer_min",
21    '.(LONG_MIN - 1).' as "integer_min_exceed",
22    '.(LONG_MAX).' as "integer_max",
23    '.(LONG_MAX + 1).' as "integer_max_exceed",
24    1.0  as "float",
25    12345678901234567890123456789012.123456 as "large_float",
26    $22.36 as "money",
27    "Binford" as "string",
28    convert(datetime, "2004-01-23") as "date",
29    NULL as "null",
30    convert(bit, 1) as "bit",
31    convert(smalldatetime, "2004-01-23") as "smalldate",
32    convert(char(10), "char") as "char10"
33  '));
34
35  sybase_close($db);
36?>
37--EXPECTF--
38>>> Query: select
39    1 as "integer",
40    -%s as "integer_min",
41    -%s as "integer_min_exceed",
42    %s as "integer_max",
43    %s as "integer_max_exceed",
44    1.0  as "float",
45    12345678901234567890123456789012.123456 as "large_float",
46    $22.36 as "money",
47    "Binford" as "string",
48    convert(datetime, "2004-01-23") as "date",
49    NULL as "null",
50    convert(bit, 1) as "bit",
51    convert(smalldatetime, "2004-01-23") as "smalldate",
52    convert(char(10), "char") as "char10"
53
54<<< Return: resource
55array(1) {
56  [0]=>
57  array(%d) {
58    ["integer"]=>
59    int(1)
60    ["integer_min"]=>
61    int(-%s)
62    ["integer_min_exceed"]=>
63    float(-%s)
64    ["integer_max"]=>
65    int(%s)
66    ["integer_max_exceed"]=>
67    float(%s)
68    ["float"]=>
69    float(1)
70    ["large_float"]=>
71    string(39) "12345678901234567890123456789012.123456"
72    ["money"]=>
73    float(22.36)
74    ["string"]=>
75    string(7) "Binford"
76    ["date"]=>
77    string(19) "Jan 23 2004 12:00AM"
78    ["null"]=>
79    NULL
80    ["bit"]=>
81    int(1)
82    ["smalldate"]=>
83    string(19) "Jan 23 2004 12:00AM"
84    ["char10"]=>
85    string(10) "char      "
86  }
87}
88