-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
69 lines (47 loc) · 2.53 KB
/
README
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
NAME
dbci.rb - creates sqlite database, and inserts record from text files
SYNOPSIS
dbci.rb <full_path_of_sqlite_db> -table:{<table_name_in_db>=<full_path_of_textfile>,*args} [-int:{<column_name>,*args} [-append:<boolean>]]
DESCRIPTION
There are times calculating deep logical data with awk(sed, joins) is
much time consuming or later some aspects of them gradually
becomes maintainence nightmare. What if we could write custom SQL
commands, and execute them over those plain text files?
In some case, writing SQL is much more easier and quicker. This little
tool helps CGI programmers to import plain text file into sqlite database
as a structured table. Means, it enables a programmer to concentrate on the
the program logic rather than typing & asserting various IO operations.
First row of the text file will be considered as column names.
Every column in each row must have some data(not space).
Plain file example below:
Line.No | employee file data
-----------------------------
001. | id name sex age
002. | AA Battur male 26
003. | BB George male 45
004. | CC Sarah female 30
-table:{<table_name_in_db>=<full_path_of_textfile>,*args}
Provide table names and the full path of your text files.
-int:{<column_name>,*args}
Name numeric columns here. Later it's easier to sort & filter.
This parameter is optional.
-append:<boolean>
Supply 'true' or 'false' here. If you put 'true' records will
be appended into existing table.
This parameter is optional.
Note: This tool is intended for CGI programmers doing lot of text
based operation. Therefore may not fit for every case on earth ;)
EXAMPLE
dbci.rb company.db -table:{positions=/abc_company/position,employees=/abc_company/employees/} -int:{age,salary} -append:true
Note: Do not put space between sub options!
AUTHOR
Battur Sanchin
{
:homepage => 'http://battur.blogspot.com',
:email => '[email protected]',
:flickr => 'http://flickr.com/photos/battur'
}
COPYRIGHT
Copyright © 2009 Battur Sanchin. Licence: MIT License
SEE ALSO
SQLite homepage: http://www.sqlite.org