› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › sqlite
I am ready to expore options for a new project using sqlite. I very familiar with tsql and pl/sql with SQL Server and Oracle and have done development in that area; but, never have I used sqlite and mysql, so need some assistance please.
I created a database and a table. I would like to load the table with data using a script (data.sql). How can I bring this file into SQLite and load the table with values rather then doing this manually line by line?
Any help would be very appreciated.
Thanks,
Femina
Try this tutorial: http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html
Many other assets on the web. Google is your friend 😀
Check out this post, too.
https://usspvlclovertch2.infor.com/viewtopic.php?t=6686
-- Max Drown (Infor)
It’s easy enough to do in TCL, as Max and Charlie point out.
I also use “SQLite Database Browser”. It has functions that allow you to import/export a database to/from a SQL file or import/export a table to/from CSV. I use it to edit/update databases. SQLite databases are portable between Windows and Linux, at least. It’s a servicable, free graphic tool, but doesn’t perform very well on large data sets.
You can also run SQLite in linemode and import/export to/from SQL and CSV – see SQLite’s .help below:
-bash-3.2$ sqlite3
SQLite version 3.3.6
Enter “.help” for instructions
sqlite> .help
.databases List names and files of attached databases
.dump ?TABLE? … Dump the database in an SQL text format
.echo ON|OFF Turn command echo on or off
.exit Exit this program
.explain ON|OFF Turn output mode suitable for EXPLAIN on or off.
.header(s) ON|OFF Turn display of headers on or off
.help Show this message
.import FILE TABLE Import data from FILE into TABLE
.indices TABLE Show names of all indices on TABLE
.mode MODE ?TABLE? Set output mode where MODE is one of:
csv Comma-separated values
column Left-aligned columns. (See .width)
html HTML
Jeff Dinsmore
Chesapeake Regional Healthcare
Thanks folks for all the tips….and I have build the sample tables, read a file to insert data into a table and did the select.
The concern I have is how to i build the inbound and outbound threads that reads all the hl7 files from inbound and loads into the sql table (outbound). Basically, mapping the hl7 to the sql table. Do I just create a raw route with a proc to do this? I need baby steps please…? Secondly, how do I use a translate to do this?
Thanks,
Femina
What are you trying to accomplish?
SQLite will store large chunks of data in a single cell without having to specify a particular size for the given column.
I’ve stored whole messages in SQLite for later sending. That doesn’t require any disassembly of the message unless you need to store some specific field data in your DB for lookup purposes.
I’ve used the following table structure to store whole messages for later delivery:
create table msgs(destinationSys TEXT, clMsgId TEXT, appSpecificMsgId TEXT, msg TEXT, sendSec NUMERIC, insertSec NUMERIC)
Jeff Dinsmore
Chesapeake Regional Healthcare
Jeff,
I need to store the HL7 messages in a SQL database, and then after 24 hours match the records in the db with MRN and send HL7 results back to the client. This way all the results are grouped by patient. Has anyone done anything similar?
Thanks,
FJ
Femina- Yes I have done this a few times. What you need to do is store ADT fields into the sql data, MRN, account etc etc. Then store the HL7 Messages onto your cloverleaf server. Then you run a schedule task to query the HL7 Messages against your sqlite database. If message qualifies sent out else do something else. Message if you would like to chat offline.