Thanks Mikael.

It looks like ErlSQL will have to accept another parameter indicating
the dialect to translate into in order to make it portable across
MySQL and Postgres. The right way to do it would be to turn the second
parameter ('Safe') into a list of options.

Yariv

On Jan 3, 2008 7:28 AM, Mikael Karlsson <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I had problems to get the music example working with the psql driver. A
> small change to erlsql.erl was needed since postgresql does not seem to
> support LIMIT with two arguments (offset and limit). Instead the extra
> OFFSET argument  had to be given explicitly. I do not know how this affects
> the MySQL driver but it would be nice if the example worked for both though.
>
> Best Regards
> Mikael
>
> svn diff:
>
> Index: erlsql/erlsql.erl
> ===================================================================
> --- erlsql/erlsql.erl   (revision 228)
> +++ erlsql/erlsql.erl   (working copy)
> @@ -309,7 +309,7 @@
>  extra_clause({limit, Num}, _Safe) ->
>      [<<" LIMIT ">>, encode(Num)];
>  extra_clause({limit, Offset, Num}, _Safe) ->
> -    [<<" LIMIT ">>, encode(Offset), $, , encode(Num)];
> +    [<<" LIMIT ">>, encode(Num), <<" OFFSET ">>, encode(Offset)];
>  extra_clause({group_by, ColNames}, _Safe) ->
>      [<<" GROUP BY ">>, make_list(ColNames, fun convert/1)];
>  extra_clause({group_by, ColNames, having, Expr}, Safe) ->
>
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to