You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by brandonlamb <br...@brandonlamb.com> on 2015/04/06 03:31:06 UTC

JDBC - How can I force lower-case columns??

So in PHP we can do:

$pdo = new PDO(
  'ibm:DSN=DEV;currentSchema=blah;', 
  'user', 
  'pass', 
  [PDO::ATTR_CASE => PDO::CASE_LOWER]
);

$stmt = $pdo->prepare('SELECT id, name FROM table');
$stmt->execute();

while ($row = $stmt->fetch(PDO::FETCH_OBJECT)) {
  echo $row->id;
  echo $row->name;
}

Without the force to lower I have to context switch and have ugly code like:

echo $row->ID;
echo $row->NAME;

Does JDBC have some kind of equivalent to force upper, lower or natural
(however the rdbm sends it)?



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JDBC-How-can-I-force-lower-case-columns-tp4674287.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JDBC - How can I force lower-case columns??

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Not as far as i know but jpa allows to do it thanks to @Column

@Column(name="NAME")
private String name;
Le 6 avr. 2015 03:44, "brandonlamb" <br...@brandonlamb.com> a écrit :

> So in PHP we can do:
>
> $pdo = new PDO(
>   'ibm:DSN=DEV;currentSchema=blah;',
>   'user',
>   'pass',
>   [PDO::ATTR_CASE => PDO::CASE_LOWER]
> );
>
> $stmt = $pdo->prepare('SELECT id, name FROM table');
> $stmt->execute();
>
> while ($row = $stmt->fetch(PDO::FETCH_OBJECT)) {
>   echo $row->id;
>   echo $row->name;
> }
>
> Without the force to lower I have to context switch and have ugly code
> like:
>
> echo $row->ID;
> echo $row->NAME;
>
> Does JDBC have some kind of equivalent to force upper, lower or natural
> (however the rdbm sends it)?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JDBC-How-can-I-force-lower-case-columns-tp4674287.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>