@@ -20,6 +20,7 @@ if ($stmt->execute()) {
20
20
21
21
// regular timeout attribute, set after instance created, will affect query timeout, causing this query to fail
22
22
$ db = new PDO ($ dsn , $ user , $ pass );
23
+ $ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_SILENT );
23
24
$ db ->setAttribute (PDO ::ATTR_TIMEOUT , 1 );
24
25
$ stmt = $ db ->prepare ($ sql );
25
26
if (!$ stmt ->execute ()) {
@@ -33,6 +34,7 @@ if (!$stmt->execute()) {
33
34
34
35
// pdo_dblib-specific timeout attribute, set after instance created, will control query timeout, causing this query to fail
35
36
$ db = new PDO ($ dsn , $ user , $ pass );
37
+ $ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_SILENT );
36
38
$ db ->setAttribute (PDO ::DBLIB_ATTR_QUERY_TIMEOUT , 1 );
37
39
$ stmt = $ db ->prepare ($ sql );
38
40
if (!$ stmt ->execute ()) {
@@ -45,7 +47,7 @@ if (!$stmt->execute()) {
45
47
}
46
48
47
49
// regular timeout attribute will affect query timeout, causing this query to fail
48
- $ db = new PDO ($ dsn , $ user , $ pass , [PDO ::ATTR_TIMEOUT => 1 ]);
50
+ $ db = new PDO ($ dsn , $ user , $ pass , [PDO ::ATTR_ERRMODE => PDO :: ERRMODE_SILENT , PDO :: ATTR_TIMEOUT => 1 ]);
49
51
$ stmt = $ db ->prepare ($ sql );
50
52
if (!$ stmt ->execute ()) {
51
53
echo "OK \n" ;
@@ -57,7 +59,7 @@ if (!$stmt->execute()) {
57
59
}
58
60
59
61
// pdo_dblib-specific timeout attribute will control query timeout, causing this query to fail
60
- $ db = new PDO ($ dsn , $ user , $ pass , [PDO ::DBLIB_ATTR_QUERY_TIMEOUT => 1 ]);
62
+ $ db = new PDO ($ dsn , $ user , $ pass , [PDO ::ATTR_ERRMODE => PDO :: ERRMODE_SILENT , PDO :: DBLIB_ATTR_QUERY_TIMEOUT => 1 ]);
61
63
$ stmt = $ db ->prepare ($ sql );
62
64
if (!$ stmt ->execute ()) {
63
65
echo "OK \n" ;
0 commit comments