SQLite Provider / Memo

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
porpoise
Posts: 2
Joined: Fri 21 Aug 2009 22:54

SQLite Provider / Memo

Post by porpoise » Fri 21 Aug 2009 23:44

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.

porpoise
Posts: 2
Joined: Fri 21 Aug 2009 22:54

More Info. - Workaround

Post by porpoise » Sat 22 Aug 2009 04:13

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?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 25 Aug 2009 08:27

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.

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Post by stevel » Sat 30 Jul 2011 17:24

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 03 Aug 2011 09:47

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;

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Post by stevel » Wed 03 Aug 2011 16:18

After changing field type from TEXT to VARCHAR will it UniDAC start recognizing it as String field (instead of Blob)?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 04 Aug 2011 08:04

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).

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Post by stevel » Mon 09 Apr 2012 15:44

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 10 Apr 2012 11:16

hello,

Thank you for the information.
We have reproduced and fixed the problem.
This fix will be included in the next build.

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Post by stevel » Tue 10 Apr 2012 11:37

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?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 10 Apr 2012 12:04

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

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Post by stevel » Tue 10 Apr 2012 12:12

Unfortunately I don't have the source code edition of UniDAC. Please state when we can expect the next version to be released.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 10 Apr 2012 12:28

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.

Post Reply