• FireDAC 之FDMetaInfoQuery


    FDMetaInfoQuery

    http://docs.embarcadero.com/products/rad_studio/firedac/frames.html

    http://docwiki.embarcadero.com/RADStudio/XE7/en/Metadata_Structure_(FireDAC)

    FireDAC 查询数据库表、存储过程、字段信息等

    MetaInfoKind属性有17种类型,获取数据库名称、表、字段、主键等信息。强大强大,不用写sql语句

    mkNone
    mkCatalogs
    mkSchemas
    mkTables
    mkTableFields
    mkIndexes
    mkIndexFields
    mkPrimaryKey
    mkPrimaryKeyFields
    mkForeignKeys
    mkForeignKeyFields
    mkPackages
    mkProcs
    mkProcArgs
    mkGenerators
    mkResultSetFields
    mkTableTypeFields

     FDMetaInfoQuery1->MetaInfoKind = mkTables;
     FDMetaInfoQuery1->Open();

    FDMetaInfoQuery1->MetaInfoKind = mkTableFields;
     FDMetaInfoQuery1->Open(edtTableName->Text);

     FDMetaInfoQuery1->MetaInfoKind = mkPrimaryKey;
     FDMetaInfoQuery1->Open(edtTableName->Text);

     FDMetaInfoQuery1->MetaInfoKind = mkPrimaryKeyFields;
     FDMetaInfoQuery1->Open(edtTableName->Text,PKName); ?? 怎么赋值参数

      AMIQ.CatalogName := edtCatalog.Text;
      AMIQ.SchemaName := edtSchema.Text;
      AMIQ.ObjectScopes := os;
      AMIQ.TableKinds := tk;

      miIndexFields.CatalogName := FixName(miIndexes.FieldByName('CATALOG_NAME').AsString);
      miIndexFields.SchemaName := FixName(miIndexes.FieldByName('SCHEMA_NAME').AsString);
      miIndexFields.BaseObjectName := FixName(miIndexes.FieldByName('TABLE_NAME').AsString);
      miIndexFields.ObjectName := FixName(miIndexes.FieldByName('INDEX_NAME').AsString);
      miIndexFields.Open;

     TFDConnection.GetTableNames('', '', '', lbxTables.Items);

    TFDConnection.GetFieldNames('', '', Items[ItemIndex], '', lbxFields.Items);
    TFDConnection.GetKeyFieldNames('', '', Items[ItemIndex], '', lbxKeyFields.Items);

  • 相关阅读:
    关于代码风格
    python笔记-glob模块
    python笔记-mysql安装与配置
    python笔记-shutil模块
    python笔记-os模块
    python笔记-内存分析
    python笔记-装饰器
    python笔记-正则表达式
    python笔记-迭代器-生成器-对象生成式
    python笔记-模块和包
  • 原文地址:https://www.cnblogs.com/cb168/p/4288512.html
Copyright © 2020-2023  润新知