Please provide questions, feedback, and comments on Supporting Relational Databases in LabVIEW Real-Time in this thread.
|Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for |
use in hazardous environments. You assume all risks for use of the Code, and use of the Code is subject to the Sample Code License.
Many thanks, Christian!
It looks interesting. Last week I made an attempt to translate SQLite with the tool and makefile from http://zone.ni.com/devzone/cda/tut/p/id/5694. But I got a lo of errors from the compiler. For example that time.h will not be found.
Next week I will see into your zip at http://zone.ni.com/devzone/cda/epd/p/id/6287
Maybe it will work with some steps.
In this case your SQL-VIs which call the SQLIte library can be interesting. The I could spare time to implement these VIs by myself.
Comments from me will com into this thread.
That sounds great. If you want to look at the source code it is in the SQLite\SQLite Source\VxWorks directory. It includes the makefile for the GCC compiler. The code includes the sqlite3.lib, sqlitewrapper.c, and headers. I'm trying to track down the C files for the .lib. The wrapper implements the most basic API calls.
Today I had some time to try. At first I wanted to fathom the compiling process so I can compile newer sqlite versions at the same way in the future. I prepared all what we need and what the comments in the readme file says. At first I'm interested only in VxWORKS. So I used the VxWORKS folder of the zip file download lv_sqlite.zip at http://zone.ni.com/devzone/cda/epd/p/id/6287 and the vxworks63gccdist.zip at http://zone.ni.com/devzone/cda/tut/p/id/5694
1. With the make file from lv_sqlite.zip I could compile the sqlitewrapper successful.
2. But this containing make file compiles only this.
3. To compile the sqlite.c I changed the following rows in the make file:
Row 23 from "OBJECTS := $(OBJ_DIR)/sqlitewrapper.o" to "OBJECTS := $(OBJ_DIR)/sqlite3.o"
Row 25 from "PROJECT_TARGETS := $(OBJ_DIR)/sqlitewrapper.out" to "PROJECT_TARGETS := $(OBJ_DIR)/sqlite3.out"
4. I made a copy of sqlite3.c and .h from CVI RT folder. This includes Version 3.6.3 of sqlite3
5. I looked for "fd = open("/dev/urandom", ORDONLY);" in row 24653 (the README said it) and found this in row 24537. But I found "fd = open("/dev/urandom", O_RDONLY, 2);". But, this has already 3 paramaters the last is not NULL!
6. I started my changed make file.
The result was a lot of errors.
At the same way I used the actual distribution of sqlite with the same result: A lot of errors and no .out file.
It would be great somewhere would find or bind a running packet of gcc for VxWorks and sqlite. So we could use always the actual version of sqlite.
The wrapper-VI's are good for beginning and I will try these with the sqlite3.out file from Christian up next. Probable I will enhance the VIs because the wrapper works only with strings (the charakter | is the column divider).
If you would like to post the additions to the wrapper VI that would be great. The wrapper only takes care of the most basic operations, and I would like to expand upon them when I get a chance.
As forthe building prcess, it is definitly tedious. In the future I will try to make it more dynamic like you said earlier.
The example with the included source and out-files from Christian doesn't work. I prepared all thinks like in the README. But during deployment I get always an error.
I tryed it also with a own wrapper. My wrapperfunction works so long as no sqlite3-function is called. If I inlcude a sqlite3 function like sqlite3_open() the deployment makes an error like with Christians LV project. I didn't forget to copy the line "sqlitewrapper.out=sqlite3.out" how the reade describes.
I tryed my wrapper test with LV 8.6.1 and 2009.
And it is not clear how Christian could compile the sqlite3.c file. I get a lot of errors during the compilation. Maybe the sqlite3.out from Christian is from former VxWorks versions. I don't know.
I'm looking for the deep reason that my sqlite comilation not works. So I tryed a very simple test function in sqlitewrapper which not use sqlite3. But I copyed my sqlite3.out into the system folder and added the "sqlitewrapper.out=sqlite3.out" to the ini-file.
Result: With my sqlite3 compilation it doesn't work. But
If I copy your compilation into the system folder, so it works. I could say "great". But what ist the different between my sqlite3.out and yours?
Did you use an other makefile than I? Or do you have a special sqlite.c source file?
The sqlite3.out and sqlite3.lib were two things that I found while going through a summer interns work (looking for nuggets). The amount of work that was needed to make them for VxWorks was significant enough that I decided to clean them up and make the examples and share them with the community.
I don't have the source and makefile for how he built sqlite3.out, but I'll try to track it down.
In the mean time I am going to update the example online to reflect the different .out files.
The last two days I developed some wrapper functions for the sqlite3.out from Brian for VxWorks. And it works. Great! Maybe the data transfer rate will be lower than TDMS, but additional to all database functions: SQLite ist very stable against power off problems during data writing. It's a realy database.
Very intersting: SQLite knows databases in main memory. So it is possible to collect some data in main memory before these can be saved into the flash. This can saves the flash EEPROM memory because in normal use each atomic commit of date into the database create a journal file for roll back to get consistant date in case of a power off event. Maybe we can lose the last data but we get always a right database file. Enough room for optimization. But better than some own solutions of data writing with simple file commands.
In the next time I will complete the wrapper and develop a messaging database system for small automation devices with cRIO and sbRIO. I want to give the results into the community.
For interest in the meantime: Somebody can contact me at herbrand.#-gmx.de. (change ".#-" to @ because these signgs help my to save me against spam).
But this thread is not closed because we need the information how we can compile future sqlite sources so that LV has no problems.
And many thanks to Brian and Christian!