KirbyBase 2.6 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README +65 -67
  2. data/bin/kbserver.rb +18 -18
  3. data/changes.txt +144 -137
  4. data/examples/aaa_try_this_first/kbtest.rb +237 -237
  5. data/examples/add_column_test/add_column_test.rb +27 -27
  6. data/examples/calculated_field_test/calculated_field_test.rb +51 -51
  7. data/examples/change_column_type_test/change_column_type_test.rb +25 -25
  8. data/examples/column_required_test/column_required_test.rb +44 -44
  9. data/examples/crosstab_test/crosstab_test.rb +100 -100
  10. data/examples/csv_import_test/csv_import_test.rb +31 -31
  11. data/examples/csv_import_test/plane.csv +11 -11
  12. data/examples/default_value_test/default_value_test.rb +54 -54
  13. data/examples/drop_column_test/drop_column_test.rb +24 -24
  14. data/examples/indexes_test/add_index_test.rb +46 -46
  15. data/examples/indexes_test/drop_index_test.rb +65 -65
  16. data/examples/indexes_test/index_test.rb +94 -94
  17. data/examples/kbserver_as_win32_service/kbserver_daemon.rb +47 -47
  18. data/examples/kbserver_as_win32_service/kbserverctl.rb +75 -75
  19. data/examples/link_many_test/link_many_test.rb +70 -70
  20. data/examples/lookup_field_test/lookup_field_test.rb +55 -55
  21. data/examples/lookup_field_test/lookup_field_test_2.rb +62 -62
  22. data/examples/lookup_field_test/the_hal_fulton_feature_test.rb +69 -69
  23. data/examples/many_to_many_test/many_to_many_test.rb +65 -65
  24. data/examples/memo_test/memo_test.rb +74 -74
  25. data/examples/record_class_test/record_class_test.rb +77 -77
  26. data/examples/record_class_test/record_class_test2.rb +31 -31
  27. data/examples/rename_column_test/rename_column_test.rb +45 -45
  28. data/examples/rename_table_test/rename_table_test.rb +38 -38
  29. data/examples/yaml_field_test/yaml_field_test.rb +47 -47
  30. data/kirbybaserubymanual.html +2324 -2324
  31. data/lib/kirbybase.rb +3907 -3880
  32. data/test/tc_local_table.rb +108 -108
  33. metadata +56 -54
