Jump to content
News about the LabVIEW Wiki! Read more... ×

Recommended Posts

How did you install it?

Since I don't have VIPM (yet), I unzipped the files into my project folder and used it directly.

This is not a very elegant way, I know, but it worked nicely so far. The reason for this was, that this package was the only AddOn I needed and I don't like installing a huge overhead of software for functionality I don't need.

 

PS: Sorry for the double post. It said I wasn't allowed to edit, so I posted another answer.

Share this post


Link to post
Share on other sites

Hi Neil,

 

I'm sure VIPM is great at what it's supposed to do. But just because a car is good for driving that doesn't necessarily mean I need it.

In case this changes, I'll give it a try. [VIPM, not the car. I hate cars ;)]

 

- Max

  • Like 1

Share this post


Link to post
Share on other sites

Hey guys,

 

a little OT, but I felt it was nice to post it anyway: I recently installed VIPM and I have to say - it actually is a great tool.

Why did I install it? Someone used OpenG in a VI I was supposed to look at.
And I was happy to see, that I was not the only one with the idea of having error clusters in the timing VIs ;)

 

/ Max

Share this post


Link to post
Share on other sites

hi there,

 

I have used this SQLite wrapper for quite a while and noticed a problem:

The testrig software I programmed will probably be used by other persons as well. Unfortunately, some of them are not very familiar with labview programming and will probably stop the execution of the program using the red button.

This causes a 'database locked' message, when the software is started again afterwards. So I was wondering, if there is any way to remove the lock (since the process locking the database is still running - LabVIEW itself) automatically on the next run.

I know, people should be trained not to stop the execution that way, but this will happen. I don't want to hide this button, since it might be necessary to kill the program from time to time during development. So I'm looking for another way to handle this.

 

Any suggestions on that? I'll appreciate any help.

 

Max

Share this post


Link to post
Share on other sites
I know, people should be trained not to stop the execution that way, but this will happen. I don't want to hide this button, since it might be necessary to kill the program from time to time during development. So I'm looking for another way to handle this.

I generally hide the toolbar on the front panel.  One can still access the hard-stop button by opening the block diagram.  I also usually capture the “Panel Close?” event and use it to trigger ordered shutdown, so a User can hit the X button to stop the program correctly.

 

I’m not sure there is an easy way to clear the lock if this happens, other than restarting LabVIEW.  

Share this post


Link to post
Share on other sites

Thanks for this tip, I implemented it right away in almost all my programs ;)

I'll see, if I find anything in the SQLite/LV docs. I'll post it here in case someone is googeling this problem.

Share this post


Link to post
Share on other sites
Thanks for this tip, I implemented it right away in almost all my programs ;)

I'll see, if I find anything in the SQLite/LV docs. I'll post it here in case someone is googeling this problem.

 

There is not an easy solution. The only proper way would be to implement some DLL wrapper that uses the Call Library Node callback methods to register any session that gets opened in some private global queue in the wrapper DLL. The close function then removes the session from the queue. The CLN callback function for abort will check the queue for the session parameter and close it also if found. That CLN callback mechanism is the only way to receive the LabVIEW Abort  event properly in external code.

  • Like 1

Share this post


Link to post
Share on other sites

Hi folks,

 

Thanks to drjdpowell for putting this library together - it is very useful.  I would like to share an issue I faced when putting together a test VI to execute some SQL queries.

 

If the function is not saved the SQLite Open function will return an 'OK' error however with a db connection id of '0'.  Subsequent calls (in my case to execute SQL and then close the connection) also return with no error.

 

Save the function and things start working correctly.

 

The issue is in the 'Open (string)' function which uses Application Directory.vi to help locate the sqlite3 DLL.  This function returns <Not a Path> if the VI is not saved, when <Not a Path> is input to the CLFN it returns with no error and what appears to be 'default' values on output (empty string, 0 int).

 

To me this is a bug with the CLFN, although the API could check for this condition.. or I could just save my code  ;)

post-50351-0-17288600-1390559670.png

  • Like 2

Share this post


Link to post
Share on other sites
If the function is not saved the SQLite Open function will return an 'OK' error however with a db connection id of '0'.  Subsequent calls (in my case to execute SQL and then close the connection) also return with no error.

Fix for this in version 1.2.1.  Can you give it a quick test?

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for this code ! but i have a question :

Is it possible ? , and if yes,  how to use a cluster to write and read datas in SQLite database ?

 

Thanks in advance.

 

Nono.

Share this post


Link to post
Share on other sites

There is no direct way to write a cluster.  Partly this is because there is no direct one-to-one correspondence between LabVIEW and SQLIte types; in particular, a LabVIEW string can be either text of binary (SQLIte Text and Blob types).  Note that it is relatively easy to wire a long set of “Get Column” into a corresponding cluster bundle (or an unbundle into the corresponding “Bind”).  That is part of the reason for making “Get Column” and “Bind” property nodes.

Share this post


Link to post
Share on other sites
It uses the 'other' SQLite toolkit :)

