Package org.qdao

Examples of org.qdao.TableDescriptor


 
  @SuppressWarnings("unchecked")
  public List<T> lock(String sqlPart) {
    List<T> list = new ArrayList<T>();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT * FROM ").append(table.name).append(" WHERE ")
        .append(sqlPart).append(" FOR UPDATE");
    // prepare the statement
    try {
      prepare();
View Full Code Here


  }

 
  public List<T> lock(String sqlPart, int timeout) {
    List<T> list = new ArrayList<T>();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT * FROM ").append(table.name).append(" WHERE ")
        .append(sqlPart).append(" FOR UPDATE ");

    // add the timeout
    if (timeout >= 0)
View Full Code Here

    Class<?> clazz = key.getClass();
    if (entity != clazz) {
      // logWarning("Your data is wrong!");
      logWarning("数据不匹配!");
    }
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT * 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

  }

 
  public List<T> select() {
    List<T> list = new ArrayList<T>();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT * FROM ").append(table.name);
    try {
      prepare();
      rs = pstmt.executeQuery();
      if (rs == null) {
View Full Code Here

 
  public List<T> select(IFetchHandler<T> filter) {
    // TODO filter begin
    filter.begin();
    List<T> list = new ArrayList<T>();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT * FROM ").append(table.name);
    try {
      prepare();
      rs = pstmt.executeQuery();
      if (rs == null) {
View Full Code Here

      return select();
    }
    sqlPart = sqlPart.toLowerCase();
    String sqlTrim = sqlPart.trim();
    List<T> list = new ArrayList<T>();
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append("SELECT * FROM ").append(table.name);
    if (sqlTrim.startsWith("limit")) {
      sql.append(' ' + sqlPart);
    } else if (sqlTrim.startsWith("order by"))  {
      sql.append(" ").append(sqlPart);
View Full Code Here

    Class<?> clazz = key.getClass();
    if (entity != clazz) {
      // logWarning("Your data is wrong!");
      logWarning("数据不匹配!");
    }
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    // generate the update sql
    List<Object> setValues = createUpdateTigger(table, key);
    // prepare the statement
    try {
      prepare();
View Full Code Here

 
  public boolean update(List<T> datas) {
    Iterator<?> iter = datas.iterator();
    Connection connection = null;
    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

  }

  public List<T> selectNative(String nativeSql) {
    List<T> list = new ArrayList<T>();
    Class<?> clazz = null;
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    sql.append(nativeSql);
    // prepare the statement
    try {
      prepare();
    } catch (SQLException e1) {
View Full Code Here

    }
    return false;
  }

  public T selectByPrimaryKey(Object... objects) {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    int len = table.pks.length;
    if (objects.length != len){
      return null;
    }
    sql.append("SELECT * FROM ").append(table.name).append(" WHERE ");
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.