OclPs and SQL query
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


««12

OclPs and SQL query Expand / Collapse
Author
Message
Posted 2008-11-28 11:28:51
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
You will get the better performing SQL if you use the better performing OCL-statement.

Malcolm is a good guy, but he was never in a position where he could promise features in ECO...

The problem is not so much to being able to configure whether a particular database supports subselects (MySql4 doesn't do that either), but to optimize the query to avoid them. I understand that it looks obvious to the naked eye that the query is optimizeable, and that there is a really short and natural way of writing it in SQL. The problem doesn't look quite as easy when you have a parse-tree in OCL that you need to convert to the semantically equivalent SQL...


/Jonas Hogstrom [CapableObjects]
Post #1211
Posted 2008-11-30 23:45:46


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2010-08-11 16:02:44
Posts: 338, Visits: 890
Jonas Hogstrom (2008-11-28)
The problem doesn't look quite as easy when you have a parse-tree in OCL that you need to convert to the semantically equivalent SQL...

But maybe it would be possible to introduce some mapping so that query that matches pattern (for example) "[ClassA].allInstances->select([AtoB] = [self])" would execute custom SQL?

Pattern: "[ClassA].allInstances->select([AtoB] = [inst])"
Params: ClassA=Class(ClassA), AtoB=Association(ClassA.AtoB), inst=self
SQL: select * from ClassA where AtoB = @inst

Or define it some other way (maybe in XML as a parse-tree).

This way we could add number of mapping items to optimaise queries.

Cheers.


My Blog: http://dnagir.blogspot.com
Post #1261
Posted 2008-12-22 02:55:43


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2010-08-11 16:02:44
Posts: 338, Visits: 890
Can you please let us know if in the future release you will allow us to customise the SQL that our applications send to the database.

Some sort of OCL - SQL mapping could be provided to all a developer to take full control and responsibility.

Please let us know if you will implement such feature or not.


My Blog: http://dnagir.blogspot.com
Post #1511
Posted 2008-12-22 06:48:14
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2012-01-23 17:45:58
Posts: 49, Visits: 72
I vote for your suggestion!
Post #1512
Posted 2008-12-22 11:17:46
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
it might look really easy, but there are so many cases where this simple approach will get you nowhere (compound keys, associations in an inherited table, remapped column names, associations embedded in the other end).

To solve this simple case, it is easier to build your own service from scratch. load the primary key and use the ICacheContentService to convert the keys to objects.


/Jonas Hogstrom [CapableObjects]
Post #1521
« Prev Topic | Next Topic »

««12

Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 12:05

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,484. 7 queries. Compression Disabled.