Arsip: Get Tablename di Zeos ???

 
user image
more 17 years ago

Manz

Master Delphi ... gimana caranya ngambil nama table hasil dari SQL di ZQuery. seperti ngambil fields, tapi ini mah ngambil nama table nya... Kan, kalo ngambil field begieu :

ZQuery.FieldCount 
...
ZQuery.Fields[i].FieldName
Nah, ada gak yach kalo ZQuery.TableCount trus ZQuery.Tables[i].TableName ????
user image
more 17 years ago

DelphiExpert

:mrgreen:

procedure GetTableNames(Connection: TZConnection; List: TStrings);
var
  Metadata: IZDatabaseMetadata;
  ResultSet: IZResultSet;
  Types: TStringDynArray;
  TBName: string;
begin
  List.Clear;
  Metadata := Connection.DbcConnection.GetMetadata;
  SetLength(Types, 2);
  Types[0]:= 'TABLE';
  Types[1]:= 'VIEW';
  ResultSet := Metadata.GetTables('', '', '', Types);
  try
    while ResultSet.Next do
    begin
      TBName:= ResultSet.GetStringByName('TABLE_NAME');
      if List.IndexOf(TBName) < 0 then
        List.Add(TBName);
    end;
  finally
    ResultSet.Close;
  end;
end;
user image
more 17 years ago

deLogic

Thats right brother.. :) cara lainnya, tetap menggunakan metadata (walaupun intinya juga akan panggil statement Metadata.GetTables)...: SourceTables : TZSQLMedataData Set property MetadataType ke mdTables jika ingin menampilkan tabel saja tanpa view, set property Filter menjadi '(TABLE_TYPE = ' + QuotedStr('TABLE') + ')' tinggal aktifkan query dan iterasi sampai EOF.
user image
more 17 years ago

Manz

:mrgreen: Tank-Q master Delphi ... Tapi kalo langsung ada gak yach ???

ZQuery.TableCount 
... ZQuery.Tables[i].TableName
:mrgreen:
user image
more 17 years ago

DelphiExpert

wrap aja sendiri hehehe :mrgreen:
user image
more 17 years ago

deLogic

wakakaa.... Manz.. kalo dikau pengen bikin wrapper.. kalo pake Delphi 2005 keatas, dikau bisa manfaatkan ClassHelper.. jika versi dibawahnya, bikin aja Interposer Class. :D
user image
more 17 years ago

Manz

ClassHelper ... wah dimana tuh ... maklum ... masih newbie ... :mrgreen:
user image
more 17 years ago

deLogic

@Manz.. mending dikau baca ini deh, gak promosi lho.. :D http://blog.bprasetio.or.id/2007/04/02/class-helper/ dan http://blog.bprasetio.or.id/2007/04/04/overloading-default-array-properties/
user image
more 17 years ago

ImanD

xixiixix sama daku juga blom pernah manfaatin Interposer Class n ClassHelper.
@manz_delphi: :mrgreen: Tank-Q master Delphi ... Tapi kalo langsung ada gak yach ???

ZQuery.TableCount 
... ZQuery.Tables[i].TableName
:mrgreen:
yg pasti yg seperti itu emang ga ada bawaan delphi-nya langsung. @deLogic u/ Interposer Class sama sajakah seperti itu prosesnya?
user image
more 17 years ago

deLogic

@ImanD: maksudnya interposer class sama dengan ClassHelper..? Secara tujuan sih sama, yaitu way to extend a class.. tapi secara arsitektur mungkin sedikit berbeda, saya belum tahu persis internal kompilasi ClassHelper, jadi begini: Interposer Class: a way to extend a class using inheritance ClassHelper: a way to extend a class without using inheritance
more ...
  • Pages:
  • 1
  • 2
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com