PowerDesignerPDM中搜寻表名或字段名

Option   Explicit

ValidationMode   =   True

InteractiveMode =   im_Batch

Dim   mdl   '当前model

'获取当前活动model

Set   mdl   =   ActiveModel

If   (mdl   Is   Nothing)   Then

         MsgBox   "There   is   no   current   Model "

ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then '如果是处理pdm,这里换成PdPDM.cls_Model

         MsgBox   "The   current   model   is   not   an   Physical   Data   model. "

Else

         ProcessFolder   mdl

End   If

'   This   routine   copy   name   into   comment   for   each   table,   each   column   and   each   view

'   of   the   current   folder

Private   sub   ProcessFolder(folder)

         Dim   tab   '要处理的对象

'先处理每个实体或类的Name和Code dim tab

         for   each   tab   in  folder.tables

            if   not   tab.isShortcut   then             '先处理表名                

                   if instr(lcase(tab.name),"provides2") >0 then

                   msgbox folder. parent.name+"//"+folder.name+"//"+tab.name                    end if             end if

        next 

        '递归遍历子文件夹

         Dim   f   '子文件夹

         For   Each   f   In   folder.Packages

               if   not   f.IsShortcut   then

                     ProcessFolder   f

               end   if

         Next

   end   sub

转载于:https://www.cnblogs.com/mol1995/p/7169075.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要获取特定字段包含特定字符串的表名,你可以使用以下代码: ```java import java.sql.*; public class TableAndColumnNames { public static void main(String[] args) throws SQLException { // Replace the values below with your own database details String url = "jdbc:mysql://localhost:3306/mydatabase"; String username = "myusername"; String password = "mypassword"; String searchString = "AAA"; // The string you want to search for // Connect to the database Connection connection = DriverManager.getConnection(url, username, password); // Get the metadata of the database DatabaseMetaData metaData = connection.getMetaData(); // Get the table names String[] tableTypes = {"TABLE"}; ResultSet tables = metaData.getTables(null, null, "%", tableTypes); System.out.println("Table names:"); while (tables.next()) { String tableName = tables.getString("TABLE_NAME"); // Get the column names for each table ResultSet columns = metaData.getColumns(null, null, tableName, "%"); while (columns.next()) { String columnName = columns.getString("COLUMN_NAME"); String dataType = columns.getString("TYPE_NAME"); // Check if the column contains the search string if (columnName.contains(searchString)) { System.out.println("Table name: " + tableName); System.out.println("Column name: " + columnName); System.out.println("Data type: " + dataType); System.out.println(); } } } // Close the database connection connection.close(); } } ``` 在上面的代码,我们将字符串`AAA`存储在`searchString`变量。我们检索数据库的所有表和列,对于每个列,我们检查列名是否包含搜索字符串。如果包含,我们输出表名,列名和数据类型。 请注意,这只是一个示例代码,你需要将其修改为适合自己的数据库类型和表结构的代码。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值