Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

SQLCache – PB Docs 125 – PowerBuilder Library

SQLCache – PB Docs 125

SQLCache database parameter

Description

Specifies the number of SQL statements
that PowerBuilder should cache. The default is 0, specifying an empty SQL cache.

PowerBuilder caches:

  • SQL statements generated
    by a DataWindow object or report

  • Embedded SQL statements

Controls

  • ODBC

Syntax

Parameter

Description

value

The number of cursors you want to open
in a script, plus the number of DataWindow-generated SELECT statements
with retrieval arguments (default=0).

Default

SQLCache=0

Usage

Maintaining statements in the cache

Statements in the SQL cache
are maintained on a least-recently-used (LRU)
basis. In other words, if a statement must be removed from the cache
to make room for another statement, PowerBuilder removes the statement
that was least recently executed.

SQLCache and bind variables

Caching SQL statements
that you execute frequently improves their performance. Statements
with bind variables are often the most frequently used. In fact,
if your DBMS does not support bind variables, caching statements
is of limited value.

Setting DisableBind to use cached statements

In order to use cached statements, make sure the DisableBind
parameter is set to 0 (the default). This enables the binding of
input variables to SQL statements.

For more about using bind variables, see DisableBind.

What happens

The first time you execute a SQL statement
containing bind variables, the DataWindow server does the following in this
sequence:

  1. Parses the statement.

  2. For SQL SELECT statements,
    calls the appropriate database function to get a description of
    the result set.

  3. Allocates memory buffers for the bind variables.

  4. Binds the allocated memory buffers to the parsed
    statement.

When you cache this SQL statement, the DataWindow server stores
the parsed statement, result set description, and memory buffer
allocation and binding in the SQL cache.
The next time you execute this statement, PowerBuilder finds it in
the cache and avoids the overhead of repeating these steps.

If the DataWindow server finds an exact match for this statement in the SQL cache, it simply copies the new
values supplied for the bind variables to the preallocated memory
buffers and executes the statement. This is much faster than having
to process the statement from scratch.

Determining the size of your SQL cache

To determine an appropriate size for your SQL cache, you can check the value
of the SqlReturnData property of the Transaction object.

When you disconnect from the database, the number of hits,
misses, and entries in the SQL cache
is stored in SqlReturnData as follows:

  • Hits

    The number of times the DataWindow server found a matching statement
    in the SQL cache

  • Misses

    The number of times the DataWindow server did not find a matching statement
    in the cache

  • Entries

    The total number of statements in the SQL cache,
    which is determined by your SQLCache setting

Examples

To set the SQL cache
size to 25 statements:

  • Database
    profile

    Type 25 in the Number
    Of SQL Statements Cached box
    on the Transaction page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x