Hi,

We could categorize the sql queries under each database type in db.js file.
IMO we need a mechanism to detect the database type (mysql, h2, oracle etc)
& return appropriate sql query based on the db type.

WDYT?

Thanks,

Best Regards,

Lakshitha Harshan
Software Engineer
Mobile: *+94724423048*
Email: [email protected]
Blog : http://harshanliyanage.blogspot.com/
*WSO2, Inc. :** wso2.com <http://wso2.com/>*
lean.enterprise.middleware.


On Thu, Jun 19, 2014 at 10:51 AM, Inosh Perera <[email protected]> wrote:

> Hi all,
> I was looking into adding Oracle database support to EMM and wrote the
> scripts to create tables in Oracle. Since auto increment and is not
> available in Oracle, I wrote sequences and triggers. Afterwards, I started
> checking the SQL queries, that we use in the back end with Oracle, and came
> across 2 issues,
>
> 1.  Query - SELECT * FROM notifications WHERE device_id = ? ORDER BY id
> DESC LIMIT 1
>
> LIMIT is not supported by Oracle- They use ROWNUM for this purpose. Since
> we have one db.js file for all the databases that contain all the db
> queries, how should this be handled custom queries?
>
>
> 2.  Query- Notifications - select query 12
>
> select * from notifications where `device_id`=? and `feature_code`= ? and
> `status`='R' and `id` = (select MAX(`id`) from notifications where
> `device_id`=? and `feature_code`= ? and `status`='R') ORDER BY sent_date
> ASC",
>
> This query contains a special character "`" , for example `device_id` that
> is not supported by Oracle. I will modify the query and use since its not a
> big issue.
>
> Also mdm_report.js file has some select queries written inside it, and
> those must be moved to db.js
> The rest of the queries in db.js is running with Oracle. I will do an
> integration test, once server start up is successful with oracle.
>
> Thank you,
> Inosh
>
> --
> Inosh Perera
> Software Engineer, WSO2 Inc.
> Tel: 0785293686
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to