Michele Posted May 30, 2009 Report Share Posted May 30, 2009 Hello to everybody, I'm a newbie of Labview+MYSQL, and I need some help to this question. In an Datalog contest, I have a DB MYSQL and Labview 8.6.1 with Labview Database Connectivity Toolkit. Now, I'd store into a MYSQL BLOB columns a zip file (in binary form). How can i do this? Any ideas Thanks for the reply Michele Quote Link to comment
James Beleau Posted May 30, 2009 Report Share Posted May 30, 2009 I thought pure data had to be passed in as a string using a stored procedure. I recall there being some issue with special characters causing failures using normal SQL statements. Quote Link to comment
i2dx Posted May 31, 2009 Report Share Posted May 31, 2009 QUOTE (James Beleau @ May 29 2009, 09:21 PM) I thought pure data had to be passed in as a string using a stored procedure. I recall there being some issue with special characters causing failures using normal SQL statements. Although I never have tried this with mySQL I think it should work, if you pass the data as plain string (use the flatten to string primitive e.g.). You should read the mySQL documentation and find out what the "special characters" of the DB-Server are, which need to be "escaped" in the SQL-Statement. I assume that you need to insert a large amount of data, because you use a BLOB field? If not, and the data size is about "a few kilobytes" you could use a trick and convert the binary data to a string, then to an u8 array and the u8 array to a hex-string, which can be inserted into a text field without any hassle but almost doubles the size of the data. If you need an example you could download the http://www.ib-berger.com/index.php?action=adotool_en' rel='nofollow' target="_blank">ADO Toolkit, there is a function which exactly does this .. Quote Link to comment
Bruno Costa Posted June 1, 2009 Report Share Posted June 1, 2009 QUOTE (i2dx @ May 30 2009, 11:39 AM) Although I never have tried this with mySQL I think it should work, if you pass the data as plain string (use the flatten to string primitive e.g.). You should read the mySQL documentation and find out what the "special characters" of the DB-Server are, which need to be "escaped" in the SQL-Statement.I assume that you need to insert a large amount of data, because you use a BLOB field? If not, and the data size is about "a few kilobytes" you could use a trick and convert the binary data to a string, then to an u8 array and the u8 array to a hex-string, which can be inserted into a text field without any hassle but almost doubles the size of the data. If you need an example you could download the ADO Toolkit, there is a function which exactly does this .. Hi You can use this VI to escape special caracters Download File:post-15666-1243732790.vi I use it for storing XML data Bruno Quote Link to comment
Rolf Kalbermatter Posted June 9, 2009 Report Share Posted June 9, 2009 QUOTE (Michele @ May 29 2009, 10:36 AM) Hello to everybody, I'm a newbie of Labview+MYSQL, and I need some help to this question. In an Datalog contest, I have a DB MYSQL and Labview 8.6.1 with Labview Database Connectivity Toolkit. Now, I'd store into a MYSQL BLOB columns a zip file (in binary form). How can i do this? Any ideas Thanks for the reply Michele Not sure about MySQL but for SQL Server I have been able to insert binary data into a BLOB field by using the binary data syntax. Basically it is a conversion from the binary data into its HEX codes such that the binary data 0x12 0x34 0x56 is formatted into the string '0x123456' and added to the SQL INSERT statement. I'm pretty sure MySQL supports a similar syntax. Rolf Kalbermatter 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.