⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbstate.java

📁 非常棒的java数据库
💻 JAVA
字号:
/*
 * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
 * (license2)
 * Initial Developer: H2 Group
 */
package org.h2.test.synth.sql;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * Represents a connection to a simulated database.
 */
public class DbState implements DbInterface {

    private TestSynth config;
    private ArrayList tables = new ArrayList();
    private ArrayList indexes = new ArrayList();
    boolean connected;
    boolean autoCommit;

    DbState(TestSynth config) {
        this.config = config;
    }

    public void reset() throws SQLException {
        tables = new ArrayList();
        indexes = new ArrayList();
    }

    public void connect() throws SQLException {
        connected = true;
    }

    public void disconnect() throws SQLException {
        connected = false;
    }

    public void createTable(Table table) throws SQLException {
        tables.add(table);
    }

    public void dropTable(Table table) throws SQLException {
        tables.remove(table);
    }

    public void createIndex(Index index) throws SQLException {
        indexes.add(index);
    }

    public void dropIndex(Index index) throws SQLException {
        indexes.remove(index);
    }

    public Result insert(Table table, Column[] c, Value[] v) throws SQLException {
        return null;
    }

    public Result select(String sql) throws SQLException {
        return null;
    }

    public Result delete(Table table, String condition) throws SQLException {
        return null;
    }

    public Result update(Table table, Column[] columns, Value[] values, String condition) {
        return null;
    }

    public void setAutoCommit(boolean b) throws SQLException {
        autoCommit = b;
    }

    public void commit() throws SQLException {
    }

    public void rollback() throws SQLException {
    }

    public Table randomTable() {
        if (tables.size() == 0) {
            return null;
        }
        int i = config.random().getInt(tables.size());
        return (Table) tables.get(i);
    }

    public void end() throws SQLException {
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -