Exemple #1
0
 public int update(Class<?> classOfT, Chain chain, Condition cnd) {
   if (chain.isSpecial())
     return Daos.updateBySpecialChain(this, getEntity(classOfT), null, chain, cnd);
   EntityOperator opt = _opt(classOfT);
   opt.addUpdate(chain, cnd);
   opt.exec();
   return opt.getUpdateCount();
 }
Exemple #2
0
 public int update(String tableName, Chain chain, Condition cnd) {
   if (chain.isSpecial()) return Daos.updateBySpecialChain(this, null, tableName, chain, cnd);
   EntityOperator opt = _optBy(chain.toEntityMap(tableName));
   if (null == opt) return 0;
   opt.addUpdate(cnd);
   opt.exec();
   return opt.getUpdateCount();
 }
Exemple #3
0
  public int updateRelation(Class<?> classOfT, String regex, Chain chain, Condition cnd) {
    if (chain.isSpecial()) throw Lang.noImplement();

    EntityOperator opt = this._opt(classOfT);

    opt.entity.visitManyMany(null, regex, doUpdateRelation(opt, chain, cnd));
    opt.exec();

    return opt.getUpdateCount();
  }
Exemple #4
0
 public void insert(String tableName, Chain chain) {
   if (chain.isSpecial()) {
     Daos.insertBySpecialChain(this, null, tableName, chain);
     return;
   }
   EntityOperator opt = _optBy(chain.toEntityMap(tableName));
   if (null == opt) return;
   opt.addInsert();
   opt.exec();
 }
Exemple #5
0
 public void insert(Class<?> classOfT, Chain chain) {
   if (chain.isSpecial()) {
     Daos.insertBySpecialChain(this, getEntity(classOfT), null, chain);
     return;
   }
   EntityOperator opt = _opt(classOfT);
   opt.myObj = chain;
   opt.addInsertSelfOnly();
   // insert(chain.toObject(classOfT));// TODO 这样的效率,未免太低了,需要改进
   opt.exec();
 }