SQL worker objects

Sten-Erik Björling s-e.bjorling at enviro.se
Sun Jan 28 01:53:38 EST 2018

Hi  Das,

An alternative route: A method for handling the search definitions which are used in a call to a dedicated method handling the SQL Worker instantiation:

Method $SearchNameByString:

Set reference irefCallingForm to prefCallingForm

Calculate lrwParams as crwWOParamsBindTempl - using a schema do define the parameters

Calculate lrwParams.poolname as cchROPoolName - using session pools
Calculate lrwParams.query as 'select * from actor where actor_id = @[pnID];'

Do llBindVars.$define(pnID) - defining the binders list. Local list variable
Do llBindVars.$add(pnID)
Calculate lrwParams.bindvars as llBindVars

Do $cinst.$SQLWorker(lrwParams,$cinst())

Quit method


Method SQLWorker:

Calculate lchPoolName as prwParams.poolname
Do $root.$objects.[cchWorkerObjectName].$newref() Returns irefWorkerObject - square brackets - you should be able to change DB type
Do irefWorkerObject.$cancelifrunning.$assign(kFalse)
Do irefWorkerObject.$waitforcomplete.$assign(kTrue)
Do irefWorkerObject.$init(prwParams) Returns lbStatus
If lbStatus='YES'
	Do irefWorkerObject.$setCallingInst(prefCallingInst)
	Calculate lchPoolName as prwParams.poolname
	Begin critical block - this section is needed if you need to keep tabs on available sessions in the session pool
		Do irefDBStdOps.$CheckAvailableSessions(lchPoolName)
		Do irefWorkerObject.$start() Returns lbStatus
	End critical block
Else If lbStatus='NO'
	Do method $SQLWorkerErrorMngr
End If
Yield to other threads - a very vital command to distribute computing power!


Take care, all the best…



> 28 jan. 2018 kl. 02:46 skrev Das Goravani <das at goravani.com>:
> Given this code from the Manual
> Do work.$definefromsqlclass('scWork')  ;;scWork is defined as query(char) and
> bindvars(list)
> Do work.$add('select * from table1 where col1 < @[binds1.col1]',binds1)
> Do work.$add('select count(*) from table1',)
> Do work.$add('select * from table2 where idCol >= @[binds2.idCol]',binds2)
> Do work.$add('select oneCol from table3',)
> Do initRow.$definefromsqlclass('scWorkInit') ;;scWorkInit is defined as
> hostname(char), username(char), password(char) & work(list)
> Do initRow.$add(lHostname,lUsername,lPassword,work)
> Do iWorker.$init(initRow) Returns #F
> Do iWorker.$start() Returns #F
> What does the list of binds1 and binds2 actually contain
> Where binds1 and binds2 appears in the where clause, what do they mean, being there, and matching the list
> I basically don’t get binds1 and binds2
> I have heard of and seen bind variables in select statements but am not clear on their syntax 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com

Sten-Erik Björling
Enviro Data
Kyrkogatan 5A 2 tr
SE-972 32  Luleå

E-Mail: s-e.bjorling at enviro.se
Mobile: +46-70-655 11 72
Wire: @stenerikbjorling
Skype: stenerikbjorling
iChat: stene at mac.com
FaceTime: stene at mac.com
Hotmail / Messenger: stenerikbjorling at hotmail.com
GMail: stenerikbjorling at gmail.com


This email and any files transmitted with it are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, please note that any use, distribution, or reproduction of the contents of this email is strictly prohibited and may be unlawful. If you are not the intended recipient, please notify the sender by return email and destroy all copies of the original message including any attachments thereto. Thank you.

Please note that we take reasonable precautions to prevent the transmission of viruses; however, we cannot guarantee that this email or its attachments are free from viruses. We only send and receive emails on the basis that we are not be liable for any loss or damage resulting from the opening of this message and/or attachments.

More information about the omnisdev-en mailing list