drjdpowell Posted December 17, 2016 Author Report Posted December 17, 2016 17 hours ago, Stobber said: djpowell, could you add support for extended error codes to this API? I'm struggling with a SQLITE_CANTOPEN error on a cRIO that never used to appear, and I don't have enough context to know what the heck is wrong. Also, could you modify SQLite.lvlib:Format Error.vi to yield the full call chain? Figuring out where an error came from without it is sometimes really hard. If you don't want to stringify the call chain all the time, maybe make it an option I can toggle on Open? I will do both those things. 1 Quote
drjdpowell Posted December 22, 2016 Author Report Posted December 22, 2016 On December 16, 2016 at 6:45 PM, Stobber said: djpowell, could you add support for extended error codes to this API? I'm struggling with a SQLITE_CANTOPEN error on a cRIO that never used to appear, and I don't have enough context to know what the heck is wrong. Also, could you modify SQLite.lvlib:Format Error.vi to yield the full call chain? Figuring out where an error came from without it is sometimes really hard. If you don't want to stringify the call chain all the time, maybe make it an option I can toggle on Open? See the 1.6.5 version now in the CR. I added the extended code in the Error Description, after the standard error description. So SQLITE_CANTOPEN(nnn), with nnn the full code, which you can lookup at http://www.sqlite.org/rescode.html. At some point, I’ll implement the Extended Error names, but I don’t have time now. 1 Quote
drjdpowell Posted April 12, 2017 Author Report Posted April 12, 2017 Note, the latest version, 1.7.2 just posted, includes a “Load Extended Math Functions” method, which loads an SQLite extension dll that adds a large set of math functions to the very limited set in standard SQLite. The functions are: Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi. String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr, padc, strfilter. Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile. Tested on Windows with LabVIEW 32-bit. Should work with 64-bit as I include the dll compiled with both witnesses, but I have not tested. See the provided example. 1 Quote
Maksim Kuznetsov Posted April 29, 2017 Report Posted April 29, 2017 Hello! In my project I created couple of tables with foreign keys. I enabled them using "PRAGMA foreign_keys = ON;". Foreign key constraints work when I try to add a row containing non-existent parent element, such query simply gets ignored without reporting an error. It makes it difficult to debug which query failed and why. After doing some research on why it happens, I found that foreign key constraint errors are part of "Extended Result Codes", (don't confuse with "Extended Error Codes"). By default "Extended Result Codes" are disabled as written here:Enable Or Disable Extended Result Codes In order to enable extended result codes the following function has to be called on the database handle:int sqlite3_extended_result_codes(sqlite3*, int onoff); Unfortunately I couldn't find an accessor method to get the database handle, so I had to modify your class and add additional method to it which enables the "Extended Result Codes". It is not the best solution and makes it difficult to share the code between machines. Is there a way to enable extended result codes without modifying the SQLite library source? SQLite is a great library, thank you James for it! Max 1 Quote
drjdpowell Posted April 30, 2017 Author Report Posted April 30, 2017 Hi Max, The actual bug, I think, was that “Step.vi” was ignoring errors outside of 1..99. It has a case structure that only passes those codes to the error-handling subVI (written, originally, because 100 and 101 are not errors). I have changed it so that the extended error codes are now passed (see version 1.7.3 just added to the LAVA CR). I tested it by making a foreign key error and it now works. 2 Quote
Maksim Kuznetsov Posted April 30, 2017 Report Posted April 30, 2017 This is great James! I have just tested and everything works perfectly! Thank you very much for being so responsive and helpful. Max Quote
joernheit Posted May 11, 2017 Report Posted May 11, 2017 (edited) On 30.4.2017 at 4:01 PM, drjdpowell said: Hi Max, The actual bug, I think, was that “Step.vi” was ignoring errors outside of 1..99. It has a case structure that only passes those codes to the error-handling subVI (written, originally, because 100 and 101 are not errors). I have changed it so that the extended error codes are now passed (see version 1.7.3 just added to the LAVA CR). I tested it by making a foreign key error and it now works. This also solved my problem while inserting an existing/equal record and waiting for an 'UNIQUE constraint failed'. Now it's in the error chain. Thanks a lot for this !. Jörn Edited May 11, 2017 by joernheit Quote
Jan_bee Posted August 18, 2017 Report Posted August 18, 2017 (edited) The read-only option seems to be doing the right thing from what I've tried so far. Thanks --------------------------------------------------------------------------------------------------------------- noi that o to dep | phu kien do choi xe hoi | noi that o to ha noi Edited August 18, 2017 by Jan_bee edit content Quote
Artem.Sh Posted October 16, 2017 Report Posted October 16, 2017 I have problems with the Cyrillic alphabet.The database successfully works with the text, but I can not create the database file in the folder with the name containing the Cyrillic.The sqlite open function produces an errorError 402873 ...SQLITE_CANTOPEN (14): unable to open database: C:\data\...\PґР°С,Р°\sys_bd.db where "дата" is a distorted folder name in Cyrillic. Quote
drjdpowell Posted October 16, 2017 Author Report Posted October 16, 2017 Can you attach an example VI that shows the problem? I can then debug the issue. Quote
Artem.Sh Posted October 18, 2017 Report Posted October 18, 2017 It seems that the problem occurs if the folder does not exist. If the folder already exists, the connection to the database is successful. Quote
drjdpowell Posted December 22, 2017 Author Report Posted December 22, 2017 Any objections to moving SQLite LabVIEW up to LabVIEW 2013 (from the current 2011)? Quote
GregSands Posted January 2, 2018 Report Posted January 2, 2018 Sounds reasonable. Even NI only supports four versions for some of its modules (e.g. Vision Development Module), so I've finally jumped from 2012 to 2017. Is there a way to keep the current install available in VIPM if using LabVIEW <2013? Quote
hooovahh Posted January 2, 2018 Report Posted January 2, 2018 VIPM keeps a cache of all versions, of all packages installed, locally. So if you've ever installed the package, and then installed a new one, then from VIPM you should be able to right click the package and choose to install a different one. In 2017 both will show up as able to be installed, and in 2013 only the one compatible one will show up. Quote
dest2ko Posted March 13, 2018 Report Posted March 13, 2018 Forgive my ignorance here, as databases are currently way over my head. My initial reason for viewing this thread was in search of a library whose functions could run on a cRIO-9068 (Linux) controller to write system data snapshot updates to another system (a freebsd box, lets say.) Would this library work on a linux cRIO? The tutorial videos I've watched on the sqlite library look really promising for my application needs. Quote
drjdpowell Posted March 13, 2018 Author Report Posted March 13, 2018 SQLite isn't a database server; it's intended to be accessed only locally, not over the network. See https://www.sqlite.org/whentouse.html. Quote
JamesMc86 Posted May 3, 2018 Report Posted May 3, 2018 Hi James, I've seen you show off some cool demos with the JSON extensions. Is there any instruction on how to include that in this library? Cheers, James Quote
smithd Posted May 3, 2018 Report Posted May 3, 2018 On 11/28/2015 at 0:47 PM, drjdpowell said: A beta version of 1.6 is posted here. If you ignore the newest features, you could use this in production code; it has the latest SQLite 3.9.2, including the interesting JSON1 extension. ^^I think its already compiled in Try creating a memory database and executing one of the sample queries like "json_array_length('[1,2,3,4]')" which should return 4. If I'm remembering correctly, these queries just worked with the vi package. Quote
drjdpowell Posted May 3, 2018 Author Report Posted May 3, 2018 (edited) It is built in. Just use it. BTW, Something not built in is the extended math functions (log, sin, stdev, and the like). But I include a vi for loading that: Edited May 3, 2018 by drjdpowell Quote
mischl Posted August 24, 2018 Report Posted August 24, 2018 Quote Any objections to moving SQLite LabVIEW up to LabVIEW 2013 (from the current 2011)? late answer.... LabVIEW 2014 will be important to support a long time as it is the version of LabVIEW Home... Quote
mischl Posted November 15, 2018 Report Posted November 15, 2018 We have an existing exe out in the field with the appropriate dll folder beside - I guess the version is about two years old. There are several installations. If now a new package built with a newer wrapper version in LabVIEW will be distributed, but a user replaces only the exe and misses the dll, is there a problem with the existing functionality (nothing new on the database part has been added)? Is it backward compatible or should the SQLite version - which is available and goes hand in hand with the wrapper - be checked? thanks Quote
drjdpowell Posted November 15, 2018 Author Report Posted November 15, 2018 The dll should be automatically included in any exe; does that not happen with you? I have not tried using older dlls, but I suspect the would work. Quote
Gepponline Posted November 30, 2018 Report Posted November 30, 2018 Hi, i would like to use your library to save images on a field of a table in SQLite. Is it possible? How should I do? thank you so much. Quote
drjdpowell Posted November 30, 2018 Author Report Posted November 30, 2018 Save your image files in binary Blobs. Quote
infinitenothing Posted December 6, 2018 Report Posted December 6, 2018 The attached code shows how SQLite will interpret various types into an integer. It makes me a little nervous that there's no warnings or other way to determine that a value might not match what was requested. I guess I could check every value for its column type. Is there an easier way that I'm missing? Quote
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.