Package org.qdao

Examples of org.qdao.TableDescriptor$ColumnDescription


    p.logicalName = "wamnet";
    p.description = "The WAMNET Project";

    Class<?> tableClazz = p.getClass();

    TableDescriptor tableDescriptor = getTableDescriptor(tableClazz);

    // output the table's descriptor
    print("TABLE'S NAME " + tableDescriptor.name +
        " \t TABLE'S DESCRIPTION " + tableDescriptor.description);
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 static void print(Object o) {
    System.out.println(o);
  }

  public static TableDescriptor getTableDescriptor(Class<?> tableClazz) {
    TableDescriptor tableDescriptor = new TableDescriptor();

    Table table = (Table) tableClazz.getAnnotation(Table.class);
    if (table != null) {
      tableDescriptor.name = table.name();
      tableDescriptor.description = table.description();
View Full Code Here

    }
  }

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

  }

 
  public boolean insert(List<?> dtos) {
    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 TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = '")
    .append(dbEngine.getConfig().getSchema())
    .append("' and TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME = '").append(table.name).append('\'');
    String result = null;
    try {
View Full Code Here

    return null != result && result.equalsIgnoreCase(table.name);
  }

 
  public boolean lock(boolean share) {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    if (share)
      sql.append("LOCK TABLE ").append(table.name).append(" IN SHARE MODE");
    else
      sql.append("LOCK TABLE ").append(table.name).append(" IN EXCLUSIVE MODE");
    try {
View Full Code Here

    }
  }

 
  public boolean lock(int timeout) {
    TableDescriptor table = dbEngine.getTableDescriptor(entity);
    if (timeout <= 0)
      sql.append("SELECT * FROM ").append(table.name).append(" FOR UPDATE");
    else
      sql.append("SELECT * FROM ").append(table.name).append(" FOR UPDATE " + timeout);
    try {
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

    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

TOP

Related Classes of org.qdao.TableDescriptor$ColumnDescription

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.