#1  
Old 6th April 2017, 12:52 AM
Milan.Hora Milan.Hora is offline
Junior Member
 
Join Date: Oct 2016
Posts: 6
Default Exceptions when loading data to DataTable

Hello,
I received few exceptions when using ADO Provider (4.0.0.306) for simple SELECT.

Test table:
Code:
CREATE TABLE Akcelog2
(
  Akce SMALLINT NOT NULL DESCRIPTION '#V220',
  DatTim TIMESTAMP NOT NULL,
  Autor SMALLINT,
  Popis SHORTSTRING(100)
);
CREATE UNIQUE INDEX "FF$PRIMARY" ON Akcelog2(Akce DESC, DatTim DESC);
Test data:
Code:
INSERT INTO Akcelog2 (Akce, DatTim, Autor, Popis) VALUES (1,CURRENT_TIMESTAMP,2,'b');
INSERT INTO Akcelog2 (Akce, DatTim, Autor, Popis) VALUES (1,CURRENT_TIMESTAMP,3,'b');
First query tested in WebDemo1 example = System.ArgumentException (from DateTime to Int16)):
Code:
select DatTim, Akce, Popis, Autor from Akcelog2
It looks that order of columns is important...

Second query tested in WebDemo1 example = System.Data.ConstraintException
Code:
select Akce, DatTim, Autor, Popis from Akcelog2
It looks that index is somehow broken...
  #2  
Old 6th April 2017, 03:34 AM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Exceptions when loading data to DataTable

> First query tested in WebDemo1 example = System.ArgumentException (from
> DateTime to Int16)):
>
> Code:
> --------------------
> select DatTim, Akce, Popis, Autor from Akcelog2
> --------------------
>
> It looks that order of columns is important...


I'm still looking into this one. I can reproduce it.

> Second query tested in WebDemo1 example =
> System.Data.ConstraintException
>
> Code:
> --------------------
> select Akce, DatTim, Autor, Popis from Akcelog2
> --------------------
>
> It looks that index is somehow broken...


Your unique index is on Akce and DatTim. Because of how you created the two
records, the Akce value is identical, and the DatTim value is very very close
togehter, but not identical.

If I modify one of the two values by a second, this error does not occur.

By checking

((DateTime)r.GetValue(1)).Ticks.ToString()

(against the original table where the values are very close together) I have
verified that the values returned by the data reader for the two rows are
distinct and exact. No truncation takes place inside the data provider.

The DataTable sees the index definition on the source table, and tries to
enforce this as a constraint on the in-memory data loaded into it. Somewhere
inside the DataTable, after the exact value has been returned by the
NxDataReader, the value gets either stored truncated to whole seconds, or when
performing the comparison to enforce the constraint the comparison is only
taking place up to full seconds.

As far as I can tell, this is nothing that I can affect from the provider. The
last time the provider has anything to do with the DateTime value is when it's
returned by the DataReader, and at that time it still has the full precission.

Cheers,
Thorsten
  #3  
Old 6th April 2017, 06:20 AM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Exceptions when loading data to DataTable

Thorsten Engler [NDA] wrote:

> > First query tested in WebDemo1 example = System.ArgumentException (from
> > DateTime to Int16)):
> >
> > Code:
> > --------------------
> > select DatTim, Akce, Popis, Autor from Akcelog2
> > --------------------
> >
> > It looks that order of columns is important...

>
> I'm still looking into this one. I can reproduce it.


Fixed for the next release, the schema table returned by the reader specified
the columns in order of the base table, not in order of the result set.

> > Second query tested in WebDemo1 example =
> > System.Data.ConstraintException
> >
> > Code:
> > --------------------
> > select Akce, DatTim, Autor, Popis from Akcelog2
> > --------------------
> >
> > It looks that index is somehow broken...

>


Fixed by not reporting unique indices under certain conditions. (In the same
cases where MS SQL Server doesn't report them either).

Could you please report your original problem description in our issue tracker?
(That way I can close it and it gets scheduled for QA Testing before the next
release).

Cheers,
Thorsten





  #4  
Old 6th April 2017, 04:57 PM
Milan.Hora Milan.Hora is offline
Junior Member
 
Join Date: Oct 2016
Posts: 6
Default

OK, let's make it more clear:

Code:
CREATE TABLE Akcelog3
(
  Akce SMALLINT NOT NULL,
  Autor SMALLINT NOT NULL,
  Popis SHORTSTRING(100)
);

CREATE UNIQUE INDEX "FF$PRIMARY" ON Akcelog3(Akce DESC, Autor DESC);
Data:
Code:
INSERT INTO Akcelog3 (Akce, Autor, Popis) VALUES (1,2,'a');
INSERT INTO Akcelog3 (Akce, Autor, Popis) VALUES (1,3,'b');
Queries:
Code:
select Akce, Popis, Autor from Akcelog3
select Akce, Autor, Popis from Akcelog3


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading large data files into nxBlob Henry nexusdb.public.support 0 27th August 2014 02:09 AM
Blobs and DataTable.Load() - does it work? Rodrigo Gomez [NDX] nexusdb.public.support.adoprovider 6 10th May 2011 06:34 AM
Using Nexus DataTable with DA4 Jorge Matalonga nexusdb.public.support.thirdparty 1 20th June 2007 08:00 PM
Loading TStream with blob data from nxQuery Grant Brown nexusdb.public.support 3 29th September 2006 12:25 PM
Bug on loading MBCS field data hyun nexusdb.public.discussions 9 7th September 2006 02:33 AM


All times are GMT +11. The time now is 11:56 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.