dbf 4.1.3 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +166 -104
- data/Gemfile +1 -0
- data/Gemfile.lock +63 -52
- data/LICENSE +1 -1
- data/README.md +110 -16
- data/bin/dbf +2 -0
- data/docs/CNAME +1 -0
- data/docs/DBF.html +200 -0
- data/docs/DBF/Column.html +947 -0
- data/docs/DBF/Column/LengthError.html +124 -0
- data/docs/DBF/Column/NameError.html +124 -0
- data/docs/DBF/ColumnType.html +115 -0
- data/docs/DBF/ColumnType/Base.html +389 -0
- data/docs/DBF/ColumnType/Boolean.html +238 -0
- data/docs/DBF/ColumnType/Currency.html +238 -0
- data/docs/DBF/ColumnType/Date.html +242 -0
- data/docs/DBF/ColumnType/DateTime.html +246 -0
- data/docs/DBF/ColumnType/Double.html +238 -0
- data/docs/DBF/ColumnType/Float.html +238 -0
- data/docs/DBF/ColumnType/General.html +238 -0
- data/docs/DBF/ColumnType/Memo.html +246 -0
- data/docs/DBF/ColumnType/Nil.html +238 -0
- data/docs/DBF/ColumnType/Number.html +242 -0
- data/docs/DBF/ColumnType/SignedLong.html +238 -0
- data/docs/DBF/ColumnType/String.html +240 -0
- data/docs/DBF/Database.html +126 -0
- data/docs/DBF/Database/Foxpro.html +653 -0
- data/docs/DBF/Database/Table.html +346 -0
- data/docs/DBF/FileNotFoundError.html +124 -0
- data/docs/DBF/Header.html +723 -0
- data/docs/DBF/Memo.html +117 -0
- data/docs/DBF/Memo/Base.html +485 -0
- data/docs/DBF/Memo/Dbase3.html +242 -0
- data/docs/DBF/Memo/Dbase4.html +230 -0
- data/docs/DBF/Memo/Foxpro.html +268 -0
- data/docs/DBF/NoColumnsDefined.html +124 -0
- data/docs/DBF/Record.html +773 -0
- data/docs/DBF/Schema.html +980 -0
- data/docs/DBF/Table.html +1571 -0
- data/docs/_index.html +415 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +359 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +359 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +675 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/dbf/column.rb +8 -7
- data/lib/dbf/column_type.rb +23 -0
- data/lib/dbf/database/foxpro.rb +7 -2
- data/lib/dbf/header.rb +11 -3
- data/lib/dbf/record.rb +5 -5
- data/lib/dbf/schema.rb +4 -3
- data/lib/dbf/table.rb +34 -11
- data/lib/dbf/version.rb +1 -1
- data/spec/dbf/column_spec.rb +3 -3
- data/spec/dbf/file_formats_spec.rb +54 -0
- data/spec/fixtures/dbase_02.dbf +0 -0
- data/spec/fixtures/dbase_02_summary.txt +23 -0
- data/spec/fixtures/dbase_32.dbf +0 -0
- data/spec/fixtures/dbase_32_summary.txt +11 -0
- data/spec/fixtures/dbase_8c.dbf +0 -0
- metadata +56 -6
- data/docs/supported_encodings.csv +0 -60
- data/docs/supported_types.markdown +0 -38
data/lib/dbf/version.rb
CHANGED
data/spec/dbf/column_spec.rb
CHANGED
@@ -286,13 +286,13 @@ RSpec.describe DBF::Column do
|
|
286
286
|
|
287
287
|
describe '#name' do
|
288
288
|
it 'contains only ASCII characters' do
|
289
|
-
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F
|
289
|
+
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \x00world-\x80--", 'N', 1, 0
|
290
290
|
expect(column.name).to eq '---hello world---'
|
291
291
|
end
|
292
292
|
|
293
293
|
it 'is truncated at the null character' do
|
294
|
-
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \
|
295
|
-
expect(column.name).to eq '---hello '
|
294
|
+
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \x00world-\x80--", 'N', 1, 0
|
295
|
+
expect(column.name).to eq '---hello world---'
|
296
296
|
end
|
297
297
|
end
|
298
298
|
end
|
@@ -48,6 +48,24 @@ RSpec.shared_examples_for 'DBF' do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
RSpec.describe DBF, 'of type 02 (FoxBase)' do
|
52
|
+
let(:table) { DBF::Table.new fixture('dbase_02.dbf') }
|
53
|
+
|
54
|
+
it_behaves_like 'DBF'
|
55
|
+
|
56
|
+
it 'reports the correct version number' do
|
57
|
+
expect(table.version).to eq '02'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'reports the correct version description' do
|
61
|
+
expect(table.version_description).to eq 'FoxBase'
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'determines the number of records' do
|
65
|
+
expect(table.record_count).to eq 9
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
51
69
|
RSpec.describe DBF, 'of type 03 (dBase III without memo file)' do
|
52
70
|
let(:table) { DBF::Table.new fixture('dbase_03.dbf') }
|
53
71
|
|
@@ -106,6 +124,24 @@ RSpec.describe DBF, 'of type 31 (Visual FoxPro with AutoIncrement field)' do
|
|
106
124
|
end
|
107
125
|
end
|
108
126
|
|
127
|
+
RSpec.describe DBF, 'of type 32 (Visual FoxPro with field type Varchar or Varbinary)' do
|
128
|
+
let(:table) { DBF::Table.new fixture('dbase_32.dbf') }
|
129
|
+
|
130
|
+
it_behaves_like 'DBF'
|
131
|
+
|
132
|
+
it 'has a dBase version of 32' do
|
133
|
+
expect(table.version).to eq '32'
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'reports the correct version description' do
|
137
|
+
expect(table.version_description).to eq 'Visual FoxPro with field type Varchar or Varbinary'
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'determines the number of records' do
|
141
|
+
expect(table.record_count).to eq 1
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
109
145
|
RSpec.describe DBF, 'of type 83 (dBase III with memo file)' do
|
110
146
|
let(:table) { DBF::Table.new fixture('dbase_83.dbf') }
|
111
147
|
|
@@ -142,6 +178,24 @@ RSpec.describe DBF, 'of type 8b (dBase IV with memo file)' do
|
|
142
178
|
end
|
143
179
|
end
|
144
180
|
|
181
|
+
RSpec.describe DBF, 'of type 8c (unknown)' do
|
182
|
+
let(:table) { DBF::Table.new fixture('dbase_8c.dbf') }
|
183
|
+
|
184
|
+
it_behaves_like 'DBF'
|
185
|
+
|
186
|
+
it 'reports the correct version number' do
|
187
|
+
expect(table.version).to eq '8c'
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'reports the correct version description' do
|
191
|
+
expect(table.version_description).to eq 'dBase 7'
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'determines the number of records' do
|
195
|
+
expect(table.record_count).to eq 10
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
145
199
|
RSpec.describe DBF, 'of type f5 (FoxPro with memo file)' do
|
146
200
|
let(:table) { DBF::Table.new fixture('dbase_f5.dbf') }
|
147
201
|
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
Database: dbase_02.dbf
|
3
|
+
Type: (02) FoxBase
|
4
|
+
Memo File: false
|
5
|
+
Records: 9
|
6
|
+
|
7
|
+
Fields:
|
8
|
+
Name Type Length Decimal
|
9
|
+
------------------------------------------------------------------------------
|
10
|
+
EMP:NMBR N 3 0
|
11
|
+
LAST C 10 0
|
12
|
+
FIRST C 10 0
|
13
|
+
ADDR C 20 0
|
14
|
+
CITY C 15 0
|
15
|
+
ZIP:CODE C 10 0
|
16
|
+
PHONE C 9 0
|
17
|
+
SSN C 11 0
|
18
|
+
HIREDATE C 8 0
|
19
|
+
TERMDATE C 8 0
|
20
|
+
CLASS C 3 0
|
21
|
+
DEPT C 3 0
|
22
|
+
PAYRATE N 8 0
|
23
|
+
START:PAY N 8 0
|
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
Database: dbase_32.dbf
|
3
|
+
Type: (32) Visual FoxPro with field type Varchar or Varbinary
|
4
|
+
Memo File: false
|
5
|
+
Records: 1
|
6
|
+
|
7
|
+
Fields:
|
8
|
+
Name Type Length Decimal
|
9
|
+
------------------------------------------------------------------------------
|
10
|
+
NAME V 250 0
|
11
|
+
_NullFlags 0 1 0
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A small fast library for reading dBase, xBase, Clipper and FoxPro database
|
14
14
|
files.
|
@@ -31,8 +31,53 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- bin/dbf
|
33
33
|
- dbf.gemspec
|
34
|
-
- docs/
|
35
|
-
- docs/
|
34
|
+
- docs/CNAME
|
35
|
+
- docs/DBF.html
|
36
|
+
- docs/DBF/Column.html
|
37
|
+
- docs/DBF/Column/LengthError.html
|
38
|
+
- docs/DBF/Column/NameError.html
|
39
|
+
- docs/DBF/ColumnType.html
|
40
|
+
- docs/DBF/ColumnType/Base.html
|
41
|
+
- docs/DBF/ColumnType/Boolean.html
|
42
|
+
- docs/DBF/ColumnType/Currency.html
|
43
|
+
- docs/DBF/ColumnType/Date.html
|
44
|
+
- docs/DBF/ColumnType/DateTime.html
|
45
|
+
- docs/DBF/ColumnType/Double.html
|
46
|
+
- docs/DBF/ColumnType/Float.html
|
47
|
+
- docs/DBF/ColumnType/General.html
|
48
|
+
- docs/DBF/ColumnType/Memo.html
|
49
|
+
- docs/DBF/ColumnType/Nil.html
|
50
|
+
- docs/DBF/ColumnType/Number.html
|
51
|
+
- docs/DBF/ColumnType/SignedLong.html
|
52
|
+
- docs/DBF/ColumnType/String.html
|
53
|
+
- docs/DBF/Database.html
|
54
|
+
- docs/DBF/Database/Foxpro.html
|
55
|
+
- docs/DBF/Database/Table.html
|
56
|
+
- docs/DBF/FileNotFoundError.html
|
57
|
+
- docs/DBF/Header.html
|
58
|
+
- docs/DBF/Memo.html
|
59
|
+
- docs/DBF/Memo/Base.html
|
60
|
+
- docs/DBF/Memo/Dbase3.html
|
61
|
+
- docs/DBF/Memo/Dbase4.html
|
62
|
+
- docs/DBF/Memo/Foxpro.html
|
63
|
+
- docs/DBF/NoColumnsDefined.html
|
64
|
+
- docs/DBF/Record.html
|
65
|
+
- docs/DBF/Schema.html
|
66
|
+
- docs/DBF/Table.html
|
67
|
+
- docs/_index.html
|
68
|
+
- docs/class_list.html
|
69
|
+
- docs/css/common.css
|
70
|
+
- docs/css/full_list.css
|
71
|
+
- docs/css/style.css
|
72
|
+
- docs/file.README.html
|
73
|
+
- docs/file_list.html
|
74
|
+
- docs/frames.html
|
75
|
+
- docs/index.html
|
76
|
+
- docs/js/app.js
|
77
|
+
- docs/js/full_list.js
|
78
|
+
- docs/js/jquery.js
|
79
|
+
- docs/method_list.html
|
80
|
+
- docs/top-level-namespace.html
|
36
81
|
- lib/dbf.rb
|
37
82
|
- lib/dbf/column.rb
|
38
83
|
- lib/dbf/column_type.rb
|
@@ -54,6 +99,8 @@ files:
|
|
54
99
|
- spec/dbf/table_spec.rb
|
55
100
|
- spec/fixtures/cp1251.dbf
|
56
101
|
- spec/fixtures/cp1251_summary.txt
|
102
|
+
- spec/fixtures/dbase_02.dbf
|
103
|
+
- spec/fixtures/dbase_02_summary.txt
|
57
104
|
- spec/fixtures/dbase_03.dbf
|
58
105
|
- spec/fixtures/dbase_03_summary.txt
|
59
106
|
- spec/fixtures/dbase_30.dbf
|
@@ -61,6 +108,8 @@ files:
|
|
61
108
|
- spec/fixtures/dbase_30_summary.txt
|
62
109
|
- spec/fixtures/dbase_31.dbf
|
63
110
|
- spec/fixtures/dbase_31_summary.txt
|
111
|
+
- spec/fixtures/dbase_32.dbf
|
112
|
+
- spec/fixtures/dbase_32_summary.txt
|
64
113
|
- spec/fixtures/dbase_83.dbf
|
65
114
|
- spec/fixtures/dbase_83.dbt
|
66
115
|
- spec/fixtures/dbase_83_missing_memo.dbf
|
@@ -74,6 +123,7 @@ files:
|
|
74
123
|
- spec/fixtures/dbase_8b.dbf
|
75
124
|
- spec/fixtures/dbase_8b.dbt
|
76
125
|
- spec/fixtures/dbase_8b_summary.txt
|
126
|
+
- spec/fixtures/dbase_8c.dbf
|
77
127
|
- spec/fixtures/dbase_f5.dbf
|
78
128
|
- spec/fixtures/dbase_f5.fpt
|
79
129
|
- spec/fixtures/dbase_f5_summary.txt
|
@@ -112,13 +162,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
162
|
- !ruby/object:Gem::Version
|
113
163
|
version: 1.3.0
|
114
164
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
165
|
+
rubygems_version: 3.2.15
|
116
166
|
signing_key:
|
117
167
|
specification_version: 4
|
118
168
|
summary: Read xBase files
|
119
169
|
test_files:
|
170
|
+
- spec/dbf/column_spec.rb
|
120
171
|
- spec/dbf/database/foxpro_spec.rb
|
121
172
|
- spec/dbf/file_formats_spec.rb
|
122
|
-
- spec/dbf/column_spec.rb
|
123
173
|
- spec/dbf/record_spec.rb
|
124
174
|
- spec/dbf/table_spec.rb
|
@@ -1,60 +0,0 @@
|
|
1
|
-
"Code Page", "Encoding", "Description"
|
2
|
-
"01", "cp437", "U.S. MS–DOS"
|
3
|
-
"02", "cp850", "International MS–DOS"
|
4
|
-
"03", "cp1252", "Windows ANSI"
|
5
|
-
"08", "cp865", "Danish OEM"
|
6
|
-
"09", "cp437", "Dutch OEM"
|
7
|
-
"0a", "cp850", "Dutch OEM*"
|
8
|
-
"0b", "cp437", "Finnish OEM"
|
9
|
-
"0d", "cp437", "French OEM"
|
10
|
-
"0e", "cp850", "French OEM*"
|
11
|
-
"0f", "cp437", "German OEM"
|
12
|
-
"10", "cp850", "German OEM*"
|
13
|
-
"11", "cp437", "Italian OEM"
|
14
|
-
"12", "cp850", "Italian OEM*"
|
15
|
-
"13", "cp932", "Japanese Shift-JIS"
|
16
|
-
"14", "cp850", "Spanish OEM*"
|
17
|
-
"15", "cp437", "Swedish OEM"
|
18
|
-
"16", "cp850", "Swedish OEM*"
|
19
|
-
"17", "cp865", "Norwegian OEM"
|
20
|
-
"18", "cp437", "Spanish OEM"
|
21
|
-
"19", "cp437", "English OEM (Britain)"
|
22
|
-
"1a", "cp850", "English OEM (Britain)*"
|
23
|
-
"1b", "cp437", "English OEM (U.S.)"
|
24
|
-
"1c", "cp863", "French OEM (Canada)"
|
25
|
-
"1d", "cp850", "French OEM*"
|
26
|
-
"1f", "cp852", "Czech OEM"
|
27
|
-
"22", "cp852", "Hungarian OEM"
|
28
|
-
"23", "cp852", "Polish OEM"
|
29
|
-
"24", "cp860", "Portuguese OEM"
|
30
|
-
"25", "cp850", "Portuguese OEM*"
|
31
|
-
"26", "cp866", "Russian OEM"
|
32
|
-
"37", "cp850", "English OEM (U.S.)*"
|
33
|
-
"40", "cp852", "Romanian OEM"
|
34
|
-
"4d", "cp936", "Chinese GBK (PRC)"
|
35
|
-
"4e", "cp949", "Korean (ANSI/OEM)"
|
36
|
-
"4f", "cp950", "Chinese Big5 (Taiwan)"
|
37
|
-
"50", "cp874", "Thai (ANSI/OEM)"
|
38
|
-
"57", "cp1252", "ANSI"
|
39
|
-
"58", "cp1252", "Western European ANSI"
|
40
|
-
"59", "cp1252", "Spanish ANSI"
|
41
|
-
"64", "cp852", "Eastern European MS–DOS"
|
42
|
-
"65", "cp866", "Russian MS–DOS"
|
43
|
-
"66", "cp865", "Nordic MS–DOS"
|
44
|
-
"67", "cp861", "Icelandic MS–DOS"
|
45
|
-
"6a", "cp737", "Greek MS–DOS (437G)"
|
46
|
-
"6b", "cp857", "Turkish MS–DOS"
|
47
|
-
"6c", "cp863", "French–Canadian MS–DOS"
|
48
|
-
"78", "cp950", "Taiwan Big 5"
|
49
|
-
"79", "cp949", "Hangul (Wansung)"
|
50
|
-
"7a", "cp936", "PRC GBK"
|
51
|
-
"7b", "cp932", "Japanese Shift-JIS"
|
52
|
-
"7c", "cp874", "Thai Windows/MS–DOS"
|
53
|
-
"86", "cp737", "Greek OEM"
|
54
|
-
"87", "cp852", "Slovenian OEM"
|
55
|
-
"88", "cp857", "Turkish OEM"
|
56
|
-
"c8", "cp1250", "Eastern European Windows"
|
57
|
-
"c9", "cp1251", "Russian Windows"
|
58
|
-
"ca", "cp1254", "Turkish Windows"
|
59
|
-
"cb", "cp1253", "Greek Windows"
|
60
|
-
"cc", "cp1257", "Baltic Windows"
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# DBF supported data types
|
2
|
-
|
3
|
-
| Version | Description | C | N | L | D | M | F | B | G | P | Y | T | I | V | X | @ | O | + |
|
4
|
-
|---------|-----------------------------------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
5
|
-
| 02 | FoxBase | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
|
6
|
-
| 03 | dBase III without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
|
7
|
-
| 04 | dBase IV without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
|
8
|
-
| 05 | dBase V without memo file | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
|
9
|
-
| 07 | Visual Objects 1.x | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - | - |
|
10
|
-
| 30 | Visual FoxPro | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | - |
|
11
|
-
| 31 | Visual FoxPro with AutoIncrement | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
|
12
|
-
| 7b | dBase IV with memo file | Y | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - |
|
13
|
-
| 83 | dBase III with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - |
|
14
|
-
| 87 | Visual Objects 1.x with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | - | - | - | - |
|
15
|
-
| 8b | dBase IV with memo file | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | N | - | - | - |
|
16
|
-
| 8e | dBase IV with SQL table | Y | Y | Y | Y | Y | - | - | - | - | - | - | - | - | N | - | - | - |
|
17
|
-
| f5 | FoxPro with memo file | Y | Y | Y | Y | Y | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
|
18
|
-
| fb | FoxPro without memo file | Y | Y | Y | Y | - | Y | Y | Y | N | Y | N | Y | N | N | N | N | N |
|
19
|
-
|
20
|
-
Data type descriptions
|
21
|
-
|
22
|
-
* C = Character
|
23
|
-
* N = Number
|
24
|
-
* L = Logical
|
25
|
-
* D = Date
|
26
|
-
* M = Memo
|
27
|
-
* F = Float
|
28
|
-
* B = Binary
|
29
|
-
* G = General
|
30
|
-
* P = Picture
|
31
|
-
* Y = Currency
|
32
|
-
* T = DateTime
|
33
|
-
* I = Integer
|
34
|
-
* V = VariField
|
35
|
-
* X = SQL compat
|
36
|
-
* @ = Timestamp
|
37
|
-
* O = Double
|
38
|
-
* + = Autoincrement
|