summaryrefslogtreecommitdiff
path: root/test/expected/param-conversions.out
blob: c67c47bebe2128490c01f8b1a332712874765054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
connected

Testing conversions...
Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2"...
Result set:
0

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-2"...
Result set:
1

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2"...
Result set:
0

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-2"...
Result set:
1

Testing "SELECT 2.2 > ?" with SQL_C_CHAR -> SQL_FLOAT param "2.3"...
Result set:
0

Testing "SELECT 3.3 > ?" with SQL_C_CHAR -> SQL_DOUBLE param "3.01"...
Result set:
1

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_CHAR param "5 escapes: \ and '"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type integer: "5 escapes: \ and '";
Error while executing the query

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "32767"...
Result set:
0

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-32768"...
Result set:
1


Testing conversions whose result depend on whether the
parameter is treated as a string or an integer...
Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_INTEGER param "6"...
Result set:
1

Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_SMALLINT param "6"...
Result set:
1

Testing "SELECT '555' > ?" with SQL_C_CHAR -> SQL_CHAR param "6"...
Result set:
0

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "99999999999999999999999"...
SQLExecDirect failed
22003=ERROR: value "99999999999999999999999" is out of range for type integer;
Error while executing the query


Testing conversions with invalid values...
Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_INTEGER param "2, 'injected, BAD!'"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type integer: "2, 'injected, BAD!'";
Error while executing the query

Testing "SELECT 2 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "2, 'injected, BAD!'"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type smallint: "2, 'injected, BAD!'";
Error while executing the query

Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type numeric: "3', 'injected, BAD!', '1";
Error while executing the query

Testing "SELECT 1.4 > ?" with SQL_C_CHAR -> SQL_FLOAT param "4 \'bad', '1"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type numeric: "4 \'bad', '1";
Error while executing the query

Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_INTEGER param "-1"...
Result set:
2

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param "-"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type integer: "-";
Error while executing the query

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_INTEGER param ""...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type integer: "";
Error while executing the query

Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_SMALLINT param "-1"...
Result set:
2

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param "-"...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type smallint: "-";
Error while executing the query

Testing "SELECT 1 > ?" with SQL_C_CHAR -> SQL_SMALLINT param ""...
SQLExecDirect failed
22P02=ERROR: invalid input syntax for type smallint: "";
Error while executing the query

Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param 1234...
Result set:
-1234

Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_INTEGER param -1234...
Result set:
1234

Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_SMALLINT param 1234...
Result set:
-1234

Testing "SELECT 0-?" with SQL_C_SLONG -> SQL_SMALLINT param -1234...
Result set:
1234


Testing bytea conversions
Testing "SELECT ?" with SQL_C_BINARY -> SQL_BINARY param...
Result set:
666f6f0a5c62617200

Testing "SELECT ?" with SQL_C_CHAR -> SQL_BINARY param "666f6f0001"...
Result set:
666f6f0001

Testing "SELECT ?::text" with SQL_C_BINARY -> SQL_CHAR param...
Result set:
foo
\bar


Testing datetime conversions
Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIMESTAMP param "04-22-2011 01:23:45"...
Result set:
2011-04-22 01:23:45

Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIMESTAMP param "{ts '2011-04-22 01:23:45'}"...
Result set:
2011-04-22 01:23:45

Testing "SELECT ?" with SQL_C_CHAR -> SQL_TIME param "{t '01:23:45'}"...
Result set:
01:23:45

Testing "SELECT ?" with SQL_C_CHAR -> SQL_DATE param "{d '2011-04-22'}"...
Result set:
2011-04-22

disconnecting