data/README CHANGED
@@ -1,67 +1,65 @@
1
- = KirbyBase 2.6
2
-
3
- A small, plain-text, dbms written in Ruby. It can be used either embedded
4
- or client/server.
5
-
6
-
7
- == Installation
8
-
9
- Unpack the file you downloaded. Execute "ruby install.rb" or simply make
10
- sure kirbybase.rb is somewhere in your Ruby library path.
11
-
12
-
13
- == Documentation
14
-
15
- Documentation is in kirbybaserubymanual.html. Also, RDoc generated
16
- documentation is in the doc directory.
17
-
18
- See the examples directory for examples of how to use KirbyBase.
19
-
20
-
21
- == Manifest
22
-
23
- * README - this file
24
- * install.rb - install script
25
- * changes.txt - history of changes.
26
- * kirbybaserubymanual.html - documentation
27
- * lib/kirbybase.rb - dbms library
28
- * bin/kbserver.rb - multi-threaded database server script.
29
- * test directory - unit tests
30
- * examples directory - many example scripts demonstrating features.
31
- * images directory - images used in manual.
32
-
33
-
34
- == Author
35
-
36
- Written in 2005 by Jamey Cribbs <mailto:jcribbs@twmi.rr.com>
37
-
38
-
39
- == License
40
-
41
- KirbyBase is distributed under the same license as Ruby.
42
-
43
- Copyright (c) 2005 Jamey Cribbs
44
-
45
-
46
-
47
- == Warranty
48
-
49
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
54
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
55
- IN THE SOFTWARE.
56
-
57
-
58
- == Feedback
59
-
60
- Please send any bug reports, suggestions, ideas,
61
- improvements, to:
62
-
63
- jcribbs@netpromi.com
64
-
65
- == Home Page
66
-
67
- http://www.netpromi.com/kirbybase_ruby.html
1
+ = KirbyBase 2.7
2
+
3
+ A small, NoSQL, plain-text, dbms written in Ruby. It can be used either embedded
4
+ or client/server.
5
+
6
+
7
+ == Installation
8
+ You can install Kirbybase via ruby gems:
9
+ gem install KirbyBase
10
+
11
+
12
+ == Documentation
13
+
14
+ Documentation is in kirbybaserubymanual.html. Also, RDoc generated
15
+ documentation is in the doc directory.
16
+
17
+ See the examples directory for examples of how to use KirbyBase.
18
+
19
+
20
+ == Manifest
21
+
22
+ * README - this file
23
+ * install.rb - install script
24
+ * changes.txt - history of changes.
25
+ * kirbybaserubymanual.html - documentation
26
+ * lib/kirbybase.rb - dbms library
27
+ * bin/kbserver.rb - multi-threaded database server script.
28
+ * test directory - unit tests
29
+ * examples directory - many example scripts demonstrating features.
30
+ * images directory - images used in manual.
31
+
32
+
33
+ == Author
34
+
35
+ Written in 2005 by Jamey Cribbs <mailto:jcribbs@twmi.rr.com>
36
+ version 2.7 release & maintenance by gurugeek
37
+
38
+ == License
39
+
40
+ KirbyBase is distributed under the same license as Ruby.
41
+
42
+ Copyright (c) 2005 Jamey Cribbs
43
+
44
+
45
+
46
+ == Warranty
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
53
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
54
+ IN THE SOFTWARE.
55
+
56
+
57
+ == Feedback
58
+
59
+ Please send any bug reports, suggestions, ideas,
60
+ improvements through the github repository
61
+ https://github.com/gurugeek/KirbyBase
62
+
63
+ == Home Page
64
+
65
+ http://www.netpromi.com/kirbybase_ruby.html
@@ -1,18 +1,18 @@
1
- # Multi-user server script for KirbyBase.
2
-
3
- require 'kirbybase'
4
- require 'drb'
5
-
6
- host = ''
7
- port = 44444
8
-
9
- puts 'Initializing database server and indexes...'
10
-
11
- # Create an instance of the database.
12
- db = KirbyBase.new(:server)
13
-
14
- DRb.start_service('druby://:44444', db)
15
-
16
- puts 'Server ready to receive connections...'
17
-
18
- DRb.thread.join
1
+ # Multi-user server script for KirbyBase.
2
+
3
+ require 'kirbybase'
4
+ require 'drb'
5
+
6
+ host = ''
7
+ port = 44444
8
+
9
+ puts 'Initializing database server and indexes...'
10
+
11
+ # Create an instance of the database.
12
+ db = KirbyBase.new(:server)
13
+
14
+ DRb.start_service('druby://:44444', db)
15
+
16
+ puts 'Server ready to receive connections...'
17
+
18
+ DRb.thread.join
@@ -1,144 +1,151 @@
1
- 2006-06-27:: Version 2.6
2
- * Removed NilClass#method_missing. I have replaced it with a new class
3
- called KBNilClass. Thanks to a host of people for help on this,
4
- including: Assaph Mehr, James Edward Gray II, Matthew Desmarais,
5
- Logan Capaldo, Trans, John Carter, Dave Burt and anyone else I missed.
6
- * Added conditional require logic so that KirbyBase will use FasterCVS if
7
- it is available. Thanks to James Edward Gray II for this.
1
+ 2012-04-16:: Version 2.7
2
+ * Adapted to work with both Ruby 1.9 and Ruby 1.8 including fixed to_report
3
+ (thanks to manveru for the help).
4
+ * Added an example on how to use KirbyBase with Camping (ruby microframework)
5
+ * This is mainly a maintenance relese. Please report any issue to
6
+ https://github.com/gurugeek/KirbyBase
7
+
8
+ 2006-06-27:: Version 2.6
9
+ * Removed NilClass#method_missing. I have replaced it with a new class
10
+ called KBNilClass. Thanks to a host of people for help on this,
11
+ including: Assaph Mehr, James Edward Gray II, Matthew Desmarais,
12
+ Logan Capaldo, Trans, John Carter, Dave Burt and anyone else I missed.
13
+ * Added conditional require logic so that KirbyBase will use FasterCVS if
14
+ it is available. Thanks to James Edward Gray II for this.
8
15
  * You can now delay index creation in local mode. Thanks to Nicholas Rahn
9
16
  for this.
10
17
  * Added ability to allow for a custom record class with no kb_create or
11
18
  kb_defaults methods. KirbyBase will return each result record as an
12
19
  instance of the custom record class, and will attempt to set attributes
13
20
  with the same names as the table's field names equal to the values of
