| Author |
Message |
|
| Guest |
Posted: Sun Jul 13, 2008 11:50 am |
|
|
|
Guest
|
Hi,
I am having a frustrating time with the tutorial and I am not
experienced enough with Erlang to see what is happening.
I am trying out the models and this happens:
15> f().
ok
16> Cheer = category:find({title, '=', <<"Cheer">>}).
mysql_conn:426: fetch <<"SELECT * FROM category WHERE (title =
'Cheer')">> (id <0.59.0>)
[{category,false,1,<<"Cheer">>,
<<"kermit shouts: Appluase, Applause, Applause">>}]
17> E1 = entry:new(<<"Welcome to my new blog">>, <<"hello world, this
is my first Erlang App.">>, [], Cheer).
{entry,true,undefined,<<"Welcome to my new blog">>,
<<"hello world, this is my first Erlang App.">>,[],
[{category,false,1,<<"Cheer">>,
<<"kermit shouts: Appluase, Applause, Applause">>}]}
18> entry:save(E1).
mysql_conn:426: fetch <<"BEGIN">> (id <0.59.0>)
mysql_conn:426: fetch <<"ROLLBACK">> (id <0.59.0>)
** exception exit: {{'EXIT',
{badarg,
[{erlang,iolist_to_binary,
[{'EXIT',
{badarg,
[{erlang,list_to_binary,
[[39,
{category,false,1,<<"Cheer">>,
<<"kermit shout"...>>},
39]]},
{erlsql,encode,2},
{erlsql,'-make_list/2-fun-0-',3},
{lists,foldl,3},
{erlsql,make_list,2},
{erlsql,'-insert/3-fun-2-',1},
{erlsql,'-make_list/2-fun-0-',3},
{lists,foldl,3}]}}]},
{mysql_conn,do_query,5},
{erlydb_mysql,update,2},
{erlydb_base,'-do_save/1-fun-0-',4},
{mysql_conn,do_transaction,2},
{mysql_conn,loop,1}]}},
{rollback_result,{updated,{mysql_result,[],[],0,
[]}}}}
in function erlydb_base:do_save/1
in call from erlydb_base:hook/4
19>
Could someone give me a pointer on what is wrong and how to
investigate this sort of issue in future?
Thanks
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Thu Jul 24, 2008 6:56 pm |
|
|
|
Guest
|
The problem is this: for a many-one relation, ErlyWeb expects the id
of the related record to populate the value of the field, not the full
record itself. For example, if you set the category using
'entry:category(E1, Cheer)' only the id should be set. It seems from
your example that there's a bug in the generated constructor, which
doesn't behave like the generated setter for the related record. I'll
look into fixing it.
Sorry for the late reply. I was away on vacation until a few days ago.
Yariv
On Sun, Jul 13, 2008 at 4:49 AM, Tom <tom.ayerst@gmail.com> wrote:
>
> Hi,
>
> I am having a frustrating time with the tutorial and I am not
> experienced enough with Erlang to see what is happening.
>
> I am trying out the models and this happens:
>
> 15> f().
> ok
> 16> Cheer = category:find({title, '=', <<"Cheer">>}).
> mysql_conn:426: fetch <<"SELECT * FROM category WHERE (title =
> 'Cheer')">> (id <0.59.0>)
> [{category,false,1,<<"Cheer">>,
> <<"kermit shouts: Appluase, Applause, Applause">>}]
> 17> E1 = entry:new(<<"Welcome to my new blog">>, <<"hello world, this
> is my first Erlang App.">>, [], Cheer).
> {entry,true,undefined,<<"Welcome to my new blog">>,
> <<"hello world, this is my first Erlang App.">>,[],
> [{category,false,1,<<"Cheer">>,
> <<"kermit shouts: Appluase, Applause, Applause">>}]}
> 18> entry:save(E1).
> mysql_conn:426: fetch <<"BEGIN">> (id <0.59.0>)
> mysql_conn:426: fetch <<"ROLLBACK">> (id <0.59.0>)
> ** exception exit: {{'EXIT',
> {badarg,
> [{erlang,iolist_to_binary,
> [{'EXIT',
> {badarg,
> [{erlang,list_to_binary,
> [[39,
> {category,false,1,<<"Cheer">>,
> <<"kermit shout"...>>},
> 39]]},
> {erlsql,encode,2},
> {erlsql,'-make_list/2-fun-0-',3},
> {lists,foldl,3},
> {erlsql,make_list,2},
> {erlsql,'-insert/3-fun-2-',1},
> {erlsql,'-make_list/2-fun-0-',3},
> {lists,foldl,3}]}}]},
> {mysql_conn,do_query,5},
> {erlydb_mysql,update,2},
> {erlydb_base,'-do_save/1-fun-0-',4},
> {mysql_conn,do_transaction,2},
> {mysql_conn,loop,1}]}},
> {rollback_result,{updated,{mysql_result,[],[],0,
> []}}}}
> in function erlydb_base:do_save/1
> in call from erlydb_base:hook/4
> 19>
>
> Could someone give me a pointer on what is wrong and how to
> investigate this sort of issue in future?
>
> Thanks
>
> Tom
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|