Recent

Author Topic: Zeos - table name with JOIN  (Read 2957 times)

tomek

  • Jr. Member
  • **
  • Posts: 85
Zeos - table name with JOIN
« on: April 27, 2012, 09:57:55 pm »
I've sql query with JOIN tables, with SELECT table1.field table2.field

ZReadOnlyQuery1.Fields.DisplayName give me only field name.
How to get the name of the table to which each filed belongs ?

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Zeos - table name with JOIN
« Reply #1 on: April 27, 2012, 11:10:59 pm »
Try ZReadOnlyQuery1.Connection.Name

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

tomek

  • Jr. Member
  • **
  • Posts: 85
Re: Zeos - table name with JOIN
« Reply #2 on: April 27, 2012, 11:21:48 pm »
Try ZReadOnlyQuery1.Connection.Name

JD

Formating broke my post :), should be
Code: [Select]
ZReadOnlyQuery1.Fields[i].DisplayNameBy ZReadOnlyQuery1.Connection.Name  I get "ZConnection1" but I want to get name of the table.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Zeos - table name with JOIN
« Reply #3 on: April 28, 2012, 12:16:55 am »
AFAIK, this is only possible if you are using ZTable. ZReadOnlyQuery and ZQuery by design do not allow this since they execute SQL statements that contain the name of the table(s) on which the query is performed.
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

 

TinyPortal © 2005-2018