Link to home
Start Free TrialLog in
Avatar of bukko
bukko

asked on

DOEVENTS in SQL

Hi,

anyone know of a DOEVENTS type command in SQL Server?

For info, this is to allow processor time to catch-up while processing OA objects.

bukko
Avatar of Hilaire
Hilaire
Flag of France image

There is no event handling in SQL Server, at least not the same kind of events(mousemove, keypress, paint, activate) than in client applications in which you'd use DoEvents in VB.

The only "events" in SQL server are, unless I'm wrong, the INSERT, UPDATE, DELETE events that fire triggers.
You can disable and enable triggers using alter table ....

COuld you be more precise on what you want to achieve ?
Avatar of bukko
bukko

ASKER


I'm calling a method in an OA object, then reading an IsRunning type property, which contantly returns 1 (Yes).
I'm wondering if this is because it doesn't have time to do what it needs because of being contanly polled.
If I build the object into an exe and call using xp_cmdshell, all works fine. However, I'm not allowed access to xp_cmdshell for security reasons.
So, what I need is a way to release processor time so the component can get on with its life without me bothering it too much.

Any ideas?

bukko
ASKER CERTIFIED SOLUTION
Avatar of Hilaire
Hilaire
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bukko

ASKER

I'll try the WAITFOR thing; if that doesn't work I'll post my code.

Ta...
Avatar of bukko

ASKER

Hilaire,

I think your logic is ok, but it still aint working. Maybe it's not a CPU thing at all.

The component is a PDF creating component.
My SQL code as follows:

      -- Check if object busy
      EXEC      @result      = master.dbo.sp_OAGetProperty @h_pdf, 'StillRunning', @running OUT
      IF (@@ERROR|@result > 0)
            RAISERROR('Unable to read StillRunning property', 16, 1)

      WHILE      @running = 1
            BEGIN
            WAITFOR DELAY '00:00:01'
            EXEC      @result      = master.dbo.sp_OAGetProperty @h_pdf, 'StillRunning', @running OUT
            IF (@@ERROR|@result > 0)
                  RAISERROR('Unable to read StillRunning property', 16, 1)
            PRINT @running
            END

      EXEC      @result      = master.dbo.sp_OADestroy 16711422
      IF (@@ERROR|@result > 0)
            RAISERROR('Unable to destroy PDF component', 16, 1)


Any ideas?
the "createObject" or sp_OACreate should return an INT value @h_pdf

You should use this handle to destroy the object
Instead, you use a hard-coded 16711422

Is it a typo ?

it should be

EXEC     @result     = master.dbo.sp_OADestroy @h_pdf

Avatar of bukko

ASKER

Yeah, that's just my test snip.
I do normally use @h_pdf
Avatar of bukko

ASKER

I wrapped the PDf component in an ActiveX dll and it works fine now.

I'm giving you the points for your suggestion, which is actually what I asked for!

Thanks.

bukko