db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: db-ojb/xdocs odmg-tutorial.xml
Date Fri, 10 Oct 2003 18:50:51 GMT
brianm      2003/10/10 11:50:51

  Modified:    src/test/org/apache/ojb/tutorials ODMGExample.java
               xdocs    odmg-tutorial.xml
  Log:
  Chanegd ODMG tutorial to use prepared-statement style query ( query.bind() ) as that is
more idiommatic and cleaner
  
  Revision  Changes    Path
  1.3       +2 -1      db-ojb/src/test/org/apache/ojb/tutorials/ODMGExample.java
  
  Index: ODMGExample.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorials/ODMGExample.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ODMGExample.java	1 Oct 2003 19:32:19 -0000	1.2
  +++ ODMGExample.java	10 Oct 2003 18:50:50 -0000	1.3
  @@ -32,7 +32,8 @@
           tx.begin();
   
           OQLQuery query = impl.newOQLQuery();
  -        query.create("select products from " + Product.class + " where name = '" + name
+ "'");
  +        query.create("select products from " + Product.class.getName() + " where name =
$1");
  +        query.bind(name);
           DList results = (DList) query.execute();
           Product product = (Product) results.iterator().next();
   
  
  
  
  1.3       +2 -1      db-ojb/xdocs/odmg-tutorial.xml
  
  Index: odmg-tutorial.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/xdocs/odmg-tutorial.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- odmg-tutorial.xml	1 Oct 2003 19:32:19 -0000	1.2
  +++ odmg-tutorial.xml	10 Oct 2003 18:50:51 -0000	1.3
  @@ -117,7 +117,8 @@
           tx.begin();
   
           OQLQuery query = impl.newOQLQuery();
  -        query.create("select products from " + Product.class + " where name = '" + name
+ "'");
  +        query.create("select products from " + Product.class.getName() + " where name =
$1");
  +        query.bind(name);
           DList results = (DList) query.execute();
           Product product = (Product) results.iterator().next();
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message