> I'm trying to get the postgresql interface working.  I can't seem to
> find too much on details on how to use it.  In looking through the
> code, I see erlydb:start(psql) does not exist for a match, so I get a
> driver_not_supported error.  I see I can manually do the
> application:start for this, but should I?

The erlydb support for Postgres is terrible, bad enough that I've  
stopped my attempt to migrate to it from mnesia and am going back. The  
in-between state is a frustrating one, and is the primary reason that  
development of my application has stagnated. Error messages are non- 
existent or misleading, and the usual result of doing something,  
anything, wrong is a hang on starting psql or on the first erlydb  
access.

That said, here's how I got it to work. I have a wrotit.app (whose  
contents aren't important), and then I start wrotit with  
application:start(wrotit), and the following:

------- psql.app -------
{application,
  psql, [
         {description, "psql $Rev$"},
         {vsn, "0.0.2"},
         {registered, [psql_sup]},
         {applications, [kernel, stdlib]},
         {mod, {psql, []}},
         {env, [{erlydb_psql, {"localhost",
                               5432,
                               "wrotit", "password",
                               "wrotit_db"}},
                {pools, [{erlydb_psql, 5}]}]}
        ]}.

------- wrotit.erl -------

-module(wrotit).
-behavior(application).

-export([start/2, start/0,
          stop/1,
          compile/0, compile/1]).

-compile(export_all).

start() -> start([],[]).
start(_Type, _Args) ->
   %% compile first (if nothing else, this at least loads in my
   %% modules)
   compile(),

   %% bring up yaws (doesn't appear in my supervisor hierarchy)
   wrotit_init:start_yaws(),

   %% bring up psql, required by erlydb_psql
   start_psql_driver(),

   %% my main supervisor will be returned
   wrotit_supervisor:start_link().

start_psql_driver() ->
   case is_loaded(psql) of
     true ->
       ok;
     false ->
       application:start(psql)
   end.

is_loaded(App) ->
   lists:keymember(App,1,application:which_applications()).

stop(_State) ->
   ok=yaws:stop(),
   ok=psql:stop(),
   ok.

compile() ->
   compile([]).
compile(ExtraOptions) ->
   %% read in wrotit.app
   application:load(wrotit),
   start_psql_driver(),
   Options=[native,
            debug_info,
            {erlydb_driver,psql},
            {auto_compile,wrotit_config:dev_mode()},
            {i,wrotit_config:yaws_include()},
            {allow_unsafe_statements,true},
            {last_compile_time,auto}] ++ ExtraOptions,
   code:add_paths([wrotit_config:yaws_ebin(),
                   wrotit_config:erlyweb_ebin(),
                   wrotit_config:plists_ebin()]),
   erlyweb:compile(wrotit_config:appdir(),Options).


--~--~---------~--~----~------------~-------~--~----~
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