1Rose::DB::Oracle(3) User Contributed Perl Documentation Rose::DB::Oracle(3)
2
3
4
6 Rose::DB::Oracle - Oracle driver class for Rose::DB.
7
9 use Rose::DB;
10
11 Rose::DB->register_db
12 (
13 domain => 'development',
14 type => 'main',
15 driver => 'Oracle',
16 database => 'dev_db',
17 host => 'localhost',
18 username => 'devuser',
19 password => 'mysecret',
20 );
21
22 Rose::DB->register_db
23 (
24 domain => 'production',
25 type => 'main',
26 driver => 'Oracle',
27 service => 'my_pdb',
28 host => 'db.example.com',
29 username => 'produser',
30 password => 'prodsecret',
31 );
32
33 Rose::DB->default_domain('development');
34 Rose::DB->default_type('main');
35 ...
36
37 $db = Rose::DB->new; # $db is really a Rose::DB::Oracle-derived object
38 ...
39
41 Rose::DB blesses objects into a class derived from Rose::DB::Oracle
42 when the driver is "oracle". This mapping of driver names to class
43 names is configurable. See the documentation for Rose::DB's new() and
44 driver_class() methods for more information.
45
46 This class cannot be used directly. You must use Rose::DB and let its
47 new() method return an object blessed into the appropriate class for
48 you, according to its driver_class() mappings.
49
50 Only the methods that are new or have different behaviors than those in
51 Rose::DB are documented here. See the Rose::DB documentation for the
52 full list of methods.
53
54 Oracle 9 or later is required.
55
56 If you want to connect to a service rather than a database, use the
57 "service" parameter instead of "database" when registering the data
58 source, as shown in the SYNOPSIS above. This will allow you to connect
59 to PDBs (Pluggable Databases).
60
61 Note: This class is a work in progress. Support for Oracle databases
62 is not yet complete. If you would like to help, please contact John
63 Siracusa at siracusa@gmail.com or post to the mailing list.
64
66 default_post_connect_sql [STATEMENTS]
67 Get or set the default list of SQL statements that will be run
68 immediately after connecting to the database. STATEMENTS should be
69 a list or reference to an array of SQL statements. Returns a
70 reference to the array of SQL statements in scalar context, or a
71 list of SQL statements in list context.
72
73 The default_post_connect_sql statements will be run before any
74 statements set using the post_connect_sql method. The default list
75 contains the following:
76
77 ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
78 ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'
79 ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
80
81 If one or more "NLS_*_FORMAT" environment variables are set, the
82 format strings above are replaced by the values that these
83 environment variables have at the time this module is loaded.
84
85 booleans_are_numeric [BOOL]
86 Get or set a boolean value that indicates whether or not boolean
87 columns are numeric. Oracle does not have a dedicated boolean
88 column type. Two common stand-in column types are CHAR(1) and
89 NUMBER(1). If "booleans_are_numeric" is true, then boolean columns
90 are treated as NUMBER(1) columns containing either 1 or 0. If
91 false, they are treated as CHAR(1) columns containing either 't' or
92 'f'. The default is false.
93
95 post_connect_sql [STATEMENTS]
96 Get or set the SQL statements that will be run immediately after
97 connecting to the database. STATEMENTS should be a list or
98 reference to an array of SQL statements. Returns a reference to an
99 array (in scalar) or a list of the default_post_connect_sql
100 statements and the post_connect_sql statements. Example:
101
102 $db->post_connect_sql('UPDATE mytable SET num = num + 1');
103
104 print join("\n", $db->post_connect_sql);
105
106 ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
107 ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SSxFF'
108 UPDATE mytable SET num = num + 1
109
110 schema [SCHEMA]
111 Get or set the database schema name. In Oracle, every user has a
112 corresponding schema. The schema is comprised of all objects that
113 user owns, and has the same name as that user. Therefore, this
114 attribute defaults to the username if it is not set explicitly.
115
116 Value Parsing and Formatting
117 validate_date_keyword STRING
118 Returns true if STRING is a valid keyword for the PostgreSQL "date"
119 data type. Valid (case-insensitive) date keywords are:
120
121 current_date
122 current_timestamp
123 localtimestamp
124 months_between
125 sysdate
126 systimestamp
127
128 The keywords are case sensitive. Any string that looks like a
129 function call (matches "/^\w+\(.*\)$/") is also considered a valid
130 date keyword if keyword_function_calls is true.
131
132 validate_timestamp_keyword STRING
133 Returns true if STRING is a valid keyword for the Oracle
134 "timestamp" data type, false otherwise. Valid timestamp keywords
135 are:
136
137 current_date
138 current_timestamp
139 localtimestamp
140 months_between
141 sysdate
142 systimestamp
143
144 The keywords are case sensitive. Any string that looks like a
145 function call (matches "/^\w+\(.*\)$/") is also considered a valid
146 timestamp keyword if keyword_function_calls is true.
147
149 John C. Siracusa (siracusa@gmail.com), Ron Savage (ron@savage.net.au)
150
152 Copyright (c) 2008 by John Siracusa and Ron Savage. All rights
153 reserved. This program is free software; you can redistribute it and/or
154 modify it under the same terms as Perl itself.
155
156
157
158perl v5.36.0 2023-03-01 Rose::DB::Oracle(3)