Connection.isselect — determine if an SQL statement is a select or an update


boolean Connection.isselect ( sql);  
string   sql;


Use this method to determine if an arbitrary SQL statement is a select statement or an update statement. Select statements should be opened using Connection.openrs() whereas update statements should be executed using Connection.execute(). This method returns true if it is an SQL select statement. This does not guarantee that it is a valid SQL query.

The SQL query should be on a single line without comments or leading or trailing whitespace.

Example 62. Connection.isselect Example

    Recordet rs = conn.openrs(sql);

    if(rs != null)
        // . . .
    int rowsaffected = conn.execute(sql);

See Also

Data sources and database access in RSP is explained in the section called “Accessing Databases”