PBUseProcOwner database parameter
Description
When you access a database through the ODBC interface and
define a DataWindow object that uses a stored procedure as its data source, PBUseProcOwner
specifies whether PowerBuilder should qualify the stored procedure
with the owner name in the SQL EXECUTE statement
passed to the driver.
PowerBuilder qualifies the stored procedure with an owner only
if the owner associated with the stored procedure is different from
the ID of the current user (the developer building the DataWindow object or
the user running the application containing the DataWindow object).
Controls
-
ODBC
Syntax
1 |
PBUseProcOwner='<span>value</span>' |
Parameter |
Description |
||||
---|---|---|---|---|---|
value |
Specifies whether PowerBuilder should qualify
|
Default
PBUseProcOwner=’No’
Usage
Determining the PBUseProcOwner value
PowerBuilder searches the following in this order to determine
the PBUseProcOwner value:
-
The
section for your database profile in the PowerBuilder initialization
file (in the development environment) or the value of the transaction
object’s DBParm property (in an application). -
The section for your ODBC driver in the PBODB126 initialization
file.
If PowerBuilder does not find a PBUseProcOwner value in these
locations, it defaults to a value of “No”.
If DBA owns the SQL Anywhere® stored
procedure
DBA (database administrator) is a reserved word in SQL Anywhere syntax.
If you define a DataWindow object with a SQL Anywhere
stored procedure as its data source and DBA owns the stored procedure,
the painter passes the following SQL EXECUTE statement
to the ODBC driver if PBUseProcOwner is set to “Yes”:
1 |
EXECUTE DBA.MYPROCEDURE |
This statement generates a syntax error because it includes
the DBA reserved word.
If DBA owns the SQL Anywhere
stored procedure you are using, you can avoid this syntax error
by setting PBUseProcOwner to No so that PowerBuilder does not qualify
the stored procedure with DBA.
In some situations, however, you must qualify
the stored procedure with the DBA owner. For example, the DBA might
want to grant execute permission to another user ID. In this case,
you can avoid errors by editing the SQL EXECUTE syntax
to enclose DBA in quotes, like this:
1 |
EXECUTE "DBA".MYPROCEDURE |
Examples
To specify that PowerBuilder should qualify the stored
procedure with its owner name in the SQL EXECUTE statement:
-
Database profile
Select the Qualify Stored Procedures With Owner Name check
box on the Transaction page in the Database Profile Setup dialog
box. -
Application
Type the following in code:
1SQLCA.DbParameter="PBUseProcOwner='Yes'"