Hi Yan,

to answer your questions:
Yes this feature is available.

As with many requests like this, it is always a good idea to first take a look 
at our two core example projects:
- the empire-db-example-basic shows the basic principles
- the empire-db-example-advanced is for all who want or need to go beyond that.

For prepared statements there are two things to say:
1) When using a DBCommand you need to declare parameters manually using 
cmd.addParam().
2) When using DBRecord prepared statements will be used automatically if the 
corresponding option is set on the database.
   Use db.setPreparedStatementsEnabled(true) to enable prepared statements for 
all operations on DBRecord (insert, update, delete)

If you run the advanced sample (SampleAdvApp.java) you will see in the log 
output that prepared statements are used for most things.
Using command params is explicitly demonstrated with the method 
commandParamsSample(...).

I hope this helped.

Regards
Rainer

P.S. Please do not create JIRA tickets for questions like this.
Tickets should be used for bugs, improvments, patches etc. not for simple 
questions.


> from: yan zhang (JIRA) [mailto:[email protected]]
> to: [email protected]
> re: [jira] [Created] (EMPIREDB-148) how to use DBCommond to create
> a prepared sql string
> 
> yan zhang created EMPIREDB-148:
> ----------------------------------
> 
>              Summary: how to use  DBCommond to create a prepared sql
> string
>                  Key: EMPIREDB-148
>                  URL: https://issues.apache.org/jira/browse/EMPIREDB-
> 148
>              Project: Empire-DB
>           Issue Type: Wish
>             Reporter: yan zhang
>             Priority: Minor
> 
> 
> I am working a new project and looking for lightweight ORM tools. One
> feature I need is to be able to generate sql string and we have our own
> layer of running query.
> 
> I come across   DBCommand class, and it seems to be able to generate
> raw sql string. One feature I am looking to is able to generate
> prepared update/insert statement. the getInsert() only returns a
> regular sql string.
> 
> Would really appreciate if someone can respond on;
> 1) whether this feature is available?
> 2) if not, if this is in your feature plan?
> 3) if yes, code sample will be very helpful.
> 
> thanks,
> 
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators:
> https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp
> a
> For more information on JIRA, see:
> http://www.atlassian.com/software/jira
> 
> 

Reply via email to