xref: /PHP-5.6/ext/sybase_ct/tests/test_long.phpt (revision 43fccbf2)
1--TEST--
2Sybase-CT select LONG_MAX / LONG_MIN
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_db(TEMPDB, $db));
19
20  // Create table and insert some values
21  var_dump(sybase_query('create table test_long (value numeric(20, 0))'));
22  var_dump(sybase_query('insert test_long values ('.(LONG_MAX - 1).')'));
23  var_dump(sybase_query('insert test_long values ('.(LONG_MAX).')'));
24  var_dump(sybase_query('insert test_long values ('.(LONG_MAX + 1).')'));
25  var_dump(sybase_query('insert test_long values ('.(LONG_MIN + 1).')'));
26  var_dump(sybase_query('insert test_long values ('.(LONG_MIN).')'));
27  var_dump(sybase_query('insert test_long values ('.(LONG_MIN - 1).')'));
28
29  // Select values
30  var_dump(sybase_select_ex($db, 'select value from test_long'));
31
32  // Drop table
33  var_dump(sybase_query('drop table test_long'));
34
35  sybase_close($db);
36?>
37--EXPECTF--
38bool(true)
39bool(true)
40bool(true)
41bool(true)
42bool(true)
43bool(true)
44bool(true)
45bool(true)
46>>> Query: select value from test_long
47<<< Return: resource
48array(6) {
49  [0]=>
50  array(1) {
51    ["value"]=>
52    int(%s)
53  }
54  [1]=>
55  array(1) {
56    ["value"]=>
57    int(%s)
58  }
59  [2]=>
60  array(1) {
61    ["value"]=>
62    float(%s)
63  }
64  [3]=>
65  array(1) {
66    ["value"]=>
67    int(-%s)
68  }
69  [4]=>
70  array(1) {
71    ["value"]=>
72    int(-%s)
73  }
74  [5]=>
75  array(1) {
76    ["value"]=>
77    float(-%s)
78  }
79}
80bool(true)
81