Platforms to show: All Mac Windows Linux Cross-Platform
JavaPreparedStatementMBS class
Super class: JavaStatementMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Java Database | MBS Java Plugin | 8.5 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
A SQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.
Note: The setter methods (setShort, setString, and so on) for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type INTEGER, then the method setInt should be used.
If arbitrary parameter type conversions are required, the method setObject should be used with a target SQL type.
In the following example of setting a parameter, con represents an active connection:
PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00)
pstmt.setInt(2, 110592)
Subclass of the JavaStatementMBS class.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 23 methods
- method addBatch
- method clearParameters
- method Constructor Private
- method execute as boolean
- method executeQuery as JavaResultSetMBS
- method executeUpdate as Integer
- method getMetaData as JavaResultSetMetaDataMBS
- method getParameterMetaData as JavaParameterMetaDataMBS
- method setBlob(parameterIndex as Integer, value as JavaBlobMBS)
- method setBoolean(parameterIndex as Integer, value as boolean)
- method setByte(parameterIndex as Integer, value as Integer)
- method setBytes(parameterIndex as Integer, Value as String)
- method setClob(parameterIndex as Integer, value as JavaClobMBS)
- method setDate(parameterIndex as integer, value as JavaObjectMBS) New in 24.4
- method setDouble(parameterIndex as Integer, value as Double)
- method setFloat(parameterIndex as Integer, value as single)
- method setInt(parameterIndex as Integer, value as Integer)
- method setLong(parameterIndex as Integer, value as Int64)
- method setNull(parameterIndex as Integer, sqlType as Integer)
- method setShort(parameterIndex as Integer, value as Integer)
- method setString(parameterIndex as Integer, value as string)
- method setTime(parameterIndex as integer, value as JavaObjectMBS) New in 24.4
- method setTimestamp(parameterIndex as integer, value as JavaObjectMBS) New in 24.4
Super class JavaStatementMBS
- 6 properties
- property EscapeProcessing as boolean
- property FetchDirection as Integer
- property FetchSize as Integer
- property MaxFieldSize as Integer
- property MaxRows as Integer
- property QueryTimeout as Integer
- 28 methods
- method addBatch(sql as string)
- method cancel
- method clearBatch
- method clearWarnings
- method close
- method CLOSE_ALL_RESULTS as Integer
- method CLOSE_CURRENT_RESULT as Integer
- method Constructor Private
- method execute(sql as string) as boolean
- method execute(sql as string, autoGeneratedKeys as Integer) as boolean
- method executeBatch as Integer()
- method executeQuery(sql as string) as JavaResultSetMBS
- method executeUpdate(Sql as string) as Integer
- method executeUpdate(Sql as string, autoGeneratedKeys as Integer) as Integer
- method EXECUTE_FAILED as Integer
- method getGeneratedKeys as JavaResultSetMBS
- method getMoreResults as boolean
- method getMoreResults(current as Integer) as boolean
- method getResultSet as JavaResultSetMBS
- method getResultSetConcurrency as Integer
- method getResultSetHoldability as Integer
- method getResultSetType as Integer
- method getUpdateCount as Integer
- method KEEP_CURRENT_RESULT as Integer
- method NO_GENERATED_KEYS as Integer
- method RETURN_GENERATED_KEYS as Integer
- method setCursorName(name as string)
- method SUCCESS_NO_INFO as Integer
Super class JavaObjectMBS
- 16 properties
- property ClassName as String
- property Database as Variant
- property Handle as Integer
- property Lasterror as Integer
- property Tag as Variant
- property VM as JavaVMMBS
- property BooleanField(TheField as JavaFieldMBS) as boolean
- property ByteField(TheField as JavaFieldMBS) as Integer
- property CharField(TheField as JavaFieldMBS) as Integer
- property DoubleField(TheField as JavaFieldMBS) as Double
- property Field(TheField as JavaFieldMBS) as Variant
- property FloatField(TheField as JavaFieldMBS) as single
- property IntField(TheField as JavaFieldMBS) as Integer
- property LongField(TheField as JavaFieldMBS) as Int64
- property ObjectField(TheField as JavaFieldMBS) as JavaObjectMBS
- property ShortField(TheField as JavaFieldMBS) as Integer
- 28 methods
- method CallBooleanMethod(MethodID as JavaMethodMBS, args as memoryblock) as boolean
- method CallByteMethod(MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallCharMethod(MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallDoubleMethod(MethodID as JavaMethodMBS, args as memoryblock) as Double
- method CallFloatMethod(MethodID as JavaMethodMBS, args as memoryblock) as single
- method CallIntMethod(MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallLongMethod(MethodID as JavaMethodMBS, args as memoryblock) as Int64
- method CallMethod(MethodID as JavaMethodMBS, args() as Variant) as Variant
- method CallNonvirtualBooleanMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as boolean
- method CallNonvirtualByteMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallNonvirtualCharMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallNonvirtualDoubleMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as Double
- method CallNonvirtualFloatMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as single
- method CallNonvirtualIntMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallNonvirtualLongMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as Int64
- method CallNonvirtualMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args() as Variant) as Variant
- method CallNonvirtualObjectMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as JavaObjectMBS
- method CallNonvirtualShortMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallNonvirtualVoidMethod(TheClass as JavaClassMBS, MethodID as JavaMethodMBS, args as memoryblock)
- method CallObjectMethod(MethodID as JavaMethodMBS, args as memoryblock) as JavaObjectMBS
- method CallShortMethod(MethodID as JavaMethodMBS, args as memoryblock) as Integer
- method CallVoidMethod(MethodID as JavaMethodMBS, args as memoryblock)
- method Constructor Private
- method GetDirectBufferAddress(directbuffer as JavaObjectMBS) as Integer
- method GetDirectBufferCapacity(directbuffer as JavaObjectMBS) as Integer
- method IsInstanceOf(TheClass as JavaClassMBS) as boolean
- method IsSameObject(obj as JavaObjectMBS) as boolean
- method ObjectClass as JavaClassMBS
This class has no sub classes.
Some methods using this class:
- JavaConnectionMBS.prepareStatement(sql as string) as JavaPreparedStatementMBS
- JavaConnectionMBS.prepareStatement(sql as string, autoGeneratedKeys as Integer) as JavaPreparedStatementMBS
- JavaConnectionMBS.prepareStatement(sql as string, resultSetType as Integer, resultSetConcurrency as Integer) as JavaPreparedStatementMBS
- JavaConnectionMBS.prepareStatement(sql as string, resultSetType as Integer, resultSetConcurrency as Integer, resultSetHoldability as Integer) as JavaPreparedStatementMBS
Some examples using this class:
- /Java/JavaDatabase/java Database Thread Tests
- /Java/JavaDatabase/JavaDatabase MDB
- /Java/JavaDatabase/JavaDatabase MySQL Blob and Clob
- /Java/JavaDatabase/JavaDatabase MySQL test
- /Java/JavaDatabase/JavaDatabase MySQL test with Threading
- /Java/JavaDatabase/JavaDatabase MySQL with JavaInputStreamMBS
- /Java/JavaDatabase/JavaDatabase SQLite
- /Java/JavaDatabase/JavaDatabase SQLite blob
- /Java/JavaDatabase/JavaDatabase to JSON
- /Java/JavaDatabase/JDBCMultipleDrivers
Blog Entries
Release notes
- Version 24.4
- Added date and time setters for JavaPreparedStatementMBS class.
The items on this page are in the following plugins: MBS Java Plugin.
JavaParameterMetaDataMBS - JavaResultSetMBS