Chris Davis Posted January 24, 2006 Report Share Posted January 24, 2006 I've been working with SQLite 3 (www.sqlite.org) for the last couple of days. And had good success with and had some good success in developing a wrapper for SQLite that can easily be used in LabView. I'm writing this wrapper in LabWindows/CVI, but it is all standard ANSI C, and not very much of it anyway. I was wondering if there is a call for an embedded database like SQLite in the LabView world. I don't use databases very much but when I ran across an article about SQLite I couldn't resist toying with it. I have no problem posting the code, if there is interest, and I think it could prove to be a useful addition to the OpenG toolkit, if there was a call to develop it into a library compatable with OpenG. One nice thing is that SQLite is at least as cross-platform as LabView! I await your responses! Chris Davis Quote Link to comment
Michael Aivaliotis Posted January 24, 2006 Report Share Posted January 24, 2006 I've been working with SQLite 3 (www.sqlite.org) for the last couple of days. And had good success with and had some good success in developing a wrapper for SQLite that can easily be used in LabView. I'm writing this wrapper in LabWindows/CVI, but it is all standard ANSI C, and not very much of it anyway. I was wondering if there is a call for an embedded database like SQLite in the LabView world. I don't use databases very much but when I ran across an article about SQLite I couldn't resist toying with it. I have no problem posting the code, if there is interest, and I think it could prove to be a useful addition to the OpenG toolkit, if there was a call to develop it into a library compatable with OpenG. One nice thing is that SQLite is at least as cross-platform as LabView!I await your responses! Chris Davis Maybe you can educate us a little bit. I've worked with several database engines but not SQLite. I understand it's embedded. Does this mean you cannot access it from an ODBC interface? Can you create a DLL that can be called through LabVIEW? Quote Link to comment
Chris Davis Posted January 24, 2006 Author Report Share Posted January 24, 2006 Maybe you can educate us a little bit. I've worked with several database engines but not SQLite. I understand it's embedded. Does this mean you cannot access it from an ODBC interface? Can you create a DLL that can be called through LabVIEW? Not a problem. SQLite is an embedded database, which means that the database you create is just a single file on your computer. This single file can be backed up easily and even moved across platforms (windows, mac, linux) to be read using the appropriate SQLite DLL ( or shared library on other platforms). It claims speed as one of its advantages, but I can't back that up with any hard numbers. In my case, the speed of execution is not as important to me as other properties. I'm mostly interested in the ability to access data with SQL commands without having to install and maintain all the seperate database administration tools and packages on the windows platform. I'm interested in the "crossplatform-ness" because I run LabView on the Mac and Linux as well. As for access with ODBC, there are some ODBC drivers / wrappers for SQLite, but I haven't played with them yet. There are also some ADO drivers / wrappers for SQLite but I have had little success getting those to work in LabView, and of course they ruin the crossplatform idea since they are activeX based. I've created a CVI based DLL that can be called through LabView that lets you read and write to / from a SQLite database. This DLL simplifies the process of calling the SQLite DLL from LabView by taking care of some housekeeping and reformatting of data that are needed to make LabView happy. My initial test case is a program that I am attempting to write to allow a user to load and crop a directory of images (JPG's) with a thumbnail display to let the user select the image they want to crop. I was thinking about processing the thumbnails once and loading them into a SQLite database as blob data to be retrieved the next time that directory is called up. I am also going to try and provide non-destructive editing by logging the crop parameters into the database and executing them only in an export step when the images get uploaded to a web page for viewing by the general public. I know some programs like this exist out there now, but they don't meet all the needs of my particular user, and thus I've been asked to research the idea to see if I can do it without breaking the bank. Hope this provides a little more information. Thanks, Chris Davis Quote Link to comment
Khalid Posted January 24, 2006 Report Share Posted January 24, 2006 Very interesting! Do you know of efforts in getting SQLite compile on RTOSes like Phar Lap or VxWorks? -Khalid Quote Link to comment
Chris Davis Posted January 24, 2006 Author Report Share Posted January 24, 2006 Very interesting! Do you know of efforts in getting SQLite compile on RTOSes like Phar Lap or VxWorks? -Khalid No, I don't know of any efforts in this area, but I wouldn't be surprised if they existed somewhere. Chris Davis Quote Link to comment
Jim Kring Posted January 25, 2006 Report Share Posted January 25, 2006 I've been working with SQLite 3 (www.sqlite.org) for the last couple of days. And had good success with and had some good success in developing a wrapper for SQLite that can easily be used in LabView. I'm writing this wrapper in LabWindows/CVI, but it is all standard ANSI C, and not very much of it anyway. I was wondering if there is a call for an embedded database like SQLite in the LabView world. I don't use databases very much but when I ran across an article about SQLite I couldn't resist toying with it. I have no problem posting the code, if there is interest, and I think it could prove to be a useful addition to the OpenG toolkit, if there was a call to develop it into a library compatable with OpenG. One nice thing is that SQLite is at least as cross-platform as LabView!I await your responses! Chris Davis Chris: I think this is very interesting and worth developing into an OpenG project (we were actually discussing SQLite integration with LabVIEW, last week). We could build the shared library on all platforms and make it a cross-platform toolkit. I'm more than happy to help get it into the OpenG Toolkit. Send me a PM, and we can discuss. Cheers, Quote Link to comment
Michael Aivaliotis Posted January 25, 2006 Report Share Posted January 25, 2006 I've created a CVI based DLL that can be called through LabView that lets you read and write to / from a SQLite database. This DLL simplifies the process of calling the SQLite DLL from LabView by taking care of some housekeeping and reformatting of data that are needed to make LabView happy.Whould you be willing to post this DLL here so we could try it out? Quote Link to comment
Chris Davis Posted January 25, 2006 Author Report Share Posted January 25, 2006 Whould you be willing to post this DLL here so we could try it out? Jim and Michael, Give me some time to finalize the DLL and put up a set of LV Vi's and an example database. I'll work on this today and hopefully post it this afternoon. Chris Quote Link to comment
tleibner Posted January 25, 2006 Report Share Posted January 25, 2006 Jim and Michael, Give me some time to finalize the DLL and put up a set of LV Vi's and an example database. I'll work on this today and hopefully post it this afternoon. Chris G'day, why not calling the sqlite3.dll directly? e.g.: sqlite.viDownload File:post-3293-1138210594.vi Get your latest sqlite3.dll form www.sqlite.org. e.g. http://www.sqlite.org/sqlitedll-3_3_2.zip Thomas Quote Link to comment
Chris Davis Posted January 25, 2006 Author Report Share Posted January 25, 2006 G'day,why not calling the sqlite3.dll directly? e.g.: sqlite.viDownload File:post-3293-1138210594.vi Get your latest sqlite3.dll form www.sqlite.org. e.g. http://www.sqlite.org/sqlitedll-3_3_2.zip Thomas Thomas, You can call that particular function directly from the SQLite DLL, but when I tried to interfact to it directly on some of the functions that actually execute SQL commands or deal with the database I crashed LV. I may be wrong, but I'm sure it will be easy to see when I've uploaded the interface code. I'll be through with my interface and example code soon and someone who has done this before can begin to look at what I've made and make it better. That's the idea behind open source isn't? Thanks, Chris Quote Link to comment
Chris Davis Posted January 25, 2006 Author Report Share Posted January 25, 2006 Here is a zip file of the example code i've developed. I'm having some trouble getting all the rows to read back in from the example database I've included. Maybe someone can help? BTW, all code was written in LV 7.0 for compatibilities sake. Chris. Download File:post-2547-1138229920.zip Quote Link to comment
Chris Davis Posted January 26, 2006 Author Report Share Posted January 26, 2006 All, I've worked a little on the LV SQLite Example I uploaded yesterday, and I found a much better function in SQLite to execute and retrieve all the data from a SQL statement. As such my DLL now has three functions exposed to the user, Open, Close, and Execute. Take a look at the reworked examples to see what I mean. Chris Download File:post-2547-1138317174.zip Quote Link to comment
Kevin Boronka Posted January 27, 2006 Report Share Posted January 27, 2006 All,I've worked a little on the LV SQLite Example I uploaded yesterday, and I found a much better function in SQLite to execute and retrieve all the data from a SQL statement. As such my DLL now has three functions exposed to the user, Open, Close, and Execute. Take a look at the reworked examples to see what I mean. Chris first of all, nice job Chris, I think that this wrapper can be fairly useful, since sqlite3.dll makes lv8 think it's corrupting it's memory. :thumbup: I've been playing around with your example, and one thing I noticed is that the memory usage continues to climb. Not sure where the memory leak is. Run LV SQLite Read Database Into Table.vi in continuous mode, and you'll eventually run out of memory. Quote Link to comment
Chris Davis Posted January 27, 2006 Author Report Share Posted January 27, 2006 first of all, nice job Chris, I think that this wrapper can be fairly useful, since sqlite3.dll makes lv8 think it's corrupting it's memory. :thumbup: I've been playing around with your example, and one thing I noticed is that the memory usage continues to climb. Not sure where the memory leak is. Run LV SQLite Read Database Into Table.vi in continuous mode, and you'll eventually run out of memory. I'll take a look today or this weekend to see if I can figure out what is going wrong and causing the memory leak. If I find it I'll upload another version. The next step is to make a database with some blob data in it to see how to access that type of data easily. I'm thinking of a simple database with some JPG's in it to start with. That is my original use case for this particular project so I think I'll try doing something along those lines now. I'll have to find the memory leak first, since when you start working with Blob data, your memory usage goes up dramatically. Chris Quote Link to comment
Chris Davis Posted February 9, 2006 Author Report Share Posted February 9, 2006 I haven't had time to look at the code to solve the memory leak, but I have started an OpenG project to begin to make the LabView SQLite toolkit a reality. I've created a Requirements Document to state the project goals for those who want to be involved. This document is avaliable through the OpenG CVS system, so you'll have to check with Jim Kring if you want to be able to contribute to this project. I'm posting the first draft of the Requirements document here for everyone who was interested to review. Chris Davis Download File:post-2547-1139455457.doc Quote Link to comment
nitrean Posted September 10, 2008 Report Share Posted September 10, 2008 QUOTE (chrisdavis @ Feb 9 2006, 04:24 AM) I haven't had time to look at the code to solve the memory leak, but I have started an OpenG project to begin to make the LabView SQLite toolkit a reality. I've created a Requirements Document to state the project goals for those who want to be involved. This document is avaliable through the OpenG CVS system, so you'll have to check with Jim Kring if you want to be able to contribute to this project. I'm posting the first draft of the Requirements document here for everyone who was interested to review.Chris Davis For some reason, new records are inserted twice in the database when using the INSERT INTO command. Any idea what's wrong ? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.