Package com.ketayao.ketacustom.generate.vo

Examples of com.ketayao.ketacustom.generate.vo.Table


  public GenerateFactory(Table table) {
    this.table = table;
  }
 
  private void init () {
    Table table = null;
    try {
      DataSource db = DbFactory.create();
      table = db.getTable(tableName);
      ConvertHandler.tableHandle(table);
    } catch (Exception e) {
View Full Code Here


  String t = "SYS_CODE";
  @Test
  public void test(){
    try {
      db = DbFactory.create();
      Table table = db.getTable(t);
      System.out.println(table.getColumns().toString());
      ConvertHandler.tableHandle(table);
      System.out.println(table.getColumns().toString());
    } catch (Exception e) {
      e.printStackTrace();
    }
   
  }
View Full Code Here

  String t = "sys_user";
  @Test
  public void test(){
    try {
      db = DbFactory.create();
      Table table = db.getTable(t);
      System.out.println(table.getColumns().toString());
      ConvertHandler.tableHandle(table);
      System.out.println(table.getColumns().toString());
    } catch (Exception e) {
      e.printStackTrace();
    }
   
  }
View Full Code Here

public class Mysql extends DataSource {

  @Override
  public Table getTable(String tableName) throws SQLException {
    connectionTest(conn);
    Table t = new Table(tableName);
    ResultSet rs = null;
    t.setColumns(new ArrayList<Column>());
    try {
      DatabaseMetaData dmd = conn.getMetaData();// 获取数据库的MataData信息
      rs = dmd.getColumns(null, "", tableName, "");
      getColumns(rs, t);
      rs = dmd.getPrimaryKeys(null, null, tableName);
      t.setPk(getPk(rs));
    } catch (SQLException e) {
      throw e;
    } finally {
      close(conn, null, rs);
    }
View Full Code Here

    try {
      DatabaseMetaData dmd = conn.getMetaData();
      rs = dmd.getTables("", "", "%", null);
      tables = new ArrayList();
      while (rs.next()) {
        Table t = new Table();
        t.setTableName(rs.getString("TABLE_NAME"));
        tables.add(t);
      }
    } catch (SQLException e) {
      throw e;
    } finally {
View Full Code Here

public class ConvertTest {

  @Test
  public void test(){
    try {
      Table t = new Table();
      t.setTableName(" ");
      ConvertHandler.tableHandle(t);
    } catch (Exception e) {
      e.printStackTrace();
    }
    assertEquals("sysRole", ConvertHandler.getEntityInstance("SysRole"));
View Full Code Here

    }

  }
  public Table getTable(String tableName) throws SQLException {
    connectionTest(conn);
    Table t = new Table(tableName);
    ResultSet rs = null;
    t.setColumns(new ArrayList<Column>());
    try {
      DatabaseMetaData dmd = conn.getMetaData();// 获取数据库的MataData信息
       /** 
             * 获取类别 
             */ 
            //rs=dbmd.getCatalogs();  
            /** 
             * 获取模式 
             */ 
            //rs=dbmd.getSchemas();  
            /** 
             * 限定获取表的类型 
             */ 
            /*String types[]={"TABLE","VIEW"};   */
              
            /** 
             * MySQL获取表信息 
             */ 
            //rs=dbmd.getTables("jxgl", null, null, types);           
            /** 
             * Oracle获取表信息 
             */ 
           /* rs=dmd.getTables(null, "TCSF", tableName, types);   */
            /** 
             * 以下部分为结果集解析 
             */ 
           /* ResultSetMetaData rsmd=rs.getMetaData();  
            int size=rsmd.getColumnCount();  
 
            List rows=new ArrayList();  
            Map item=null;  
            while(rs.next())  
            {  
                item=new HashMap();  
                for(int i=1;i<=size;i++)  
                {  
                    item.put(rsmd.getColumnName(i), rs.getString(i));  
                }  
                rows.add(item);  
            }  
            System.out.println(rows); */
           
           
      rs = dmd.getColumns(null, Resources.JDBC_USERNAME.toUpperCase(), tableName, null);
      getColumns(rs, t);
      rs = dmd.getPrimaryKeys(null, null, tableName);
      t.setPk(getPk(rs));
    } catch (SQLException e) {
      throw e;
    } finally {
      close(conn, null, rs);
    }
View Full Code Here

    try {
      DatabaseMetaData dmd = conn.getMetaData();
      rs = dmd.getTables("", "", "%", null);
      tables = new ArrayList();
      while (rs.next()) {
        Table t = new Table();
        t.setTableName(rs.getString("TABLE_NAME"));
        tables.add(t);
      }
    } catch (SQLException e) {
      throw e;
    } finally {
View Full Code Here

TOP

Related Classes of com.ketayao.ketacustom.generate.vo.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.