Page 1 of 1
SQLite Provider / Memo
Posted: Fri 21 Aug 2009 23:44
by porpoise
I have connected a TDBLookupComboBox to a TUniQuery object connected to an TUniConnection using the SQLite provider. I am attempting to show a field called "Name" of type TEXT as a lookup field in the TDBLookupComboBox, but the lookup field is displayed as "(Memo)" instead of the field's contents. I suspect the TDBLookupComboBox thinks the field is a CLOB since SQLite doesn't differentiate between text and a CLOB ... and hence the "(Memo)" text.
If I use a memory table and have the Name field defined as String, it works as expected.
Any suggestions for a way around this would be appreciated.
I'm using the 2.70.0.9 UniDAC demo with Delphi 2009 Pro.
More Info. - Workaround
Posted: Sat 22 Aug 2009 04:13
by porpoise
I was able to get the following to work to obtain a lookup value:
Code: Select all
SELECT ID, CAST(Name AS VarChar(255)) AS Name
FROM MyTable
By casting the Name field (defined as TEXT in SQLite) as a VarChar in SQL, it will display properly in the TDBLookupComboBox. But this is not ideal ... anyone else have some ideas?
Posted: Tue 25 Aug 2009 08:27
by Plash
UniDAC always maps TEXT to TMemoField. You need to change data type of the field in the database or use any expression with this field in your SELECT query.
Posted: Sat 30 Jul 2011 17:24
by stevel
Plash wrote:UniDAC always maps TEXT to TMemoField. You need to change data type of the field in the database or use any expression with this field in your SELECT query.
I don't understand what you mean by "change data type of the field in the database" - what can you change to from TEXT?
Regards,
Steve F
Posted: Wed 03 Aug 2011 09:47
by AlexP
Hello,
As the TEXT field contains text data, you can change the type of this field to, for example, VARCHAR in the following way:
Code: Select all
CREATE TABLE t1(id integer,txt text);
.....
INSERT INTO t1................
....
CREATE TEMPORARY TABLE t1_backup(id integer,txt varchar(255));
INSERT INTO t1_backup SELECT id,txt FROM t1;
DROP TABLE t1;
CREATE TABLE t1(id integer,txt varchar(255));
INSERT INTO t1 SELECT id,txt FROM t1_backup;
DROP TABLE t1_backup;
Posted: Wed 03 Aug 2011 16:18
by stevel
After changing field type from TEXT to VARCHAR will it UniDAC start recognizing it as String field (instead of Blob)?
Posted: Thu 04 Aug 2011 08:04
by AlexP
Hello,
Yes, if you change the field type from Text to VARCHAR, UniDAC will define it as TStringField or TWideStringField (depending on the settings of TUniConnection UseUnicode).
Posted: Mon 09 Apr 2012 15:44
by stevel
In the SQLite database I had a VARCHAR(255) field, when adding a TUniTable / TUniQuery component and click on 'Add all fields', it added the field as TWideStringField, which is correct.
However, when I increased the length of the field in the database from 255 to 4096, then when creating the fields again in the UniTable / UniQuery components, it creates the field as TMemoField.
Why is this happening and how can this be resolved? I need the fields to be string type and not memo.
Posted: Tue 10 Apr 2012 11:16
by AlexP
hello,
Thank you for the information.
We have reproduced and fixed the problem.
This fix will be included in the next build.
Posted: Tue 10 Apr 2012 11:37
by stevel
Since I need to deploy the app to my client urgently, is there any workaround I can use in the meantime to get the WideString field?
Posted: Tue 10 Apr 2012 12:04
by AlexP
Hello,
If you have UniDAC Edition with Source code, I can send the fix of this problem. Unfortunately, this problem cannot be solved without fixing the source code
Posted: Tue 10 Apr 2012 12:12
by stevel
Unfortunately I don't have the source code edition of UniDAC. Please state when we can expect the next version to be released.
Posted: Tue 10 Apr 2012 12:28
by AlexP
Hello,
Please send to alexp*devart*com your license number, IDE version and e-mail address to which I can send you the product with the fix.