14
- the table record's fields. Thanks to Hal Fulton for this idea.
21
+ the table record's fields. Thanks to Hal Fulton for this idea.
22
+
23
+ 2005-12-30:: Version 2.5.2
24
+ * Changed the behavior of KBTable#insert method. If user specifies nil
25
+ for a field value and there is a default value for that field, the
26
+ default value will no longer override the user specified nil value.
27
+ Thanks to Assaph Mehr for suggesting this.
28
+
29
+ 2005-12-28:: Version 2.5.1
30
+ * Fixed a bug that had broken encrypted tables.
31
+ * Changed KBTable#pack method so that it raises an error if trying to
32
+ execute when :connect_type==:client.
33
+ * Fixed a bug where it was possible to insert records missing a required
34
+ field if using a hash. Thanks to Adam Shelly for this.
35
+ * Fixed a bug that occurred when you tried to update records using a
36
+ block and you tried to reference a field in the current record inside
37
+ the block. Much thanks to Assaph Mehr for reporting this.
38
+ * Fixed a bug that allowed you to have duplicate column names. Thanks to
39
+ Assaph Mehr for spotting this.
40
+ * Changed the way KBTable#set works with memo/blob fields.
41
+ * Started creating unit tests.
42
+ * Changed the KBTable#clear method to return number of records deleted.
43
+ Thanks to Assaph Mehr for this enhancement.
44
+ * Moved #build_header_string from KBEngine class to KirbyBase class.
45
+ * Added KirbyBase::VERSION constant.
46
+
47
+ 2005-12-01:: Version 2.5
48
+ * Fixed a subtle bug in KBTable#create_indexes.
49
+ * Added the following new methods to KBTable: add_index, drop_index,
50
+ rename_column, change_column_type, change_column_default_value, and
51
+ change_column_required.
52
+ * Added the ability to specify a default column value at table creation
53
+ time.
54
+ * Added the ability to specify, at table creation time, that a column value
55
+ is required when inserting or updating records.
56
+ * Removed #add_table_column and #drop_table_column from KirbyBase class
57
+ and added #add_column and #drop_column to KBTable class. I felt like
58
+ it made more sense to have these methods in the table's class rather
59
+ than the database's class.
60
+ * Added KirbyBase#rename_table method.
61
+ * Added the ability to, upon database initialization, specify that index
62
+ creation should not happen until a table is actually opened. This
63
+ speeds up database initialization at the cost of slower table
64
+ initialization later.
65
+
66
+ 2005-11-13:: Version 2.4
67
+ * Added a new column type: :Time. Thanks to George Moschovitis for coding
68
+ this enhancement.
69
+ * Added more functionality to Memo and Blob fields. They are no longer
70
+ just read-only. You can now also write to them from KirbyBase. The
71
+ interface for Memo and Blob fields has changed because of this.
72
+ * Added the ability to specify, when you initialize a database connection,
73
+ a base directory where memo/blob fields will be stored.
74
+ * Changed the way indexes are handled by KBTable in client/server mode.
75
+ Now, when KBTable grabs an index from KBEngine, it will hold onto it and
76
+ re-use it unless it has been modified since the last time it grabbed it.
77
+ This speeds up subsequent queries on the same index.
78
+ * Removed the restriction that the child table had to exist before you
79
+ could define a Link_many field in #create_table. I did this so that
80
+ it would possible to now define many-to-many links. See the example in
81
+ the distribution. This also goes for Lookup fields.
82
+ * Added two sample scripts: kbserverctl.rb and kbserver_daemon.rb, that
83
+ show how to set up a KirbyBase server process as a Windows Service.
84
+ Thanks to Daniel Berger for his excellent package, win32-service.
85
+ * Thouroughly revised the manual. I used the excellent text document
86
+ formatter, AsciiDoc. Many thanks to Stuart Rackham for developing this
87
+ great tool.
88
+ * Fixed a bug in KBTable#clear that was causing the recno counter not to
89
+ be reset. Thanks to basi for this.
90
+
91
+ 2005-10-10:: Version 2.3
92
+ * Added ability to specify lookup fields.
93
+ * Added ability to specify one-to-many links between tables.
94
+ * Added ability to specify calculated fields in tables.
95
+ * Added Memo and Blob field types.
96
+ * Added YAML field type. Many thanks to Logan Capaldo for this idea!
97
+ * Added indexing to speed up queries.
98
+ * Two new methods: #add_table_column and #drop_table_column.
99
+ * Added the ability to designate a table field as the "key" field, for
100
+ Lookup purposes. This simply makes it easier to define Lookup fields.
101
+ * Added "crosstab" capabilities to KBResultSet.
102
+
103
+ 2005-08-09:: Version 2.2.1
104
+ * Fixed a bug in with_write_lock. Thanks to Zed A. Shaw for this bugfix.
105
+ * Fixed a bug that occurred if @record_class was a nested class. Thanks
106
+ to Hal Fulton for this bugfix.
107
+
108
+ 2005-05-02:: Version 2.2
109
+ * By far the biggest change in this version is that I have completely
110
+ redesigned the internal structure of the database code. Because the
111
+ KirbyBase and KBTable classes were too tightly coupled, I have created
112
+ a KBEngine class and moved all low-level I/O logic and locking logic
113
+ to this class. This allowed me to restructure the KirbyBase class to
114
+ remove all of the methods that should have been private, but couldn't be
115
+ because of the coupling to KBTable. In addition, it has allowed me to
116
+ take all of the low-level code that should not have been in the KBTable
117
+ class and put it where it belongs, as part of the underlying engine. I
118
+ feel that the design of KirbyBase is much cleaner now. No changes were
119
+ made to the class interfaces, so you should not have to change any of
120
+ your code.
121
+ * Changed str_to_date and str_to_datetime to use Date#parse method.
122
+ Thanks to Emiel van de Laar for this enhancement.
123
+ * Changed #pack method so that it no longer reads the whole file into
124
+ memory while packing it.
125
+ Thanks to Hugh Sasse for reporting this bug.
126
+ * Changed code so that special character sequences like &linefeed; can be
127
+ part of input data and KirbyBase will not interpret it as special
128
+ characters.
129
+ Thanks to Hugh Sasse for this bug fix.
130
+
131
+ 2005-04-11:: Version 2.1
132
+ * Changed the interface to KirbyBase#new and KirbyBase#create_table. You
133
+ now specify arguments via a code block or as part of the argument list.
134
+ * Added the ability to specify a class at table creation time.
135
+ Thereafter, whenever you do a #select, the result set will be an array
136
+ of instances of that class, instead of instances of Struct. You can
137
+ also use instances of this class as the argument to #insert, #update,
138
+ #set.
139
+ * Added the ability to encrypt a table so that it is no longer stored as
140
+ a plain-text file.
141
+ * Added the ability to explicity specify that you want a result set to be
142
+ sorted in ascending order.
143
+ * Added the ability to import a csv file into an existing table.
144
+ * Added the ability to select a record as if the table were a Hash with
145
+ it's key being the recno field.
146
+ * Added the ability to update a record as if the table were a Hash with
147
+ it's key being the recno field.
15
148
 
