1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>NoSQL: Frequently Asked Questions (FAQ)</TITLE>
<LINK HREF="NoSQL-13.html" REL=next>
<LINK HREF="NoSQL-11.html" REL=previous>
<LINK HREF="NoSQL.html#toc12" REL=contents>
</HEAD>
<BODY BGCOLOR="#fff0e0">
<A HREF="NoSQL-13.html">Next</A>
<A HREF="NoSQL-11.html">Previous</A>
<A HREF="NoSQL.html#toc12">Contents</A>
<HR>
<H2><A NAME="s12">12. Frequently Asked Questions (FAQ)</A> </H2>
<P>
<UL>
<LI><B>Q1:</B> How do I modify existing tables ?
<P><B>A1:</B> There are several ways:
<P>
<UL>
<LI>Do it manually with the 'edittable' operator.
<P>
</LI>
<LI>Simply append the new record(s) (table2) to the old table
(table1):
<BLOCKQUOTE><CODE>
<PRE>
tail +3 < table2 >> table1
</PRE>
</CODE></BLOCKQUOTE>
<P>
</LI>
<LI>On large, indexed tables you can apply the changes
to a smaller journalling table (edit buffer) and then use
the 'update' operator. See
section
<A HREF="NoSQL-5.html#sec-bigtables">Big tables</A> for more details
on this method.
<P>
</LI>
<LI>Use the old table header to build a valid new record, modify
the fields of the latter and write the modified table back to
disk:
<BLOCKQUOTE><CODE>
<PRE>
addrow < table |
compute 'Column1="value1"; Column2="value2"; ...' > table.tmp
mv table.tmp table
</PRE>
</CODE></BLOCKQUOTE>
<P>
</LI>
<LI>Use the 'row' operator
to select only those records that you want to retain:
<BLOCKQUOTE><CODE>
<PRE>
row 'selection expression' < table > table.tmp
mv table.tmp table
</PRE>
</CODE></BLOCKQUOTE>
<P>
</LI>
<LI>Use the 'update' operator. The two
tables are assumed to have the respective primary key fields
in their leftmost columns.</LI>
</UL>
<P>
</LI>
<LI><B>Q2:</B> Will NoSQL ever provide record-level locking and update
facilities ?
<P><B>A2:</B> This is currently 'not on the cards'. NoSQL assumes that
the tables are collections of variable-length records. Record-level
update requires fixed-length records. It can be implemented
by right-padding the records with blanks to 'make room' for
updates, but that is a bit of a kludge, IMHO. If you need such
facilities you should rather use
<A HREF="http://www.rdb.com">/rdb</A>, or resort to
a more usual SQL DBMS, either free or commercial. I prefer the
solution outlined in
section
<A HREF="NoSQL-5.html#sec-bigtables">Big tables</A>.
</LI>
</UL>
<HR>
<A HREF="NoSQL-13.html">Next</A>
<A HREF="NoSQL-11.html">Previous</A>
<A HREF="NoSQL.html#toc12">Contents</A>
</BODY>
</HTML>
|