As long as we're counting, there are several SQLite APIs for LabVIEW, and multiple free ones among them.

Share this post


Link to post
Share on other sites

There is another problem about the question with clusters. It is not very specific as to what is wanted.

 

Should it be a cluster where each element in the cluster is matched with a column in the database table? If so should it be matched based on cluster element name matching the column name or rather its ordinal value in the cluster match the row number? What about if the cluster doesn't match the rows in either case?

 

Or is it about storing a cluster as binary blob in a single column?

 

Questions, questions!!!!

  • Like 1

Share this post


Link to post
Share on other sites

This package is now on the Tools Network, which required the following changes:

— Rename to “SQLite Library†(can’t use “LabVIEW†in name)

— move pallet to be under “Connectivity†rather than “drjdpowell† (and the sub pallet icons now look nicer)

Share this post


Link to post
Share on other sites

I apologize to users of this library.  When NI made me rename the library to “SQLite Library†from “SQLite LabVIEWâ€, I inadvertently allowed VIPM to rename the root directory accordingly, so this might cause your minor conflict headaches when opening old projects.  Sorry.

  • Like 1

Share this post


Link to post
Share on other sites

I was very curious about this library and thought I'll give it a spin to see if I can use it in my application. In the first test, however, I already ran into a game stopper with the insert speed. Perhaps I'm doing something all wrong—you can take a look at the test code—but utilizing the "INSERT many rows Template code.vi", that to my knowledge should be an efficient method, I'm getting around 10-20 inserts per second. That's more than an order of magnitude less than what I was expecting or what I'd need.

 

Is this normal or should we try to find an issue here?

 

Other than that, the library seems very nice. Good job, and thank you for sharing it with us.

 

EDIT: "PRAGMA synchronous=OFF;" does speed it up to around 500 inserts per second which is already around half-way to what I need.

post-40060-0-55780200-1417336783_thumb.p

Edited by vekkuli

Share this post


Link to post
Share on other sites

This is a standard thing to learn with SQLite, which is an “ACIDâ€-compliant database.  The “D†is for durable; by default SQLite is durable against power-failure of the computer, meaning once a transaction has executed, in can be relied on to remain, and not be corrupted, even if power is lost in a subsequent transaction.  Durability requires that SQLite verify proper writing to hard disk, and as hard disks spin at about 100Hz, this mean that the number of durable transactions is limited to an order of 20 per second.

 

You can disable the durability requirement, but a better strategy is to group multiple INSERTs into a single transaction by wrapping them in BEGIN…COMMIT SQL statements.  See on of the Examples provided with the package to see how this is done (you just need to execute “BEGIN†before your loops and “COMMIT†after**).  For simple INSERTs, one should get greater than 100,000 per second.

 

**also see SAVEPOINTs in the www.SQLite.com documentation.

  • Like 1

Share this post


Link to post
Share on other sites

This is a standard thing to learn with SQLite, which is an “ACIDâ€-compliant database.  The “D†is for durable; by default SQLite is durable against power-failure of the computer, meaning once a transaction has executed, in can be relied on to remain, and not be corrupted, even if power is lost in a subsequent transaction.  Durability requires that SQLite verify proper writing to hard disk, and as hard disks spin at about 100Hz, this mean that the number of durable transactions is limited to an order of 20 per second.

 

You can disable the durability requirement, but a better strategy is to group multiple INSERTs into a single transaction by wrapping them in BEGIN…COMMIT SQL statements.  See on of the Examples provided with the package to see how this is done (you just need to execute “BEGIN†before your loops and “COMMIT†after**).  For simple INSERTs, one should get greater than 100,000 per second.

 

**also see SAVEPOINTs in the www.SQLite.com documentation.

 

Right you were. I was looking for the examples in the wrong place earlier. Grouping into a transactions definitely did the trick. Thank you very much for quick support.

Share this post


Link to post
Share on other sites

I wondered if anyone, who has used this package in real-world applications, would kindly review it on the Tools Network.  

 

Come on people, review it if you use it.

Share this post


Link to post
Share on other sites

I'm trying to use it on a Linux cRIO. The API VIs execute without errors (even the individual CLF nodes), but nothing gets written to disk. Even the "Example 1 -- Create Table.vi" example doesn't work when targeted to my cRIO. It does create a file on my Windows system.

 

Edit: Realized that SQLite3 wasn't installed on the target. Ran "opkg install sqlite3", which put the executable in /usr/bin, but that doesn't work like a shared library for the API. I think I need to get a .so onto the target and point to that in the "SQLite Library Path" parameter.

 

Edit 2 (SOLVED): The library is /usr/lib/libsqlite3.so . Provide that path to the API when opening/creating a file, and everything works great.

Edited by Stobber

Share this post


Link to post
Share on other sites

drjdpowell, that path ^^^ is the standard NI installation of SQLite3 on a cRIO target. (I'm using NI's opkg server to install the package.) Can you add that path as a default for the OS and targettype inside your API?

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use.