Am Donnerstag, den 11.08.2005, 08:28 +0200 schrieb Frank Schönheit - Sun
Microsystems Germany:
> Hi Marc,

Hello Frank,

> > is there any interface at any service that can translate this
> > 
> > SELECT A, B, C, D, E, F, G FROM test.TestTab
> > 
> > into that
> > 
> > SELECT `A`, `B`, `C`, `D`, `E`, `F`, `G` FROM `test`.`TestTab` `TestTab`
> > 
> > according to the needs of the underlying database automatically from
> > basic code or do I have to do it manually?
> 
> Try the com.sun.star.sdb.SingleSelectQueryComposer. Below is a Basic
> fragment which exemplarily uses the Bibliography:
> 
>  oDataSource = createUnoService( _
>    "com.sun.star.sdb.DatabaseContext" ).getByName( "Bibliography" )
> 
>  oConnection = oDataSource.getConnection( "", "" )
> 
>  oComposer = oConnection.createInstance( _
>    "com.sun.star.sdb.SingleSelectQueryComposer" )
> 
>  oComposer.Query = "SELECT Indentifier FROM biblio"
>  MsgBox oComposer.Query
> 
>  oConnection.close()

Very nice, and the best thing is this service is published at the
API. :)

> The composer does not generate the table alias (the second `TestTab` in
> your example), but this one can be omitted anyway (with all databases I
> know, except some MS SQL server versions, IIRC).

Yes, exactly. Simple Queries do work without qualified table names, the
example above doesn't, it's too complex. However, that's life with
databases. ;)

Thank you very much!
Marc



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to