07-04-2017 04:28 AM
Hello,
I am trying to read one sql file (.db). But from the data table I got wrong number in time stamp, the data is unix data time but Labview give me the same number in all the rows.
What is the problem?.
Regards.
07-04-2017
04:31 AM
- last edited on
05-05-2025
09:48 AM
by
Content Cleaner
That's the maximum size of an I32 variable. You need to read it as a longer datatype - the LabVIEW Timestamp is 128 bits.
A more detailed description of the Timestamp format is available here.
07-04-2017 11:09 AM
Thanks for reply!.
But, How I get the two integers I64 from 'Database Variant to Data'?.
I didnt get it.
Regards.
07-04-2017 11:19 PM
There's a snippet shown below with an array of clusters passed as the datatype to the DB Variant to Data. You can use this by appropriately filling the cluster constant (with datatypes for your result row), then right clicking and choosing Change to Array (to get an array, one element per row).
Here I used a Time Stamp Constant and a Double, which won't exactly work for you but gives you the idea. You probably want a cluster of Time Stamp Constant (or pair of I64, or just one I64 depending on the storage), 3 integers (I don't know the size, but you could try I32) and two floating point variables (probably double, but consider single if it doesn't work well for you).
You should make this cluster a typedef once you know the types you want.
07-05-2017 04:52 AM
Hello,
Yes, I tried to create constant cluster and put inside the stamp time constant and the 3 I32 and 3 Doubles.
Then this cluster of 7, put inside of array constant. But I got 0 readings. How I can do one pair of I64 for fist value in cluster?.
You can see with cluster of 7 elements inside 1D array I didnt get any data.
IF I remove the time stamp I got the numbers but I need more bits.
What is the wrong part?.
Thanks, Fred.
07-06-2017
06:33 AM
- last edited on
05-05-2025
09:48 AM
by
Content Cleaner
Try replacing the timestamp with a DBL value. It looks like your values line up with 64 bits for the time entry, but it's hard for me to guess further because I don't know how you created the table. At least in SQLite (perhaps not directly relevant here, but anyway...) I believe numeric fields take a width only as needed.
The LabVIEW Database Connectivity toolkit manual in chapter 4 discusses data types, but it doesn't seem very encouraging for forcing specific widths. It is worth noting that SQL supports a date/time format - but I guess you're not writing that 🙂
Copied from the manual:
All LabVIEW data types are supported but not necessarily in their native form. For example, bytes (U8 and I8) and words (U16 and I16) can be treated as longs (I32). The binary data type encompasses any piece of LabVIEW data, such as waveform, cluster, or array data, that cannot be represented natively in the database. Table 4-2 lists LabVIEW data types and the data types in the Database Connectivity Toolkit to which they correspond.
There's an accompanying table (4-2) which gives the conversion types. SGL and DBL probably match, most integer classes are probably I32. As I understand it, values in the upper half of U32 and (all) I/U64 are all stored as strings.
The manual continues with the following note:
You also can use the DB Tools Format Datetime Str VI to insert date/time strings into a database. The DB Tools Format Datetime Str VI formats a string into the correct format for SQL. This VI places a header at the beginning of the string that is later decoded in other VIs to determine that the string is a date/time string. Refer to the Formatting Date and Time section of Chapter 6, Using the Database Connectivity Toolkit Utility VIs, for more information about using the DB Tools Format Datetime Str VI to format date and time in a database.
07-06-2017 07:38 AM
Thanks for your time and help!.
I tried everything but I dont know what happens.
I attached the vi, with the data entry.
If you can look at this...
Regards.
07-07-2017 06:33 AM
They're saved in the cluster constant as type VT_I4, which is a 32 bit signed integer (I32). The database presumably is storing them as something longer (or at least, differently) to be able to get larger values.
07-08-2017 01:47 PM
Yes, I checked it. But like you looked in capture, the SQLite Expert software read it perfectly.
So the problem is Database Toolkit from Labview. I dont know if It need to fix the entries or use any query to get the data stamp correctly.
Regards and Thanks.
07-08-2017 07:56 PM