xref: /PHP-8.1/ext/odbc/tests/bug69354.phpt (revision b5a14e6c)
1--TEST--
2Bug #69354 Incorrect use of SQLColAttributes with ODBC 3.0
3--EXTENSIONS--
4odbc
5--SKIPIF--
6<?php include 'skipif.inc'; ?>
7--FILE--
8<?php
9
10include 'config.inc';
11
12$conn = odbc_connect($dsn, $user, $pass);
13
14@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
15
16odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100))');
17
18odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')");
19
20$res = odbc_exec($conn,"select VARCHAR_COL from FOO");
21if ($res) {
22    if (odbc_fetch_row($res)) {
23        $ret = odbc_result($res,'varchar_col');
24        echo strlen($ret), "\n";
25        echo $ret[0], "\n";
26        echo $ret[strlen($ret)-1], "\n";
27    }
28}
29?>
30--EXPECT--
31100
32a
33a
34--CLEAN--
35<?php
36include 'config.inc';
37
38$conn = odbc_connect($dsn, $user, $pass);
39
40odbc_exec($conn, 'DROP TABLE FOO');
41odbc_exec($conn, 'DROP DATABASE odbcTEST');
42
43?>
44