-
Notifications
You must be signed in to change notification settings - Fork 0
aadaa/unix_power_tools
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
About
Small unix tools those help CGI program development
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published