#1 2017-04-22 16:42:34

wienani
Member
Registered: 2012-08-31
Posts: 29

Help, SQLite Concatenation result cannot load to SynDBVCL

Example:
  SELECT Name||" / "||Code AS PartnerName FROM Partner.

Raise an error in (InternalInitFieldDefs) --> GetFieldData ColumnType = Unknown

Offline

#2 2017-04-22 17:06:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Help, SQLite Concatenation result cannot load to SynDBVCL

What do you call SynDBVCL?
What is the context?

Offline

#3 2017-04-22 17:18:30

wienani
Member
Registered: 2012-08-31
Posts: 29

Re: Help, SQLite Concatenation result cannot load to SynDBVCL

This is my code:

FProps := TSQLDBSQLite3ConnectionProperties.Create(FSession.PathSession + '\cache.dat','','','');
TSynDBSQLDataSet(Properties.ListSource.DataSet).Connection  := FProps;
TSynDBSQLDataSet(Properties.ListSource.DataSet).CommandText := 'SELECT ID, Level, Name||" / "||Code as PartnerName, Code FROM PARTNER WHERE Type=1';
Properties.ListSource.DataSet.Open;  --> error raise after open

Offline

#4 2017-04-22 21:23:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Help, SQLite Concatenation result cannot load to SynDBVCL

Are you sure Properties.ListSource.DataSetis a TSynDBSQLDataSet ?

Offline

#5 2017-04-23 04:02:42

wienani
Member
Registered: 2012-08-31
Posts: 29

Re: Help, SQLite Concatenation result cannot load to SynDBVCL

I'm sorry, here

Properties.ListSource := TDataSource.Create(Self);
Properties.ListSource.DataSet := TSynDBSQLDataSet.Create(Self);

FProps := TSQLDBSQLite3ConnectionProperties.Create(FSession.PathSession + '\cache.dat','','','');
TSynDBSQLDataSet(Properties.ListSource.DataSet).Connection  := FProps;
TSynDBSQLDataSet(Properties.ListSource.DataSet).CommandText := 'SELECT ID, Level, Name||" / "||Code as PartnerName, Code FROM PARTNER WHERE Type=1';
Properties.ListSource.DataSet.Open;  --> error raise after open

Is because SQLite is typeless ? so concatenation become unknown.

Using SQLiteStudio to identify my query, the result is unknown too for concatenation.

But when SELECT typeof( Name||" / "||Code) ... , the result is TEXT.

Sorry for my English

Offline

#6 2017-04-23 11:48:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Help, SQLite Concatenation result cannot load to SynDBVCL

I'm not able to reproduce it here.
I'm able to run requests like this:

select id, Name||"/"||Attributes as toto from Event where clid=10

Please try just

SELECT Name||" / "||Code FROM PARTNER WHERE Type=1

Are both Name and Code TEXT non NULL fields?

Offline

#7 2017-04-24 06:36:59

wienani
Member
Registered: 2012-08-31
Posts: 29

Re: Help, SQLite Concatenation result cannot load to SynDBVCL

ab wrote:

I'm not able to reproduce it here.
I'm able to run requests like this:

select id, Name||"/"||Attributes as toto from Event where clid=10

Yes, it will able to run, what i mean is toto is known as ftUnknown in TSynBinaryDataSet.InternalInitFieldDefs. it should be ftUTF8 or something known.

ab wrote:

Please try just

SELECT Name||" / "||Code FROM PARTNER WHERE Type=1

Are both Name and Code TEXT non NULL fields?

Yes, both are non NULL fields

Last edited by wienani (2017-04-24 06:39:33)

Offline

Board footer

Powered by FluxBB