The problem I've seen when testing your code is slightly different
from the one you reported : Camlp4 choke on the "Relational.Conv_..."
string as containing different identifiers. The problem is that "A.B"
is not a legal uid, so you can't use it in a $uid:...$ antiquotation.

I've fixed this by using an Ast.ident instead of a string for the
type_conv value of the DB module. Hand-made diff attached.

On 2/8/10, Guillaume Yziquel <guillaume.yziq...@citycable.ch> wrote:
> Hi. This is for camlp4 gurus:
>
> I've been using a modified version of Mauricio Fernandez' relational
> algebra camlp4 extension for postgresql. (I'm trying to adapt it to
> another database system, so I've functorised a bit of the original code).
>
> You can find the modified code and a Debian package at:
>
> http://yziquel.homelinux.org/debian/pool/main/o/ocaml-relational/
> http://yziquel.homelinux.org/gitweb?p=ocaml-relational.git;a=summary
>
> My question is the following: Relational.Conv_Postgresql.encode_int is
> properly defined, and available from the toplevel, and yet considered
> unbound in the camlp4-generated code.
>
> How can this be?
>
>
>> yziq...@seldon:~$ ocaml
>>         Objective Caml version 3.11.1
>>
>> # #use "topfind";;
>> - : unit = ()
>> Findlib has been successfully loaded. Additional directives:
>>   #require "package";;      to load a package
>>   #list;;                   to list the available packages
>>   #camlp4o;;                to load camlp4 (standard syntax)
>>   #camlp4r;;                to load camlp4 (revised syntax)
>>   #predicates "p,q,...";;   to set these predicates
>>   Topfind.reset();;         to force that packages will be reloaded
>>   #thread;;                 to enable threads
>>
>> - : unit = ()
>> # #thread;;
>> /usr/lib/ocaml/threads: added to search path
>> /usr/lib/ocaml/unix.cma: loaded
>> /usr/lib/ocaml/threads/threads.cma: loaded
>> # #camlp4o;;
>> /usr/lib/ocaml/dynlink.cma: loaded
>> /usr/lib/ocaml/camlp4: added to search path
>> /usr/lib/ocaml/camlp4/camlp4o.cma: loaded
>>      Camlp4 Parsing version 3.11.1
>>
>> # #require "relational.postgresql";;
>> /usr/lib/ocaml/pcre: added to search path
>> /usr/lib/ocaml/pcre/pcre.cma: loaded
>> /usr/lib/ocaml/netsys: added to search path
>> /usr/lib/ocaml/netsys/netsys.cma: loaded
>> /usr/lib/ocaml/netstring: added to search path
>> /usr/lib/ocaml/netstring/netstring.cma: loaded
>> /usr/lib/ocaml/netstring/netstring_mt.cmo: loaded
>> /usr/lib/ocaml/netstring/netstring_top.cmo: loaded
>> /usr/lib/ocaml/netstring/netaccel.cma: loaded
>> /usr/lib/ocaml/netstring/netaccel_link.cmo: loaded
>> /usr/lib/ocaml/relational: added to search path
>> /usr/lib/ocaml/relational/relational.cma: loaded
>> /usr/lib/ocaml/postgresql: added to search path
>> /usr/lib/ocaml/postgresql/postgresql.cma: loaded
>> /usr/lib/ocaml/relational/pa_relational.cmo: loaded
>> /usr/lib/ocaml/relational/pa_relational_postgresql.cmo: loaded
>> # TABLE user users COLUMN id SERIAL AUTO PRIMARY KEY END;;
>> Error: Unbound value Relational.Conv_Postgresql.encode_int
>> # module X = Relational.Conv_Postgresql;;
>> module X :
>>   sig
>>     val encode_string : string -> string
>>     val decode_string : string -> string
>>     val decode_bool : string -> bool
>>     val encode_bool : bool -> string
>>     val encode_int : int -> string
>>     val decode_int : string -> int
>>     val encode_float : float -> string
>>     val decode_float : string -> float
>>     val encode_nullable : ('a -> string) -> 'a option -> string
>>     val decode_timestamp : string -> float
>>     val decode_timestampz : string -> float
>>     val encode_timestamp : float -> string
>>     val encode_timestampz : float -> string
>>     val decode_time : string -> float
>>     val decode_timez : string -> float
>>     val encode_time : float -> string
>>     val encode_timez : float -> string
>>     val decode_date : string -> Relational.Types.date
>>     val encode_date : Relational.Types.date -> string
>>   end
>> # Relational.Conv_Postgresql.encode_int;;
>> - : int -> string = <fun>
>> #
>
> --
>       Guillaume Yziquel
> http://yziquel.homelinux.org/
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

Attachment: typeconv_module.diff
Description: Binary data

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to