Avoid SQL

Link to this posting

Postby Ursego » 19 Feb 2013, 22:25

Don't write SQL in PowerBuilder.

Why - read here about the concept of a SQL-free application. Now I only want to suggest replacement for different kinds of SQLs in PB:

BAD SOLUTION: Cursor, embedded to PowerScript
SUGGESTED REPLACEMENT: DataStore (if you want to use SQL as its data source anyway instead of stored proc, see this)
REASON: PB cursors are very inefficient.

BAD SOLUTION: Stored procedure, embedded to PowerScript
SUGGESTED REPLACEMENT: RPCFUNC declaration in transaction object (see here)
REASON: Embedded stored procs are a bad coding style, especially if a same proc appears in many fragments of PowerScript.

BAD SOLUTION: SELECT, INSERT, UPDATE and DELETE statements, embedded to PowerScript
SUGGESTED REPLACEMENT: Stored procedure/function (called with RPCFUNC)
REASONS: Data storage abstraction. Encapsulation of data retrieval/processing complexity.

BAD SOLUTION: SELECT statement as data source of DW
SUGGESTED REPLACEMENT: Stored procedure, returning records set, for SELECT (for updatable DW - also procs for INSERT, UPDATE and DELETE).
REMARK: As an exception from the rule, SQL-based DWs are allowed for basic database operations (when no business logic is involved) with static (reference) tables (for example, to manage entities' statuses etc.).
User avatar
Site Admin
Posts: 120
Joined: 19 Feb 2013, 20:33

Link to this posting

Postby usrmk » 10 Mar 2016, 17:15

Hi, new user here =) (and fairly new to PB)

We have a number of MariaDB stored procedures that we've been calling using the DECLARE - EXECUTE PROCEDURE technique, but we're not entirely happy with that approach, reading this post convinced us use the RPCFUNC declaration but, since we are using a source control tool for PB, just one programmer can edit an object at a time (for us it means only one programmer can edit de transaction object at a given time).

We were wondering if we needed to create multiple transaction objects per module (or application?) with its own set of functions to be able to work on parallel or is there a better approach?

I've been enjoying this site. Thank you.
Posts: 1
Joined: 09 Mar 2016, 19:33

Link to this posting

Postby jagonzo62 » 19 Apr 2018, 12:51

There was or is a 32k limit on the number of declarations that can be written in a local or global external.
Posts: 1
Joined: 19 Apr 2018, 12:45

IF you want to ((lose weight) OR (have unbelievable (brain function AND mental clarity))) THEN click:

free counters

eXTReMe Tracker