IM we need to add an object to application scope that has the right db.json file. This json should be a combination of generic queries and queries for the selected database.
On Thursday, June 19, 2014, Harshan Liyanage <hars...@wso2.com> wrote: > 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: hars...@wso2.com <javascript:_e(%7B%7D,'cvml','hars...@wso2.com');> > > 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 <ino...@wso2.com > <javascript:_e(%7B%7D,'cvml','ino...@wso2.com');>> 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 >> > > -- Chan (Dulitha Wijewantha) Software Engineer - Mobile Development WSO2Mobile Lean.Enterprise.Mobileware * ~Email duli...@wso2.com <duli...@wso2mobile.com>* * ~Mobile +94712112165* * ~Website dulitha.me <http://dulitha.me>* * ~Twitter @dulitharw <https://twitter.com/dulitharw>* *~Github @dulichan <https://github.com/dulichan>* *~SO @chan <http://stackoverflow.com/users/813471/chan>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev