Avoid SQL

Share this topic:



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
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
Ursego
Site Admin
 
Posts: 111
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.
usrmk
 
Posts: 1
Joined: 09 Mar 2016, 19:33


Return to Elegant Code

Who is online

Users browsing this forum: No registered users and 1 guest


Avoid SQL

Share this topic:


If you think that this site is not too bad, please LIKE it in Facebook. Thanks!





free counters

eXTReMe Tracker