Thread: [CDE-chat] parsesql ideas
Uniform Database Abstraction for PHP Development
Brought to you by:
andrevanzuydam
From: Andre v. Z. <an...@sp...> - 2008-09-01 18:15:01
|
Hi Everyone I was just thinking about the parsesql function. Could we not maintain an array of dialect keywords and their counterparts to reference in the parsesql function ? Example: array["1000"]["firebird"] = "top"; array["1000"]["firebird"] = "first"; array["1000"]["oracle"] = "rownum"; The 1000 is merely a numeric reference or id we can associate with the keyword. select first 10 * from table would become select 1000 * from table which could then be replaced by the necessary keywords for the applicable database. the oracle query would become select * from table where 1000 < 10 Anyway - the above needs work but who thinks its worth following? |
From: Lucian R. <luc...@gm...> - 2008-09-01 19:15:48
|
Hi everybody, In my opinion the array would be a very important issue, it could manage some important situations. For instance for MySQL the top 1000 rows clause is select * from table LIMIT 0, 1000 But parsing the next query select * from table LIMIT 500, 1000 -- selection of top 1000 records starting with the 501th record from MySQL to MSSQL cannot be made directly but using some artificial solutions, and one of them could be an array. Hope you understand what I'm talking about. If not, waiting for questions. Related to parsing function, I believe that each of us who has some more experience in a database type could work on a part of it. But first we need to create a logic scheme (diagram) for the parsing issue. After the logic diagram is created and can be applied on any database type, we can find the middle solution for parsing between different databases type. If nobody can manage this, I guess I could do some work on this, but that only if in case that nobody has experience in this kind of issues. All the best, Lucian Rosu |
From: Andre v. Z. <an...@sp...> - 2008-09-02 08:26:04
|
Hi Lucian If you and I can start working on this solution immediately it would be good! In firebird the expression you talked about would be implemented as select first 1000 next 500 * from table There is a little problem with where the keywords go but if we can create a middle ground for the sql which then can be put into any dialect it would be good. i.e. select first 1000 next 500 * from table = select * from table from 500 to 1000 select * from table limit 500, 1000 = select * from table from 500 to 1000 Both statements give us the same answer in our parsesql function which we then translate to the applicable database with "rules" for that database. I think we can start by working out how different SQL queries can be translated into either an ANSI dialect or something we come up with to help get the job done Yours sincerely Andre van Zuydam |
From: Lucian R. <luc...@gm...> - 2008-09-02 09:40:32
|
Hi Andre, I'll start thinking on the diagram for each common instruction select, insert, update, delete . Another thing, even I haven't seen till now the case when stocked procedures (suported at least by MSSQL and MySQL starting with version 5) used with php, we will support only execution of them. Trigers? I don't know, may be someone will use this tool for creating a cms for database management. Anyways we'll start with the base part and if requested some features could be added. Kind regards, Lucian Rosu On Tue, Sep 2, 2008 at 11:25 AM, Andre van Zuydam <an...@sp...>wrote: > Hi Lucian > > If you and I can start working on this solution immediately it would be > good! > > In firebird the expression you talked about would be implemented as > > select first 1000 next 500 * from table > > There is a little problem with where the keywords go but if we can > create a middle ground for the sql which then can be put into any > dialect it would be good. > > i.e. > > select first 1000 next 500 * from table = select * from table from 500 > to 1000 > select * from table limit 500, 1000 = select * from table from 500 to 1000 > > Both statements give us the same answer in our parsesql function which > we then translate to the applicable database with "rules" for that > database. > > I think we can start by working out how different SQL queries can be > translated into either an ANSI dialect or something we come up with to > help get the job done > > Yours sincerely > > Andre van Zuydam > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > cdeengine-chat mailing list > cde...@li... > https://lists.sourceforge.net/lists/listinfo/cdeengine-chat > |