From 845cca26d79ae2fd58486d6590fb2a55eaf17072 Mon Sep 17 00:00:00 2001 From: githubeing Date: Tue, 24 Nov 2020 15:41:16 +0300 Subject: [PATCH] add instructions to use pdo with oracle With Oracle, you'll need some extra steps: --- content/storage/pdo.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/storage/pdo.md b/content/storage/pdo.md index 5383a98..d7e2219 100644 --- a/content/storage/pdo.md +++ b/content/storage/pdo.md @@ -29,6 +29,16 @@ $pdo = new PDO('sqlite:/opt/databases/mydb.sq3'); // connection for SQLite in memory $pdo = new PDO('sqlite::memory:'); + +// connection for Oracle. With Oracle, you'll need some extra steps: +$options = [ + // without the following option, Oracle may convert some names to UPPERCASE, + // which will break SQL code of the OAuth server library (having names written in lowercase) + PDO::ATTR_CASE => PDO::CASE_LOWER, +]; +$pdo = new PDO("oci:dbname=//$host:$port/$sid", $user, $pass, $options); +// without the following statement, Oracle may not understand the datetime format used by the OAuth server library +$pdo->exec("alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'"); ``` Then, create the storage object using the `Pdo` storage class: