incubator-empire-db-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Exxos <hat...@yahoo.com>
Subject re: UNION SQL Command
Date Sun, 10 Jan 2010 18:45:01 GMT
Thank you for this tips.

/Cheers.

--- On Sat, 1/9/10, Rainer Döbele <doebele@esteam.de> wrote:

From: Rainer Döbele <doebele@esteam.de>
Subject: re: UNION SQL Command
To: empire-db-user@incubator.apache.org, hatu@yahoo.com
Date: Saturday, January 9, 2010, 9:59 AM




 
 






Your right as far as the doc is concerned. Unfortunately I
cannot help you there but if your offer to contribute is deeply welcome. 

   

Fortunately I can easily answer your other question. 

Here’s how it works: 

   

  DBCommandExpr
union = cmd1.union(cmd2); 

  String sql =
union.getSelect(); 

  

Regards 

Rainer 

   







Von: M Louasse
[mailto:hatufr@yahoo.com] 

Gesendet: Samstag, 9. Januar 2010 01:15

An: empire-db-user@incubator.apache.org

Betreff: UNION SQL Command 





   


 
  
  
  Hi,

  

  Could the javadoc of empire-db win a price?

  I do not know, but the doc is realy poor! It does not motivate... But I like
  you project, so I want to contribute in order to help you.

  

  Anyway, I'm comming with a real issue: The SQL keyword UNION.

  

  I'm using Mysql 5.1 and lets see bellow:

  

  cmd.select(db.album.id,db.album.title,db.album.index,db.album.serieId,
  db.serie.title);

  DBCommand cmdUnion = db.createCommand();

  cmdUnion.select(db.album.id,db.album.title,db.album.index,db.album.serieId,db.album.title);

  cmd.union(cmdUnion);

  cmd.orderBy(db.serie.title);

  

  generates:

  

  SELECT t1.alb_id, t1.alb_title, t1.alb_index, t1.alb_ser_id, t4.ser_title

  FROM album t1, serie t4

  ORDER BY t4.ser_title

  

  Whereas expected:

  

  SELECT alb_id, alb_title, alb_index, alb_ser_id, ser_title FROM Album, Serie
  WHERE alb_ser_id = ser_id

  UNION (SELECT alb_id, alb_title, alb_index, alb_ser_id, alb_title FROM Album
  WHERE alb_ser_id IS NULL)

  ORDER BY ser_title;

  

  When I read (I try) your "javadoc" about addSQL() at
  DBCommendExpr..java

  

  ----------------------

  addSQL()

  

  public void addSQL(java.lang.StringBuilder buf,

                    
  long context)

  

      Creates the SQL-Command.

  

      Specified by:

          addSQL in class DBExpr

  

      Parameters:

          buf - the SQL-Command

          context - the current SQL-Command
  context

  

  ----------------------

  

  Doh! Please advise!

  

  Thank you. 
  
  
 


   





 




      
Mime
View raw message