PostgreSQL and UniLoader

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hughespa
Posts: 81
Joined: Sat 23 Aug 2008 08:36
Location: W. Australia

PostgreSQL and UniLoader

Post by hughespa » Tue 04 May 2010 06:26

Hi,

I have a simple Paradox table:

CREATE TABLE A_TEST
(
Item CHAR(30),
ItemValue INTEGER,
PRIMARY KEY (Item)
)

And a similar table in PostgreSQL but the itemvalue field a bigint rather than integer.

When I call UniLoader.LoadFromDataset I get the error:
EPgError with message 'insufficient data left in message'

It works OK if I have integer in source and destination tables.

Is there a way I can load integer field values into the bigint fields on PostgreSQL please?

Regards, Paul.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Thu 06 May 2010 13:33

Hello

I created the follow table:

Code: Select all

CREATE TABLE my_test
(
  Item character(30) NOT NULL,
  ItemIntValue integer,
  ItemBigIntValue bigint,
  CONSTRAINT pk_my_test PRIMARY KEY (item)
)
And insert data by the following code:

Code: Select all

procedure TForm1.UniLoader1PutData(Sender: TDALoader);
var
  i: integer;
begin
  for i := 1 to 10 do
  begin
    UniLoader1.PutColumnData('Item', i, 'item' + IntToStr(i));
    UniLoader1.PutColumnData('ItemIntValue', i, i);
    UniLoader1.PutColumnData('ItemBigIntValue', i, i);
  end;
end;
All data was inserted successfully.

You can try to insert your data by the following code:

Code: Select all

procedure TForm1.UniLoader1PutData(Sender: TDALoader);
begin
  SourceDataSet.First;
  while not SourceDataSet.Eof do
  begin
    UniLoader1.PutColumnData('Item', SourceDataSet.RecNo, SourceDataSet.FieldByName('Item').AsVariant);
    UniLoader1.PutColumnData('ItemValue', SourceDataSet.RecNo, SourceDataSet.FieldByName('ItemValue').AsVariant);
    SourceDataSet.Next;
  end;
end;

hughespa
Posts: 81
Joined: Sat 23 Aug 2008 08:36
Location: W. Australia

Post by hughespa » Thu 06 May 2010 13:45

Thanks Bork,

I'll try that.

Regards, Paul.

Post Reply