16
- 2005-12-30:: Version 2.5.2
17
- * Changed the behavior of KBTable#insert method. If user specifies nil
18
- for a field value and there is a default value for that field, the
19
- default value will no longer override the user specified nil value.
20
- Thanks to Assaph Mehr for suggesting this.
21
-
22
- 2005-12-28:: Version 2.5.1
23
- * Fixed a bug that had broken encrypted tables.
24
- * Changed KBTable#pack method so that it raises an error if trying to
25
- execute when :connect_type==:client.
26
- * Fixed a bug where it was possible to insert records missing a required
27
- field if using a hash. Thanks to Adam Shelly for this.
28
- * Fixed a bug that occurred when you tried to update records using a
29
- block and you tried to reference a field in the current record inside
30
- the block. Much thanks to Assaph Mehr for reporting this.
31
- * Fixed a bug that allowed you to have duplicate column names. Thanks to
32
- Assaph Mehr for spotting this.
33
- * Changed the way KBTable#set works with memo/blob fields.
34
- * Started creating unit tests.
35
- * Changed the KBTable#clear method to return number of records deleted.
36
- Thanks to Assaph Mehr for this enhancement.
37
- * Moved #build_header_string from KBEngine class to KirbyBase class.
38
- * Added KirbyBase::VERSION constant.
39
-
40
- 2005-12-01:: Version 2.5
41
- * Fixed a subtle bug in KBTable#create_indexes.
42
- * Added the following new methods to KBTable: add_index, drop_index,
43
- rename_column, change_column_type, change_column_default_value, and
44
- change_column_required.
45
- * Added the ability to specify a default column value at table creation
46
- time.
47
- * Added the ability to specify, at table creation time, that a column value
48
- is required when inserting or updating records.
49
- * Removed #add_table_column and #drop_table_column from KirbyBase class
50
- and added #add_column and #drop_column to KBTable class. I felt like
51
- it made more sense to have these methods in the table's class rather
52
- than the database's class.
53
- * Added KirbyBase#rename_table method.
54
- * Added the ability to, upon database initialization, specify that index
55
- creation should not happen until a table is actually opened. This
56
- speeds up database initialization at the cost of slower table
57
- initialization later.
58
-
59
- 2005-11-13:: Version 2.4
60
- * Added a new column type: :Time. Thanks to George Moschovitis for coding
61
- this enhancement.
62
- * Added more functionality to Memo and Blob fields. They are no longer
63
- just read-only. You can now also write to them from KirbyBase. The
64
- interface for Memo and Blob fields has changed because of this.
65
- * Added the ability to specify, when you initialize a database connection,
66
- a base directory where memo/blob fields will be stored.
67
- * Changed the way indexes are handled by KBTable in client/server mode.
68
- Now, when KBTable grabs an index from KBEngine, it will hold onto it and
69
- re-use it unless it has been modified since the last time it grabbed it.
70
- This speeds up subsequent queries on the same index.
71
- * Removed the restriction that the child table had to exist before you
72
- could define a Link_many field in #create_table. I did this so that
73
- it would possible to now define many-to-many links. See the example in
74
- the distribution. This also goes for Lookup fields.
75
- * Added two sample scripts: kbserverctl.rb and kbserver_daemon.rb, that
76
- show how to set up a KirbyBase server process as a Windows Service.
77
- Thanks to Daniel Berger for his excellent package, win32-service.
78
- * Thouroughly revised the manual. I used the excellent text document
79
- formatter, AsciiDoc. Many thanks to Stuart Rackham for developing this
80
- great tool.
81
- * Fixed a bug in KBTable#clear that was causing the recno counter not to
82
- be reset. Thanks to basi for this.
83
-
84
- 2005-10-10:: Version 2.3
85
- * Added ability to specify lookup fields.
86
- * Added ability to specify one-to-many links between tables.
87
- * Added ability to specify calculated fields in tables.
88
- * Added Memo and Blob field types.
89
- * Added YAML field type. Many thanks to Logan Capaldo for this idea!
90
- * Added indexing to speed up queries.
91
- * Two new methods: #add_table_column and #drop_table_column.
92
- * Added the ability to designate a table field as the "key" field, for
93
- Lookup purposes. This simply makes it easier to define Lookup fields.
94
- * Added "crosstab" capabilities to KBResultSet.
95
-
96
- 2005-08-09:: Version 2.2.1
97
- * Fixed a bug in with_write_lock. Thanks to Zed A. Shaw for this bugfix.
98
- * Fixed a bug that occurred if @record_class was a nested class. Thanks
99
- to Hal Fulton for this bugfix.
100
-
101
- 2005-05-02:: Version 2.2
102
- * By far the biggest change in this version is that I have completely
103
- redesigned the internal structure of the database code. Because the
104
- KirbyBase and KBTable classes were too tightly coupled, I have created
105
- a KBEngine class and moved all low-level I/O logic and locking logic
106
- to this class. This allowed me to restructure the KirbyBase class to
107
- remove all of the methods that should have been private, but couldn't be
108
- because of the coupling to KBTable. In addition, it has allowed me to
109
- take all of the low-level code that should not have been in the KBTable
110
- class and put it where it belongs, as part of the underlying engine. I
111
- feel that the design of KirbyBase is much cleaner now. No changes were
112
- made to the class interfaces, so you should not have to change any of
113
- your code.
114
- * Changed str_to_date and str_to_datetime to use Date#parse method.
115
- Thanks to Emiel van de Laar for this enhancement.
116
- * Changed #pack method so that it no longer reads the whole file into
117
- memory while packing it.
118
- Thanks to Hugh Sasse for reporting this bug.
119
- * Changed code so that special character sequences like &linefeed; can be
120
- part of input data and KirbyBase will not interpret it as special
121
- characters.
122
- Thanks to Hugh Sasse for this bug fix.
123
-
124
- 2005-04-11:: Version 2.1
125
- * Changed the interface to KirbyBase#new and KirbyBase#create_table. You
126
- now specify arguments via a code block or as part of the argument list.
127
- * Added the ability to specify a class at table creation time.
128
- Thereafter, whenever you do a #select, the result set will be an array
129
- of instances of that class, instead of instances of Struct. You can
130
- also use instances of this class as the argument to #insert, #update,
131
- #set.
132
- * Added the ability to encrypt a table so that it is no longer stored as
133
- a plain-text file.
134
- * Added the ability to explicity specify that you want a result set to be
135
- sorted in ascending order.
136
- * Added the ability to import a csv file into an existing table.
137
- * Added the ability to select a record as if the table were a Hash with
138
- it's key being the recno field.
139
- * Added the ability to update a record as if the table were a Hash with
140
- it's key being the recno field.
141
-
142
- 2005-03-28:: Version 2.0
143
- * New version with completely new interface. A huge thanks to Hal Fulton
144
- for all of his help with this new version.
149
+ 2005-03-28:: Version 2.0
150
+ * New version with completely new interface. A huge thanks to Hal Fulton
151
+ for all of his help with this new version.