|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ChinaVO.FITSManager.Util.DBOperator
public class DBOperator
A database operator for the whole application.
Constructor Summary | |
---|---|
DBOperator()
|
Method Summary | |
---|---|
static void |
closeDBConnection()
close the connection with the database. |
void |
CloseQuery()
Close the ResultSet and Statement after you call the Query() method. |
static java.lang.Boolean |
Execute(java.lang.String strSQL)
Execute a SQL statement. |
static java.sql.Connection |
getDBConnection()
get the only database connection. |
static int |
getFileID(java.io.File f)
Query the "file" table, then return the file's id in the "file" table. |
static int |
Insert(java.lang.String strSQL,
java.lang.String strTable,
java.lang.String col)
Execute a insert SQL statement and return the id of the newest row. |
static int |
insertFile(java.io.File f,
boolean isGetID)
Insert a file's information into the "file" table, and return it's row id(if you set the isGetID=true). |
java.sql.ResultSet |
Query(java.lang.String strSQL)
execute a SQL statement and return the ResultSet. after you call this method, you have to call the closeQuery to clear the ResultSet and Statement. |
java.sql.ResultSet |
Query(java.lang.String strSQL,
int fetchsize)
|
java.sql.ResultSet |
Query2(java.lang.String strSQL)
execute a SQL statement and return the ResultSet. after you call this method, you have to call the closeQuery to clear the ResultSet and Statement. The difference between Query and Query2: when you call Query2,you have to deal with the SQLException yourself |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBOperator()
Method Detail |
---|
public static java.sql.Connection getDBConnection()
public static void closeDBConnection()
public java.sql.ResultSet Query(java.lang.String strSQL)
strSQL
- a SQL statement string.
public java.sql.ResultSet Query2(java.lang.String strSQL) throws java.sql.SQLException
strSQL
- a SQL statement string.
java.sql.SQLException
public java.sql.ResultSet Query(java.lang.String strSQL, int fetchsize)
public void CloseQuery()
public static java.lang.Boolean Execute(java.lang.String strSQL)
strSQL
- a SQL statement string.
public static int Insert(java.lang.String strSQL, java.lang.String strTable, java.lang.String col)
strSQL
- an insert SQL statementstrTable
- the name of the table you insert data into.col
- the auto increase column's name in the table.
public static int getFileID(java.io.File f)
f
- a file instance
public static int insertFile(java.io.File f, boolean isGetID)
f
- a file instance.isGetID
- if you want to get the id of the file, set isGetID=true, else
set isGetID=false.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |