Using SVN 3994 of Zeos library, Lazarus 1.8.0RC2 SVN 55228 on Raspberry Pi 3. Database system is PostgreSQL 9.4.12 installed using apt-get on same Raspberry system.
When converting my current code from SQLdb to Zeos, I got rather strange problem and I am not sure if this is a zeos bug or something else.
I have below table in my database with some records in it (inserted before using SQLdb):
Code: Select all
CREATE TABLE sayimbaslik
(
autoinc serial NOT NULL,
serino character varying(20),
id uuid NOT NULL,
ameliyathane character varying(20),
hekim character varying(40),
scrub character varying(40),
sirkule character varying(40),
ameliyatadi character varying(20),
tarih date,
hastano character varying(20),
onayzamani timestamp without time zone,
durum smallint,
kayitzamani timestamp without time zone DEFAULT now(),
yazdirildi smallint DEFAULT 0,
sonyazdirma timestamp without time zone,
CONSTRAINT sayimbaslik_pkey PRIMARY KEY (id)
)
Code: Select all
select * from sayimbaslik where id = :id
Code: Select all
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
Guid: TGuid;
begin
CreateGUID(Guid);
ZQuery1.Params[0].AsString := GuidToString(Guid);
ZQuery1.Open();
end;
Code: Select all
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
ShowMessage(ZQuery1.FieldByName('id').AsString);
end;
Code: Select all
2017-06-15 13:13:48 cat: Connect, proto: postgresql-9, msg: CONNECT TO "mydb" AS USER "postgres"
2017-06-15 13:13:48 cat: Execute, proto: postgresql-9, msg: select setting from pg_settings where name = 'bytea_output'
2017-06-15 13:13:48 cat: Execute, proto: postgresql-9, msg: SELECT version()
2017-06-15 13:13:48 cat: Execute, proto: postgresql-9, msg: SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED
2017-06-15 13:13:50 cat: Prepare, proto: postgresql-9, msg: Statement 1 : select * from sayimbaslik where id = ?
2017-06-15 13:13:50 cat: Bind prepared, proto: postgresql-9, msg: Statement 1 : '{2E964560-F194-4F1C-B96A-43B96452F9BC}',
2017-06-15 13:13:50 cat: Execute, proto: postgresql-9, msg: select pc.relname, pns.nspname, pa.attnum, pa.attname from pg_catalog.pg_class pc join pg_catalog.pg_namespace pns on pc.relnamespace = pns.oid join pg_catalog.pg_attribute pa on pa.attrelid = pc.oid where pc.oid = 17030 and pa.attnum > 0
2017-06-15 13:13:50 cat: Execute prepared, proto: postgresql-9, msg: Statement 1
2017-06-15 13:13:50 cat: Prepare, proto: postgresql-9, msg: Statement 2 : SELECT n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull,a.atttypmod,a.attlen,a.attnum,pg_get_expr(def.adbin, def.adrelid) as adsrc,dsc.description FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') WHERE a.attnum > 0 AND NOT a.attisdropped AND c.relname = E'sayimbaslik' ORDER BY nspname,relname,attnum
2017-06-15 13:13:50 cat: Execute prepared, proto: postgresql-9, msg: Statement 2
2017-06-15 13:13:50 cat: Execute, proto: postgresql-9, msg: SELECT oid, typname, typbasetype,typtype FROM pg_type WHERE (typtype = 'b' and oid < 10000) OR typtype = 'p' OR typtype = 'e' OR typbasetype<>0 ORDER BY oid
2017-06-15 13:13:50 cat: Execute, proto: postgresql-9, msg: DEALLOCATE "2249064721";
Code: Select all
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
Guid: TGuid;
begin
CreateGUID(Guid);
ZQuery1.SQL.Text := 'create table if not exists test2(id uuid not null primary key, acol integer)';
ZQuery1.ExecSQL();
ZQuery1.SQL.Text := 'insert into test2 values(:id, 3)';
ZQuery1.Params[0].AsString := GuidToString(Guid);
ZQuery1.ExecSQL();
ZQuery1.SQL.Text := 'select * from test2 where id = :id';
ZQuery1.Params[0].AsString := GuidToString(Guid);
ZQuery1.Open();
// I can see id field in dbgrid and records just fine
end;
Any help is appreciated.
EDIT: I confirm that I do not have id field when I do a "select * from" with Lazarus 1.8.0RC1 64bit, running on Windows 10 64bit.