I use SQLite database and some tables there with Float fields.
If i use just fields from tables - they are treated normally - as Float fields, but if i use them in some formula (like field1 * field2 or SUM(field1) ) UniDAC treats result as String field (Even if i cast result as float).
SQLite string field instead of float
Hello
We have checked this issue thoroughly. It seems like SQLite returns invalid data type for the column. I found the following information on the SQLite site:
http://www.sqlite.org/c3ref/column_blob.html:
We have checked this issue thoroughly. It seems like SQLite returns invalid data type for the column. I found the following information on the SQLite site:
http://www.sqlite.org/c3ref/column_blob.html:
So we should wait for the sqlite3_column_type function to be fixed.The sqlite3_column_type() routine returns the datatype code for the initial data type of the result column. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. The value returned by sqlite3_column_type() is only meaningful if no type conversions have occurred as described below. After a type conversion, the value returned by sqlite3_column_type() is undefined. Future versions of SQLite may change the behavior of sqlite3_column_type() following a type conversion.
Are you sure that there is no other workaround? Because tools like Firefox SQLite Manager addon (https://addons.mozilla.org/en-US/firefox/addon/5817/) and SQLiteman (http://sqliteman.com/) treats such fields correctly.
Hello,
We can't implement the kind of behavior the application you gave as an example has, because DataSet in Delphi should have only one type for a column, and we can't change it. In Delphi it is not allowed to change data type for a field in the column for each row, but as you can see, for example, in the SQLite Manager plugin, on the following data you get different data types in one column:
CREATE TABLE TEST (
ID INTEGER NOT NULL,
FLOAT1 FLOAT,
FLOAT2 FLOAT)
INSERT INTO TEST(ID) VALUES(1);
INSERT INTO TEST(ID, FLOAT1, FLOAT2) VALUES(2,2.3,1.2);
SELECT t.*, SUM(t.float1+t.float2) from test t group by t.id
so the fields FLOAT1 and FLOAT2 will be of string (ID=1) and float (ID=2) data types correspondingly, the 'SUM' fields will be of integer and float data types as well.
We can't implement the kind of behavior the application you gave as an example has, because DataSet in Delphi should have only one type for a column, and we can't change it. In Delphi it is not allowed to change data type for a field in the column for each row, but as you can see, for example, in the SQLite Manager plugin, on the following data you get different data types in one column:
CREATE TABLE TEST (
ID INTEGER NOT NULL,
FLOAT1 FLOAT,
FLOAT2 FLOAT)
INSERT INTO TEST(ID) VALUES(1);
INSERT INTO TEST(ID, FLOAT1, FLOAT2) VALUES(2,2.3,1.2);
SELECT t.*, SUM(t.float1+t.float2) from test t group by t.id
so the fields FLOAT1 and FLOAT2 will be of string (ID=1) and float (ID=2) data types correspondingly, the 'SUM' fields will be of integer and float data types as well.