Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / sybase_ct / tests / bug29064.phpt
blobdf13d28a1d8c78392994daa2bd13ebbdaa98cf3c
1 --TEST--
2 Sybase-CT bug #29064 (Exact numeric/decimal/money datatypes lose precision)
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  */
12   require('test.inc');
14   $db= sybase_connect_ex();
15   
16   // Create a temporary table and fill it with test values
17   var_dump(sybase_query('
18     create table #test (
19       test_decimal      decimal(38, 6)  null,
20       test_numeric      numeric(38, 12) null,
21       test_money        money           null,
22       test_bigint       decimal(38, 0)  null,
23       test_int          int             null,
24       test_smallmoney   smallmoney      null,
25       test_smallint     smallint        null,
26       test_tinyint      tinyint         null,
27       test_real         float           null,
28       test_double       float           null
29     )
30   ', $db));
31   var_dump(sybase_query('
32     insert into #test (
33       test_decimal, 
34       test_numeric, 
35       test_money, 
36       test_bigint, 
37       test_int,
38       test_smallmoney, 
39       test_smallint, 
40       test_tinyint, 
41       test_real, 
42       test_double
43     ) values (
44       12345678901234567890123456789012.123456,
45       12345678901234567890123456.123456789012,
46       123456789012345.1234,
47       12345678901234567890123456789012345678,
48       1234567890,
49       123456.1234,
50       12345,
51       123,
52       123456789.12345679,
53       123456789.12345679
54     )
55   ', $db));
56   var_dump(sybase_query('
57     insert into #test (
58       test_decimal, 
59       test_numeric, 
60       test_money, 
61       test_bigint, 
62       test_int,
63       test_smallmoney, 
64       test_smallint, 
65       test_tinyint, 
66       test_real, 
67       test_double
68     ) values (
69       -12345678901234567890123456789012.123456,
70       -12345678901234567890123456.123456789012,
71       -123456789012345.1234,
72       -12345678901234567890123456789012345678,
73       -1234567890,
74       -123456.1234,
75       -12345,
76       255,
77       -123456789.12345679,
78       -123456789.12345679
79     )
80   ', $db));
82   // Select the data  
83   var_dump(sybase_select_ex($db, 'select * from #test'));
84   
85   // Clean up and close connection
86   var_dump(sybase_query('drop table #test', $db));
87   sybase_close($db);
89 --EXPECTF--
90 bool(true)
91 bool(true)
92 bool(true)
93 >>> Query: select * from #test
94 <<< Return: resource
95 array(2) {
96   [0]=>
97   array(10) {
98     ["test_decimal"]=>
99     string(39) "12345678901234567890123456789012.123456"
100     ["test_numeric"]=>
101     string(39) "12345678901234567890123456.123456789012"
102     ["test_money"]=>
103     string(18) "123456789012345.12"
104     ["test_bigint"]=>
105     string(38) "12345678901234567890123456789012345678"
106     ["test_int"]=>
107     int(1234567890)
108     ["test_smallmoney"]=>
109     float(123456.12)
110     ["test_smallint"]=>
111     int(12345)
112     ["test_tinyint"]=>
113     int(123)
114     ["test_real"]=>
115     string(18) "123456789.12345679"
116     ["test_double"]=>
117     string(18) "123456789.12345679"
118   }
119   [1]=>
120   array(10) {
121     ["test_decimal"]=>
122     string(40) "-12345678901234567890123456789012.123456"
123     ["test_numeric"]=>
124     string(40) "-12345678901234567890123456.123456789012"
125     ["test_money"]=>
126     string(19) "-123456789012345.12"
127     ["test_bigint"]=>
128     string(39) "-12345678901234567890123456789012345678"
129     ["test_int"]=>
130     int(-1234567890)
131     ["test_smallmoney"]=>
132     float(-123456.12)
133     ["test_smallint"]=>
134     int(-12345)
135     ["test_tinyint"]=>
136     int(255)
137     ["test_real"]=>
138     string(19) "-123456789.12345679"
139     ["test_double"]=>
140     string(19) "-123456789.12345679"
141   }
143 bool(true)