develooper Front page | perl.dbd.oracle.changes | Postings from March 2012

[svn:dbd-oracle] r15249 - in dbd-oracle/trunk: . lib/DBD

From:
mjevans
Date:
March 30, 2012 01:21
Subject:
[svn:dbd-oracle] r15249 - in dbd-oracle/trunk: . lib/DBD
Message ID:
20120330082125.0E589184B72@xx12.develooper.com
Author: mjevans
Date: Fri Mar 30 01:21:22 2012
New Revision: 15249

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/lib/DBD/Oracle.pm

Log:
rewrite placeholder pod and document the 3rd placeholder variation


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Fri Mar 30 01:21:22 2012
@@ -11,7 +11,7 @@
    will still have to set LongReadLen (Martin J. Evans)
 
  - Fixed 70meta and rt74753-utf8-encoded to not die if you cannot
-   connect to Oracle or you cannot install from cpan if you have not
+   connect to Oracle or you cannot install from CPAN if you have not
    set up a valid Oracle connection.
 
  - Fixed 75163. Bfile lobs were not being opened before fetching if
@@ -20,7 +20,7 @@
    Note: this has a minor impact on non bfile lobs when ora_auto_lobs
    is not in force as an additional call to OCILobFileIsOpen will be
    made.
- 
+
  - Removed almost all DBIS usage fixing and speeding up threaded
    Perls (Martin J. Evans).
 
@@ -28,6 +28,9 @@
  - clarification of when StrictlyTyped/DiscardString can be used and
    LongReadLen (Martin J. Evans)
 
+ - Documented the 3rd type of placeholder and rewrote the existing
+   pod for placeholders (Martin J. Evans).
+
 1.42      2012-03-13
  - skip rt74753-utf8-encoded.t if db is not unicode
 

Modified: dbd-oracle/trunk/lib/DBD/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/lib/DBD/Oracle.pm	(original)
+++ dbd-oracle/trunk/lib/DBD/Oracle.pm	Fri Mar 30 01:21:22 2012
@@ -2289,13 +2289,17 @@
 
 =head3 B<Placeholders>
 
-There are two types of placeholders that can be used in DBD::Oracle. The first is
-the "question mark" type, in which each placeholder is represented by a single
-question mark character. This is the method recommended by the DBI specs and is the most
-portable. Each question mark is internally replaced by a "dollar sign number" in the order
-in which they appear in the query (important when using L</bind_param>).
+There are three types of placeholders that can be used in
+DBD::Oracle.
 
-The other placeholder type is "named parameters" in the format ":foo" which is the one Oralce prefers.
+The first is the "question mark" type, in which each placeholder is
+represented by a single question mark character. This is the method
+recommended by the DBI and is the most portable. Each question
+mark is internally replaced by a "dollar sign number" in the order in
+which they appear in the query (important when using L</bind_param>).
+
+The second type of placeholder is "named parameters" in the format
+":foo" which is the one Oracle prefers.
 
    $dbh->{RaiseError} = 1;        # save having to check each method call
    $sth = $dbh->prepare("SELECT name, age FROM people WHERE name LIKE :name");
@@ -2303,6 +2307,17 @@
    $sth->execute;
    DBI::dump_results($sth);
 
+Note when calling bind_param with named parameters you must include
+the leading colon. The advantage of this placeholder type is that you
+can use the same placeholder more than once in the same SQL statement
+but you only need to bind it once.
+
+The last placeholder type is a variation of the two above where you
+name each placeholder :N (where N is a number). Like the named
+placeholders above you can use the same placeholder multiple times in
+the SQL but when you call bind_param you only need to pass the N
+(e.g., for :1 you use bind_param(1,...) and not bind_param(':1',...).
+
 The different types of placeholders cannot be mixed within a statement, but you may
 use different ones for each statement handle you have. This is confusing at best, so
 stick to one style within your program.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About