java/sql-dk/src/info/globalcode/sql/dk/SQLCommand.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 22 Dec 2013 18:19:38 +0100
branchv_0
changeset 29 d66858b4b563
parent 16 5b8fcd35d4d6
child 34 9335cf31c0f2
permissions -rw-r--r--
more configuration, more JAXB, more formatters
franta-hg@16
     1
/**
franta-hg@16
     2
 * SQL-DK
franta-hg@16
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@16
     4
 *
franta-hg@16
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@16
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@16
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@16
     8
 * (at your option) any later version.
franta-hg@16
     9
 *
franta-hg@16
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@16
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@16
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@16
    13
 * GNU General Public License for more details.
franta-hg@16
    14
 *
franta-hg@16
    15
 * You should have received a copy of the GNU General Public License
franta-hg@16
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@16
    17
 */
franta-hg@1
    18
package info.globalcode.sql.dk;
franta-hg@1
    19
franta-hg@1
    20
import java.sql.Connection;
franta-hg@1
    21
import java.sql.PreparedStatement;
franta-hg@1
    22
franta-hg@1
    23
/**
franta-hg@1
    24
 *
franta-hg@1
    25
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@1
    26
 */
franta-hg@1
    27
public abstract class SQLCommand {
franta-hg@1
    28
franta-hg@29
    29
	private COMMAND_TYPE commandType;
franta-hg@1
    30
	private String query;
franta-hg@1
    31
franta-hg@1
    32
	public abstract PreparedStatement prepareStatement(Connection c);
franta-hg@1
    33
franta-hg@1
    34
	public abstract void parametrize(PreparedStatement ps);
franta-hg@29
    35
franta-hg@29
    36
	public COMMAND_TYPE getCommandType() {
franta-hg@29
    37
		return commandType;
franta-hg@29
    38
	}
franta-hg@29
    39
franta-hg@29
    40
	public void setCommandType(COMMAND_TYPE commandType) {
franta-hg@29
    41
		this.commandType = commandType;
franta-hg@29
    42
	}
franta-hg@29
    43
franta-hg@29
    44
	public String getQuery() {
franta-hg@29
    45
		return query;
franta-hg@29
    46
	}
franta-hg@29
    47
franta-hg@29
    48
	public enum COMMAND_TYPE {
franta-hg@29
    49
franta-hg@29
    50
		/** SELECT */
franta-hg@29
    51
		QUERY,
franta-hg@29
    52
		/** INSERT, UPDATE, DELETE */
franta-hg@29
    53
		UPDATE
franta-hg@29
    54
	};
franta-hg@1
    55
}