|
Example
Hello world using tcerl.
Featured PrerequisitiesExample% erl
Erlang (BEAM) emulator version 5.6.5 [source] [smp:2] [async-threads:0] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1> tcerl:start ().
ok
2> mnesia:start ().
ok
3> mnesia:change_table_copy_type (schema, node (), disc_copies).
{atomic,ok}
4> mnesia:create_table (testtab, [ { type, { external, ordered_set, tcbdbtab } }, { external_copies, [ node () ] }, { user_properties, [ { deflate, true }, { bucket_array_size, 10000 } ] } ]).
{atomic,ok}
5> mnesia:table_info (testtab, type).
ordered_set
6> mnesia:dirty_write ({ testtab, hello, world }), mnesia:dirty_read (testtab, hello).
[{testtab,hello,world}]
7> f (), Start = now (), [ mnesia:dirty_write ({ testtab, N, N }) || N <- lists:seq (1, 100000) ], End = now (), timer:now_diff (End, Start).
5590639
8> {ok, Port} = tcbdbsrv:get_tab (testtab), tcbdbets:sync (Port).
ok
9>
User switch command
--> q
% ls -l Mnesia.nonode@nohost
total 1872
-rw-r--r-- 1 pmineiro admin 154 Jun 12 20:45 DECISION_TAB.LOG
-rw-r--r-- 1 pmineiro admin 48231 Jun 12 20:46 LATEST.LOG
-rw-r--r-- 1 pmineiro admin 9339 Jun 12 20:45 schema.DAT
-rw-r--r-- 1 pmineiro admin 892672 Jun 12 20:46 testtab.tcb
|
► Sign in to add a comment
If you shutdown Mnesia without flushing buffers it will not store all data on disk. It is good idea to sync a table with disk before leaving Erlang shell:
Port = mnesia_lib:val({testtab, tcbdb_port}), tcbdbets:sync(Port).
The 4th command did not work for me. Erlang says {aborted,{no_exists,{testtab,cstruct}}}
(erlang 5.6.3, mnesia 4.3.5ext2)
I encountered same error of "{aborted,{no_exists,{testtab,cstruct}}}".
As the two posts above I also got the error "{aborted,{no_exists,{testtab,cstruct}}}" at 4th command :(
My erlang installation directory is a custom one so I used the --prefix when I ran the ./configure. Before I start tcerl I make the command application:set_env(tcerl, tcerldrvprefix, CustomDir) so tcerl is able to load the driver. (Can the driver find tokyocabinet?)
What can be wrong?
My specs are: Debian Erlang/OTP R12B5? Mnesia 4.4.7 tcerl 1.3.1
I solved the issue above by recompiling tcbdbtab.erl and replaced the old .beam-file with the new one. After that it worked excellent.
In tcbdbtab.erl:
-include_lib ("mnesia/src/mnesia.hrl").The fixed path there might cause you problems. Remove the fixed path for mnesia.hrl if you see badrecord error.
I'm a beginner of tcerl. 1. Now, I have installed mnesiaex mnesia-4.4.7.6, tcerl-1.3.1e and tcerldrv-1.3.1e under FreeBSD 7.1(i386) 2. In the Erlang shell, I get the following results: Eshell V5.6.5 (abort with ^G) 1> application:set_env(tcerl, tcerldrvprefix, "/usr/local"). ok 2> tcerl:start().
INFO REPORT==== 5-Mar-2009::10:38:07
{error,{shutdown,{tcerl,start,[normal,]}}}
Can anybody help me?
Check if the environment variable tcerldrvprefix has been correctly set:
application:get_env(tcerl, tcerldrvprefix).
Hello! I need to know whether tcerl has support for any bag type?
When creating a new table with type bag there a {atomic,ok} in response. And adding items goes fine, in terms of that there are no errormessage, although retrieving them can't be done... Shouldn't it be an error message when creating a table with unsupported types?
Regards Rickard
As #1 post,krzysztof.klis, said:
The new command would be:
{ok, Port} = tcbdbsrv:get_tab(testtab), tcbdbets:sync(Port).
I found I had to
code:add_patha("/path_to/tcerl-1.3.1h/src").
Does that mean it didn't install properly or is that normal?