From 0633a666b1499386365571997a7cd5152cb98a80 Mon Sep 17 00:00:00 2001 From: Fredrik Noring <noring@nocrew.org> Date: Mon, 25 May 1998 01:08:24 +0200 Subject: [PATCH] More Yabu changes. Rev: tutorial/tutorial.wmml:1.84 --- tutorial/tutorial.wmml | 232 ++++++++++++++++++++++++++++++++++------- 1 file changed, 196 insertions(+), 36 deletions(-) diff --git a/tutorial/tutorial.wmml b/tutorial/tutorial.wmml index ee3daa8155..f1b71ef4ee 100644 --- a/tutorial/tutorial.wmml +++ b/tutorial/tutorial.wmml @@ -7310,6 +7310,10 @@ object t = ADT.Table.table( ({ ({ "Blixt", "Gordon" }), </example> </man_example> +<man_see> +ADT.Table.ASCII.encode +</man_see> + </method> <hr noshade size=1> @@ -7609,7 +7613,7 @@ rows in both tables must be equal. <hr noshade size=1> -<method name=ADT.Table.ASCII->encode title="produces an ASCII formated table"> +<method name=ADT.Table.ASCII.encode title="produces an ASCII formated table"> <man_syntax> string encode(object <i>table</i>, mapping|void <i>options</i>);<br> </man_syntax> @@ -7662,29 +7666,23 @@ write(.Table.ASCII.encode(t->select("frukt")->distinct("frukt")-> <module name=Yabu> <section title="Yabu"> -Yabu is an all purpose database, used to store data records associated with a +Yabu is a all purpose database, used to store data records associated with a unique key. Yabu is very similar to mappings, however, records are stored in files and not in memory. Also, Yabu features <i>tables</i>, which is a way to handle several mapping-like structures in the same database. A characteristic feature of Yabu is that it allows for -<i>transactions</i>. A transaction is a sequence of database manipulations +<i>transactions</i>. A transaction is a sequence of database commands that will be accepted in whole, or not at all.<p> -Alot of effort have been put to make sure that Yabu is crash safe. -This means that the database should survive process kills, core dumps -and such. Also, all non-commited and pending transactions will be -cancelled in case of a crash.<p> - -<man_note> -It is very important not to open the same a database more than -once at a time. Otherwise there will be conflicts and most likely -strange failures and unpredictable behaviours. Yabu does not check -weather a database is already open or not. -</man_note> +Some effort have been made to make sure that Yabu is crash safe. +This means that the database should survive process kills, core +dumps and such -- although this is not something that can absolutely +guaranteed. Also, all non-commited and pending transactions will +be cancelled in case of a crash.<p> <hr noshade size=1> -<method name=Yabu.db->create title="opens a Yabu database"> +<method name=Yabu.db->create title="Open a Yabu database"> <man_syntax> void create(string <i>directory</i>, string <i>mode</i>); </man_syntax> @@ -7695,7 +7693,7 @@ Create takes two arguments:<p> store its files. Yabu will create the directory if it does not exist, provided Yabu is opened in write and create mode (see below).<p> <li><i>mode</i> is a string specifying the mode in which Yabu will -operate. There are four switches available:<p> +operate. There are five switches available:<p> <blockquote> "r" - Read mode. No database entries can be altered and no files will be modified.<p> @@ -7703,11 +7701,20 @@ be modified.<p> only used togheter with write mode.<p> "w" - Write mode. The database can be altered and the files will be updates accordingly.<p> -"C" - Compress mode. Provided the <link to=Gz>Gz-module</link> is +"t" - Transaction mode. The database now allows transactions.<p> +"C" - Compress mode. Provided the <link to=Gz>Gz module</link> is available, all records will be compressed before stored on to disk.<p> </blockquote> </ol> </man_description> + +<man_note> +It is very important not to open the same a database more than +once at a time. Otherwise there will be conflicts and most likely +strange failures and unpredictable behaviours. Yabu does not check +weather a database is already open or not. +</man_note> + <man_example> <example language=pike> // Open a database in create/write mode. @@ -7720,11 +7727,21 @@ object db = Yabu.db("my.database", "r"); object db = Yabu.db("my.database", "cwC"); </example> </man_example> + +<man_see> +Yabu.db->table, +Yabu.db->`[], +Yabu.db->list_tables, +Yabu.db->_indices, +Yabu.db->sync, +Yabu.db->purge +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.db->table title="opens a table"> +<method name=Yabu.db->table title="Open a table"> <man_syntax> object(table) table(string <i>table_name</i>);<br> </man_syntax> @@ -7732,33 +7749,80 @@ object(table) table(string <i>table_name</i>);<br> This method opens a table with <i>table_name</i>. If the table does not exist, it will be created. A table object will be returned. </man_description> + +<man_see> +Yabu.db->`[], +Yabu.db->list_tables, +Yabu.db->_indices, +Yabu.db->sync, +Yabu.db->purge +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.db->`[] title="opens a table"> +<method name=Yabu.db->`[] title="Open a table"> <man_syntax> object(table) `[](string <i>table_name</i>);<br> </man_syntax> <man_description> -Synonymous with <link to=Yabu.db.table>table</link>. +Synonymous with <link to=Yabu.db.table>Yabu.table->table</link>. </man_description> + +<man_see> +Yabu.db->table, +Yabu.db->list_tables, +Yabu.db->_indices, +Yabu.db->sync, +Yabu.db->purge +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.db->_indices title="lists all tables"> +<method name=Yabu.db->list_tables title="List all tables"> <man_syntax> -array(string) _indices();<br> +array(string) list_tables();<br> </man_syntax> <man_description> This method lists all available tables. </man_description> + +<man_see> +Yabu.db->table, +Yabu.db->`[], +Yabu.db->_indices, +Yabu.db->sync, +Yabu.db->purge +</man_see> + +</method> + +<hr noshade size=1> + +<method name=Yabu.db->_indices title="List all tables"> +<man_syntax> +array(string) _indices();<br> +</man_syntax> +<man_description> +Synonymous with <link to=Yabu.table.set>Yabu.table->list_tables</link>. +</man_description> + +<man_see> +Yabu.db->table, +Yabu.db->`[], +Yabu.db->list_tables, +Yabu.db->sync, +Yabu.db->purge +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.db->sync title="synchronizes the database"> +<method name=Yabu.db->sync title="Synchronize database"> <man_syntax> void sync();<br> </man_syntax> @@ -7768,22 +7832,40 @@ about the database in memory for performance reasons. Syncing is recommended when one wants the information on disk to be updated with the current information in memory. </man_description> + +<man_see> +Yabu.db->table, +Yabu.db->`[], +Yabu.db->list_tables, +Yabu.db->_indices, +Yabu.db->purge +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.db->purge title="deletes the database"> +<method name=Yabu.db->purge title="Delete database"> <man_syntax> void purge();<br> </man_syntax> <man_description> This method deletes the whole database and all database files stored on disk. </man_description> + +<man_see> +Yabu.db->table, +Yabu.db->`[], +Yabu.db->list_tables, +Yabu.db->_indices, +Yabu.db->sync +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->set title="stores a record in the table"> +<method name=Yabu.table->set title="Store a record in a table"> <man_syntax> mixed set(string key, mixed data);<br> </man_syntax> @@ -7792,21 +7874,35 @@ This method stores the contents of <i>data</i> as a record with the name <i>key</i>. If a record with that name already exists, it will be replaced. Records can only be added to the database in write mode. </man_description> + +<man_see> +Yabu.table->get, +Yabu.table->delete, +Yabu.table->list_keys +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->`[]= title="stores a record in the table"> +<method name=Yabu.table->`[]= title="Store a record in a table"> <man_syntax> mixed `[]=(string key, mixed data);<br> </man_syntax> <man_description> -Synonymous with <link to=Yabu.table.set>set</link>. +Synonymous with <link to=Yabu.table.set>Yabu.table->set</link>. </man_description> + +<man_see> +Yabu.table->get, +Yabu.table->delete, +Yabu.table->list_keys +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->get title="fetch a record in the table"> +<method name=Yabu.table->get title="Fetch a record from a table"> <man_syntax> mixed get(string key);<br> </man_syntax> @@ -7814,44 +7910,90 @@ mixed get(string key);<br> This method fetches the data associated with the record name <i>key</i>. If a record does not exist, zero is returned. </man_description> + +<man_see> +Yabu.table->set, +Yabu.table->delete, +Yabu.table->list_keys +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->`[] title="fetch a record in the table"> +<method name=Yabu.table->`[] title="Fetch a record from a table"> <man_syntax> mixed `[](string key);<br> </man_syntax> <man_description> -Synonymous with <link to=Yabu.table.get>get</link>. +Synonymous with <link to=Yabu.table.get>Yabu.table->get</link>. </man_description> + +<man_see> +Yabu.table->set, +Yabu.table->delete, +Yabu.table->list_keys +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->list_keys title="lists the records in the table"> +<method name=Yabu.table->list_keys title="List the records in a table"> <man_syntax> array(string) list_keys();<br> </man_syntax> <man_description> This method lists all record names in the table. </man_description> + +<man_see> +Yabu.table->set, +Yabu.table->get, +Yabu.table->delete +</man_see> + +</method> + +<hr noshade size=1> + +<method name=Yabu.table->_indices title="List the records in a table"> +<man_syntax> +array(string) _indices();<br> +</man_syntax> +<man_description> +Synonymous with <link to=Yabu.table.get>Yabu.table->list_keys</link>. +</man_description> + +<man_see> +Yabu.table->set, +Yabu.table->get, +Yabu.table->delete +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->delete title="deletes a record from a table"> +<method name=Yabu.table->delete title="Delete a record in a table"> <man_syntax> void delete(string <i>key</i>);<br> </man_syntax> <man_description> This method deletes the record with the name <i>key</i>. </man_description> + +<man_see> +Yabu.table->set, +Yabu.table->get, +Yabu.table->list_keys +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.table->purge title="deletes a table"> +<method name=Yabu.table->purge title="Delete a table"> <man_syntax> void purge();<br> </man_syntax> @@ -7862,7 +8004,7 @@ This method deletes the whole table and the table files on disk. <hr noshade size=1> -<method name=Yabu.table->transaction title="begins a transaction"> +<method name=Yabu.table->transaction title="Begin a transaction"> <man_syntax> object(transaction) transaction();<br> </man_syntax> @@ -7879,11 +8021,17 @@ before the transaction is commited, a conflict will arise upon commit. A transaction can be cancelled using <link to=Yabu.transaction.rollback> rollback</link>. </man_description> + +<man_see> +Yabu.transaction->commit, +Yabu.transaction->rollback +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.transaction->commit title="commits a transaction"> +<method name=Yabu.transaction->commit title="Commit a transaction"> <man_syntax> void commit();<br> </man_syntax> @@ -7892,11 +8040,17 @@ This method commits the changes made in a transaction. If a record affected by the transaction is altered during the transaction, a conflict will arise and an error is thrown. </man_description> + +<man_see> +Yabu.table->transaction, +Yabu.transaction->rollback +</man_see> + </method> <hr noshade size=1> -<method name=Yabu.transaction->rollback title="rollbacks a transaction"> +<method name=Yabu.transaction->rollback title="Rollback a transaction"> <man_syntax> void rollback();<br> </man_syntax> @@ -7904,6 +8058,12 @@ void rollback();<br> This method cancels a transaction. All changes made in the transaction are lost. </man_description> + +<man_see> +Yabu.table->transaction, +Yabu.transaction->commit +</man_see> + </method> </section> -- GitLab