SPOD - Using IN SQL Keyword

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SPOD - Using IN SQL Keyword

Blue Sans douze
Hi list.

I'm using the lastest SPOD Macro which is great (with sys.db).

I have an Array<Int> containing ids.
I need to get all database rows that have one of thoses in a specified column.
Kind of this :

var a:Array<Int> = [1, 20, 30, 4, 17];
var result = Table.manager.search($id.in(a)); //Doesn't work, of course.

How can I do that ?
I can't just make a many equals, and make a request-loop would have no sense, talking about optimisation.

Thanks.
Blue112.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD - Using IN SQL Keyword

Yanis Benson

Out of the score of the question. Sorry, I lost your mail and was unable to find you in IRC. Is out ok to communicate to you using this mail?

On 9 Sep 2011 18:24, "Blue Sans douze" <[hidden email]> wrote:

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD - Using IN SQL Keyword

Nicolas Cannasse
In reply to this post by Blue Sans douze
Le 09/09/2011 16:21, Blue Sans douze a écrit :

> Hi list.
>
> I'm using the lastest SPOD Macro which is great (with sys.db).
>
> I have an Array<Int> containing ids.
> I need to get all database rows that have one of thoses in a specified
> column.
> Kind of this :
>
> var a:Array<Int> = [1, 20, 30, 4, 17];
> var result = Table.manager.search($id.in <http://id.in>(a)); //Doesn't
> work, of course.
>
> How can I do that ?
> I can't just make a many equals, and make a request-loop would have no
> sense, talking about optimisation.

Any keyword proposal ? "in" is already used by haXe can't be used as a
field name.

Nicolas


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD - Using IN SQL Keyword

Franco Ponticelli
Can't be "in" be used with a different semantic if not used in a for loop?

for(item in arr)

different from:

if(item in arr)

Franco

On Sun, Sep 11, 2011 at 2:13 PM, Nicolas Cannasse <[hidden email]> wrote:
Le 09/09/2011 16:21, Blue Sans douze a écrit :
Hi list.

I'm using the lastest SPOD Macro which is great (with sys.db).

I have an Array<Int> containing ids.
I need to get all database rows that have one of thoses in a specified
column.
Kind of this :

var a:Array<Int> = [1, 20, 30, 4, 17];
var result = Table.manager.search($id.in <http://id.in>(a)); //Doesn't

work, of course.

How can I do that ?
I can't just make a many equals, and make a request-loop would have no
sense, talking about optimisation.

Any keyword proposal ? "in" is already used by haXe can't be used as a field name.

Nicolas


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD - Using IN SQL Keyword

clemos
In reply to this post by Nicolas Cannasse
How about "either" ?

Clément

On Sun, Sep 11, 2011 at 3:13 PM, Nicolas Cannasse
<[hidden email]> wrote:

> Le 09/09/2011 16:21, Blue Sans douze a écrit :
>>
>> Hi list.
>>
>> I'm using the lastest SPOD Macro which is great (with sys.db).
>>
>> I have an Array<Int> containing ids.
>> I need to get all database rows that have one of thoses in a specified
>> column.
>> Kind of this :
>>
>> var a:Array<Int> = [1, 20, 30, 4, 17];
>> var result = Table.manager.search($id.in <http://id.in>(a)); //Doesn't
>> work, of course.
>>
>> How can I do that ?
>> I can't just make a many equals, and make a request-loop would have no
>> sense, talking about optimisation.
>
> Any keyword proposal ? "in" is already used by haXe can't be used as a field
> name.
>
> Nicolas
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD - Using IN SQL Keyword

Nicolas Cannasse
In reply to this post by Franco Ponticelli
Le 11/09/2011 15:23, Franco Ponticelli a écrit :
> Can't be "in" be used with a different semantic if not used in a for loop?
>
> for(item in arr)
>
> different from:
>
> if(item in arr)

That would require a change in the AST/parser, but why not : that would
allow macros to reuse the syntax for other usages.

Nicolas

--
haXe - an open source web programming language
http://haxe.org