public interface Statement
SystemCapability.Data#DATA_APPDATAMGR| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
clearValues() |
Clears all dynamic values of a precompiled statement.
|
void |
close() |
Closes the current precompiled SQL statement.
|
void |
execute() |
Executes a precompiled SQL statement.
|
int |
executeAndGetChanges() |
Executes a precompiled SQL statement to obtain the number of affected rows.
|
long |
executeAndGetLastInsertRowId() |
Executes a precompiled SQL statement to obtain the ID of the last inserted row.
|
long |
executeAndGetLong() |
Executes a precompiled SQL statement to obtain a return value of the long type.
|
String |
executeAndGetString() |
Executes a precompiled SQL statement to obtain a return value of the string type.
|
void |
setBlob(int index,
byte[] value) |
Sets a byte array value for a precompiled statement dynamically.
|
void |
setDouble(int index,
double value) |
Sets a double value for a precompiled statement dynamically.
|
void |
setLong(int index,
long value) |
Sets a long value for a precompiled statement dynamically.
|
void |
setNull(int index) |
Sets
null for a precompiled statement dynamically. |
void |
setObject(int index,
Object value) |
Sets an object value for a precompiled statement dynamically.
|
void |
setString(int index,
String value) |
Sets a string value for a precompiled statement dynamically.
|
void |
setStrings(String[] stringValues) |
Sets all the string values for a precompiled statement dynamically.
|
void setNull(int index)
null for a precompiled statement dynamically.index - Indicates the index of the value to be set for the precompiled statement, which starts
from 1.void setLong(int index,
long value)
index - Indicates the index of the value to be set for the precompiled statement, which starts
from 1.value - Indicates the value to be set for the precompiled statement.void setDouble(int index,
double value)
index - Indicates the index of the value to be set for the precompiled statement, which starts
from 1.value - Indicates the value to be set for the precompiled statement.void setString(int index,
String value)
index - Indicates the index of the value to be set for the precompiled statement, which starts
from 1.value - Indicates the value to be set for the precompiled statement.void setBlob(int index,
byte[] value)
index - Indicates the index of the value to be set for the precompiled statement, which starts
from 1.value - Indicates the value to be set for the precompiled statement.void setStrings(String[] stringValues)
stringValues - Indicates all the string values.void setObject(int index,
Object value)
The method used to set the value varies depending on the value type:
null, use Statement#setNull(int).
Boolean, use Statement#setLong(int, long).
1 indicates true and 0 indicates false.
Statement#setBlob(int, byte[]).
Double or Float, use Statement#setDouble(int, double).
Number, use Statement#setLong(int, long).If the value is not any of the preceding types, convert it into a string and use
Statement#setString(int, String) to set it.
index - Indicates the index of the value to be set for the precompiled statement, which starts
from 1.value - Indicates the value to be set for the precompiled statement.void clearValues()
void execute()
long executeAndGetLong()
String executeAndGetString()
int executeAndGetChanges()
long executeAndGetLastInsertRowId()
void close()
A closed SQL statement can no longer be used.