Package org.qdao

Examples of org.qdao.TableDescriptor


    }
  }

 
  public Integer count() {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    int result = -1;
    sql.append("SELECT COUNT(*) FROM ").append(table.name);
    try {
      prepare();
      rs = pstmt.executeQuery();
View Full Code Here


    return result;
  }

 
  public Integer count(String sqlPart) {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    int result = -1;
    sql.append("SELECT COUNT(*) FROM ").append(table.name).append(" WHERE ").append(sqlPart);
    try {
      pstmt = getDBEngine().getConnection().prepareStatement(sql.toString());
      rs = pstmt.executeQuery();
View Full Code Here

    return result;
  }

 
  public boolean create() {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append(SQLTigger.getOracleCreateTigger(table));
    try {
      pstmt = getDBEngine().getConnection().prepareStatement(sql.toString());
      pstmt.executeUpdate();
      return true;
View Full Code Here

    if (entity != clazz) {
      // logWarning("Your data is wrong!");
      logWarning("数据部匹配!");
      return false;
    }
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("DELETE FROM ").append(table.name).append(" WHERE ");
    for (int i = 0; i < table.primaryKeys.length; i++) {
      if (i != table.primaryKeys.length - 1) {
        sql.append(table.primaryKeys[i]).append(" = ? AND ");
      } else
View Full Code Here

      logWarning("数据未空或集合中没有数据");
      // logWarning("Datas is null or datas's length is zero!");
      return false;
    }
    Iterator<?> iter = datas.iterator();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    Field[] fs = entity.getDeclaredFields();
    if (fs.length != table.columns.length) {
      // logger.log(Level.WARNING,
      // "The object's fields can not match the table's columns!");
      logWarning(" 插入的数据项与表中的项不匹配");
View Full Code Here

    return true;
  }

 
  public boolean drop() {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("DROP TABLE ").append(table.name);
    try {
      prepare();
      pstmt.executeUpdate();
      return true;
View Full Code Here

    }
  }

 
  public boolean drop(boolean cascade) {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    if (cascade) {
      sql.append("DROP TABLE ").append(table.name).append(" CASCADE CONSTRAINTS");
    } else {
      sql.append("DROP TABLE ").append(table.name);
    }
View Full Code Here

    }
  }

 
  public boolean insert(T dto) {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    createInsertTigger(table);
    try {
      prepare();
      prepareStatement(table, dto);
      pstmt.executeUpdate();
View Full Code Here

      logWarning("数据未空或集合中没有数据");
      // logWarning("Datas is null or datas's length is zero!");
      return false;
    }
    Iterator<?> iter = dtos.iterator();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    Field[] fs = entity.getDeclaredFields();
    if (fs.length != table.columns.length) {
      // logger.log(Level.WARNING,
      // "The object's fields can not match the table's columns!");
      logWarning(" 插入的数据项与表中的项不匹配");
View Full Code Here

    logger.log(Level.WARNING, message);
  }

 
  public boolean exist() {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT ROWID FROM ").append(table.name);
    try {
      prepare();
      pstmt.executeUpdate();
      return true;
View Full Code Here

TOP

Related Classes of org.qdao.TableDescriptor

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.