文章列表
public class Main {
private static final int PORT = 8080;
public static void main(String[] args) throws Exception {
NioSocketAcceptor acceptor = new NioSocketAcceptor();
// Prepare the configuration
acceptor.getFilterChain().addLast("logger", new LoggingFil ...
创建索引
/**
* @author wanghuan
* @description 创建索引
* @throws CorruptIndexException
* @throws LockObtainFailedException
* @throws IOException
*/
public void createIndex() throws CorruptIndexException, LockObtainFailedException, IOException{
List<Hospital> list=Database.query();
/ ...
MySQL 自4.1版以后开始支持INSERT … ON DUPLICATE KEY UPDATE语法,使得原本需要执行3条SQL语句(SELECT,INSERT,UPDATE),缩减为1条语句即可完成。
例如ipstats表结构如下:
引用
CREATE TABLE ipstats (
ip VARCHAR(15) NOT NULL UNIQUE,
clicks SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0'
);
原本需要执行3条SQL语句,如下:
IF (SELECT * FROM ipstats WHERE ip='192.168.0.1') ...