Sergey Kolbunov Posted August 21, 2010 Report Share Posted August 21, 2010 Need to store clusters is MySQL database. I don't want to store a whole cluster, but just some of cluster's elements what need to be checked in test. So far I'm thinking about XML and .ini file formats. Quote Link to comment
Yair Posted August 22, 2010 Report Share Posted August 22, 2010 What do XML and INI files have to do with the DB? If you want to interact with the DB, you usually need to go through ADO (assuming you're on Windows). There are several DB toolkits available for LV, including a paid one from NI and a free one called LabSQL. The NI toolkit has some advantages in that it is supported and that it has built-in code for inserting clusters into DB tables. If you really want, you can recreate this code fairly easily yourself by modifying the OpenG variant configuration VIs or the MGI read-write anything VIs. Also, note that the NI toolkit has a bug which will probably not allow you to use the insert VI without modifying the toolkit code. Since you only want part of the cluster, however, you're going to have to strip the relevant values out anyway. The easiest is probably to unbundle them, convert them to strings and then build an SQL insert query. Another option would be to flatten the variant to a string, but this will have issues if you plan on changing the value of the variant and will make the data useless in the DB itself. If you don't know SQL at all, now's the time to start searching for tutorials. Quote Link to comment
Sergey Kolbunov Posted August 23, 2010 Author Report Share Posted August 23, 2010 I'm using NI toolkit to interact with DB. Most of time I just execute my own SQL queries and don't use NI toolkit's select or insert or other built in utilities. Sorry, I can not find any built-in code for inserting clusters into DB tables in the NI DB toolkit. OpenG variant configuration looks like what I need to manipulate with cluster's data. To clarify my question, I'm looking for known and proven DB schemas to store LabVIEW clusters in Database, may be some examples to learn from. Store as key=value list in a string field? Quote Link to comment
Yair Posted August 23, 2010 Report Share Posted August 23, 2010 The DB toolkit has a VI called Insert Data which has a variant input. You can input a cluster into that variant and the VI will parse the cluster and insert one element into each column. This, of course, requires you to model the cluster after the table's structure. Quote Link to comment
Sergey Kolbunov Posted August 23, 2010 Author Report Share Posted August 23, 2010 The DB toolkit has a VI called Insert Data which has a variant input. You can input a cluster into that variant and the VI will parse the cluster and insert one element into each column. This, of course, requires you to model the cluster after the table's structure. I got it, thank you. 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.