Re: [PHP] Object Query Language optimization

2011-05-21 Thread jean-baptiste verrey
hi,

"I often use SQL that is far, far more complex than this."
well, this is why my OQL is pretty simple, it does not intend to do any
crazy stuff that you can do with SQL (as I can load objects from SQL as
well)

I had a look at other ORM, and the problem is that some are extremely
complicated (Doctrine is a very specialized framework, you can basically do
anything you can do with SQL but in OQL) , they don't have OQL, they use
active recode like query,  or they use a class with chain methods.

My problem in itself is not really a problem as it is working, but I just
wonder how to optimize it, if I should write some different version and
benchmark it, or identify from the beginning that my solution is good
enough.

Thanks anyway^^


On 21 May 2011 16:54, Mark Kelly  wrote:

> Hi.
>
> On Saturday 21 May 2011 at 15:56 jean-baptiste verrey wrote:
>
> > I'm writing an Object Query Language
>
> [snip]
>
> > (queries don't get much more complicated than that, you have multiple
> > alias.fieldName in the select, then multiple joins)
>
> I often use SQL that is far, far more complex than this.
>
> Anyway, I can't help directly with the code, other than to suggest that you
> take a look at other projects that do the same thing and see how they do
> it.
> There's a starter list at:
>
> http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#PHP
>
> HTH,
>
> Mark
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Object Query Language optimization

2011-05-21 Thread Mark Kelly
Hi.

On Saturday 21 May 2011 at 15:56 jean-baptiste verrey wrote:

> I'm writing an Object Query Language 

[snip]

> (queries don't get much more complicated than that, you have multiple
> alias.fieldName in the select, then multiple joins)

I often use SQL that is far, far more complex than this.

Anyway, I can't help directly with the code, other than to suggest that you 
take a look at other projects that do the same thing and see how they do it. 
There's a starter list at:

http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#PHP

HTH,

Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Object Query Language optimization

2011-05-21 Thread jean-baptiste verrey
hi folks,

I'm writing an Object Query Language which is pretty simple, you do request
such as
*SELECT e.*,c.firstName *
*FROM employee e *
*JOIN contact c ON e*
*WHERE e.id=*?

(queries don't get much more complicated than that, you have multiple
alias.fieldName in the select, then multiple joins)

I'm trying to find the best way to get all the informations.
At the moment I am doing a preg_match that simply verify that the whole
syntax is good , but to separate all the information i have to separate the
query in sub parts (select, from , join, where) and do a preg_match_all on
them.

So my questions are :
- is there a better way to do this?

- about regular expression : (that would directly solve my problem)
if you do
preg_match('!(([a-z])+)!','abcabc',$matches);
echo '';print_r($matches);echo '';
you get only the last letter, is there a way to get all of them ??? (using a
regular expression and only preg_match, no preg_match_all)
http://www.regular-expressions.info/captureall.html

Regards,

JB