Method prepare

Use

prepare is a method of theclass SapDB_Session.

You use this method to send an SQL statement cmd to the database instance to be checked.

Features

prepare (cmd)

cmd

SQL statement

Result:

?     Successful execution: object of the class SapDB_Prepared

You can use this object to execute the same SQL statement multiple times with different parameters (Method execute). That way the database instance does not need to re-check the syntax and privileges each time.

?     Error: exception of the class SQLError

Example

?     You send an INSERT statement to the database instance:

insert = session.prepare ('INSERT INTO hotel.city VALUES (?,?,?)')

The variable insert contains an object of the class SapDB_Prepared. You can use this object to execute the INSERT statement with different parameters.

?     Executing an SQL Statement Multiple Times with Different Values