📄 mysqlcolumninfocache.java
字号:
package org.speedframework.cache.mysql;
import org.speedframework.cache.AbstractColumnInfoCache;
import org.speedframework.entity.CacheColumnBean;
import org.speedframework.utilities.StringUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Class MySQLColumnInfoCache
*
* @author <a href="mailto:santafeng@gmail.com"> lizf </a>
* @version $Revision:1.0.0, $Date: 2007-10-9 8:19:16 $
*/
public class MySQLColumnInfoCache extends AbstractColumnInfoCache {
/* (非 Javadoc)
* @see org.speedframework.cache.IColumnInfoCache#putColumnInfo(java.lang.Object, java.util.List)
*/
public void putColumnInfo(Object table, List columnInfo) throws Exception {
List colunm = null;
String tableName = StringUtils.getExcuteTableName(table.getClass());
Iterator it = columnInfo.iterator();
if (it.hasNext()) {
colunm = new ArrayList();
}
while (it.hasNext()) {
Map entity = (Map) it.next();
String columnName = (String) entity.get("field");
String primaryKey = (String) entity.get("key");
String dataType = (String) entity.get("type");
String autoincrement = (String) entity.get("extra");
CacheColumnBean ccb = new CacheColumnBean();
ccb.setColumnname(columnName.toLowerCase());
ccb.setDatatype(dataType.toLowerCase());
if ((primaryKey != null) && primaryKey.toLowerCase().equals("pri")) {
ccb.setPrimarykey(true);
}
if ((autoincrement != null)
&& autoincrement.toLowerCase().equals("auto_increment")) {
ccb.setAutoincrement(true);
}
colunm.add(ccb);
}
ca.save(tableName, colunm);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -