Search found 194 matches

by sandy771
Tue 17 Jul 2018 12:44
Forum: Universal Data Access Components
Topic: exiting user defined function
Replies: 2
Views: 1097

exiting user defined function

I have a user defined function (defined using registerfunction) that returns a formatted string based on certain parameters that are passed to the function.

I can check the parameters and return an error string, on each iteration of the function, if a paramter is incorrect but I would rather abort the query at the first error and let my calling application provide a more comprehensive help message. Is this possible?

Thank You
by sandy771
Mon 10 Jul 2017 13:13
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Re: Problem adding calculated field to a query

All seems OK now thank you.
by sandy771
Wed 05 Jul 2017 11:49
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Re: Problem adding calculated field to a query

Thank you - got the email an hour ago
by sandy771
Wed 05 Jul 2017 08:29
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Re: Problem adding calculated field to a query

Hi Maxim

I filled in the form yesterday as requested, but have not received the night build yet. How do I get this?

The next stage of my development requires this fix so everything is on hold here :(

Cheers
Paul
by sandy771
Tue 04 Jul 2017 15:10
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Re: Problem adding calculated field to a query

Hi Maxim

Thank You for fixing this so promptly.

I have provided the details asked for via the support link.

Cheers
by sandy771
Tue 04 Jul 2017 09:24
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Re: Problem adding calculated field to a query

Thank You Maxim

I look forward to receiving a fix
by sandy771
Mon 03 Jul 2017 08:44
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Re: Problem adding calculated field to a query

Hi Maxim

Thank You

I have sent a sample simple project via the link (and sent the same by email on Friday afternoon last week).

Please let me know if there is anything else I can do

Paul
by sandy771
Wed 28 Jun 2017 22:25
Forum: Universal Data Access Components
Topic: Problem adding calculated field to a query
Replies: 12
Views: 2379

Problem adding calculated field to a query

I am having problems adding a calculated field to a query at run time

The following query fails with an exception

Code: Select all

	UniQuery1->SQL->Clear();
	UniQuery1->SQL->Text = "select count(*) as rowcount from sqlite_master"

	UniQuery1->FieldDefs->Update();
	TField *field;
	for (int f = 0; f < UniQuery1->FieldDefs->Count; f++)
		field = UniQuery1->FieldDefs->Items[f]->CreateField(UniQuery1);

	TIntegerField *field2;
	field2 = new TIntegerField(UniQuery1);
	field2->FieldName = "id";
	field2->FieldKind = fkCalculated;
	field2->DataSet = UniQuery1;

	UniQuery1->Open();

	while(!UniQuery1->Eof)
	{
		for(int i=0; i<UniQuery1->FieldCount; i++)
		{
			f = UniQuery1->Fields->FieldByNumber(i+1);     <-- results in exception "Error Field is not BLOB"
                }
        }

However if I do not add the additional integer field, and just execute the query it runs OK.

Code: Select all

	UniQuery1->SQL->Clear();
	UniQuery1->SQL->Text = "select count(*) as rowcount from sqlite_master"

	UniQuery1->Execute();


	TField *f;
	for(int i=0; i<UniQuery1->FieldCount; i++)
	{
		f = UniQuery1->Fields->FieldByNumber(i+1);
	}
Obviously I need to provide a value for the id field in OnCalcfields - but there is something else I am doing wrong
by sandy771
Wed 12 Oct 2016 10:24
Forum: Universal Data Access Components
Topic: Smart refresh
Replies: 1
Views: 1306

Smart refresh

I am probbaly being dull but i cannot find any documentationon the smart refresh feature - could someone please point me in the direction of it.

Other than how to use it I am interested in any limitations on its use.

Thanks
by sandy771
Fri 30 Sep 2016 10:13
Forum: Universal Data Access Components
Topic: Invalid floating point operation
Replies: 4
Views: 1714

Re: Invalid floating point operation

Hi Maxim

The issue is sorted - but everything you need to recreate the issue was in my initial post.

It's a three line program
by sandy771
Thu 29 Sep 2016 13:57
Forum: Universal Data Access Components
Topic: Invalid floating point operation
Replies: 4
Views: 1714

Re: Invalid floating point operation

Thank you - that worked
by sandy771
Thu 29 Sep 2016 11:38
Forum: Universal Data Access Components
Topic: Invalid floating point operation
Replies: 4
Views: 1714

Invalid floating point operation

Hi

Using UniDac SQLite with Builder XE3

Table with schema

CREATE TABLE unix10and13 (dt int)

with the data as below:
1234345087123

The following query causes an invalid floating point operation exception

UniQuery1->SQL->Clear();
UniQuery1->SQL->Add("select DateTime(unix10and13.dt, 'unixepoch') AS converted FROM unix10and13");
UniQuery1->Execute();

with the data as below the same query works fine.:
1234345087

In an SQLite shell the same query produces an erroneous date but does not cause an error

sqlite> select * from unix10and13;
1234345087123
sqlite> select DateTime(unix10and13.dt, 'unixepoch') AS converted FROM unix10and13;
-1413-03-01 13:07:12

This occurs in 6.4.14, 6.1.3 and 5.5.11

Thank You
by sandy771
Fri 18 Mar 2016 17:14
Forum: Universal Data Access Components
Topic: sqlite type affinity and multiple data types in one column
Replies: 16
Views: 3397

Re: sqlite type affinity and multiple data types in one column

Thanks for the feedback Alex.

Yes the issue with multiple data types in the same column is my problem and I do see it in third party databases.

I think I see what you are getting at. But if using your test data set I loop through each row using

Variant v;

while(!UniQuery1->Eof)
v=UniQuery1->FieldByName("test")->AsVariant;
UniQuery1->Next()

Then I can get at the correct value for each row as a variant in v

so is it not possible to update your Dac such

while(!UniQuery1->Eof)
v=UniQuery1->FieldByName("test")->AsVariant;
t=UniQuery1->FieldByName("test")->AsRawType;
UniQuery1->Next()

such that ->AsRawType returns the correct storage type used by SQLite?
by sandy771
Thu 17 Mar 2016 10:05
Forum: Universal Data Access Components
Topic: sqlite type affinity and multiple data types in one column
Replies: 16
Views: 3397

Re: sqlite type affinity and multiple data types in one column

Thanks Alex, that is correct and it is entirely the point of my request

While you can set a user type the underlying type, as returned by the sqlite function typeof(my_type1), is one of just 5 basic types that sqlite supports.

It is the basic underlying type that SQ:Lite chooses to store the data at a binary level that i am interested in. If I was not using UniDac but was using the SQLite library then I can get at this data using typeof(x).

It is this additional functionality that I need.
by sandy771
Fri 11 Mar 2016 17:03
Forum: Universal Data Access Components
Topic: sqlite type affinity and multiple data types in one column
Replies: 16
Views: 3397

Re: sqlite type affinity and multiple data types in one column

Hi Alex

The functionality I am suggesting is something along the lines of adding to the functionality of TUniQuery to allow me to a) determine what data type SQLite is actually using to store a particular value and b) get the correspondin value as a Variant.

so, one idea would be a function:

UniQuery->FieldByName("somefield")->GetRawType()

which would return either a string or better an integer that represented the type of data. The corrresponding function in SQLite is:

typeof(X) - The typeof(X) function returns a string that indicates the datatype of the expression X: "null", "integer", "real", "text", or "blob".

I would then need an associated function

UniQuery->FieldByName("somefield")->GetRawValue()

That would return a Variant with the value from the field, based on the type returned by GetRawType I could then take whatever action is appropriate with the Variant.

All of this would need to work irrespective of any DataTypeMapping rules and should allow me to detect any fields where someone has taken advantage of SQLites loose type affinity rules.

This is of course my suggestion of a way to resolve this - you may have a better idea :)

Thank You