Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 16 JUN 2003 02:00:31PM Wilhelm Schmitt wrote:

We want to open an engine from the command line and indicate the subroutine to be executed and additional parameters.

Something like this:

oengine /AP=APPNAME /UN=USRNAME /SN=XYZ /FN=FUNCTION_NAME,PARAM

Is this possible? What would the syntax look like?

Regards

Wilhelm


At 16 JUN 2003 03:38PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Not directly but what you could do is load an environment variable before invoking the engine and then run a startup routine in the OI environment that examines this variable and calls the routine. Synthesise this from http://www.revelation.com/website/discuss.nsf/search/167BE48F6BBE640785256C1A00735E59?OpenDocument and http://www.revelation.com/__8525652b0066bfaf.nsf/0/7a6c216759e0cef385256947003c0527?OpenDocument

The Sprezzatura Group

[/i]World leaders in all things RevSoft[/i]


At 17 JUN 2003 11:14AM Wilhelm Schmitt wrote:

Sprezz,

sorry to hear that there isn't a practical way for the command line.

Is there any special reason for this limitation?

Anyway, thanks for the suggestion.

Wilhelm


At 17 JUN 2003 11:24AM Pat McNerthney wrote:

Isn't is possible to run your own routine when an account is loaded? Couldn't such a startup routine then examine the command line and run another routine specified on the command line?

Pat


At 17 JUN 2003 12:58PM Bob Carten wrote:

Wilhelm:

A cute way to do this is to use OECGI

write an inet_function that calls your function

for example inet_runner.

Then write a batch file that looks like:

rem * rem oe_runner.bat

rem path info should be the name of the inet function rem the env string queryparam should have &= delimited arguments

rem rem for this example

rem redirect the output to a file rem then display the file

rem * set path_info=/inet_runner set QUERY_STRING=arg1=%1 oecgi ]result.htm start result.htm rem end of bat file

rem ***

You can run the batch file without a web server.

It will need OECGI configured though.

As an alternative you can use Xrev.dll to make a small vb / delphi executable that does the same thing

HTH

Bob

At 17 JUN 2003 03:16PM Wilhelm Schmitt wrote:

Bob,

Batch file that changes environment settings:

What happens when I want to start another engine on the same machine through another batch file… and so on.

Our situation is this:

from the server, we want to have an engine dedicated to indexes, another one for process A and a third one for process B.

OECGI is configured for the web.

VB and XREV.DLL

Where can I find specs for the calls to XREV.DLL?

Regards

Wilhelm

BTW: This thread got truncated somehow. I can't see your response on the list below - I went in through the "flat-by-date" option.


At 20 JUN 2003 03:39PM Wilhelm Schmitt wrote:

Are the calls to XREV.DLL similar to the calls for OEngine?

Wilhelm


At 20 JUN 2003 03:49PM Bob Carten wrote:

Wilhelm:

I needed to write an object that could be called from asp pages without invoking cgi.

The vb code below uses Xrev.dll to start an engine and run a function,

then pass the result back to a caller.

Not debugged / tested for volume.

hope it helps

 Bob

Option Explicit

Enum IniFileErrors

  ERR_BASE=8192
  ERR_FILEWRITE=1
  ERR_FILEREAD=2
  ERR_NOSECTION=3
  ERR_NOKEYNAME=4

End Enum

Const ERR_NOSECTIONSTRING=No section was specified. Function aborted."

Const ERR_NOKEYNAMESTRING=No key name was specified. Function aborted."

Const DEFAULT_VALUE="

Const ININAME=.\oicall.ini"

Const SECTION=ENGINE"

Public Function RunRequest(RequestIn As String, inipath As String)

On Error Resume Next

'Create the core Revelation object.

Dim oRevelation As Revelation
'Create an OpenEngine.
Dim oEngine As RevSoftLib.IEngine
Dim lRet As Long
Dim OiPath As String
Dim ServerName As String
Dim DbName As String
Dim QueueName As String
Dim UserName As String
Dim Password As String
Dim ReturnValue As String
Dim Stored_Procedure As String
Dim html As String
html="
ChDir inipath
OiPath=GetKeyValue(SECTION, "Path")
DbName=GetKeyValue(SECTION, "Application")
UserName=GetKeyValue(SECTION, "UserName")
Password=GetKeyValue(SECTION, "Pw")
Stored_Procedure=GetKeyValue(SECTION, "Stored Procedure")
ServerName=\\.\OE" & Int(Rnd(Now()) * 1000)
QueueName=Q" & Int(Rnd(Now()) * 1000)

html=Before Engine " & Now()

html=html & " Servername= & ServerName

html=html & " Queuename= & QueueName

html=html & " Application= & DbName

html=html & " cur dir= & CurDir()

'Change the directory if not connecting to an existing engine.
ChDir OiPath
Set oRevelation=CreateObject("Revsoft.Revelation")
lRet=oRevelation.CreateEngine(oEngine, ServerName, DbName, 1, 1)
If lRet=0 Then
  'Create an active Queue.
  Dim oQueue As Object
  lRet=oEngine.CreateQueue(oQueue, QueueName, DbName, UserName, Password)
  html=html & "

Before Queue " & Now()

  html=html & "

Servername= & ServerName

  html=html & "

Queuename= & QueueName

  html=html & "

Application= & DbName

  html=html & "

Cur Dir= & CurDir()

  If lRet=0 Then
    'Call a Basic+ function...
    Dim oiRequest As String
    oiRequest=$SUBMIT=PROC"
    oiRequest=oiRequest & "&PROC= & Stored_Procedure
    oiRequest=oiRequest & "&cmd= & RequestIn
    oiRequest=Replace(oiRequest, "%20", " ")
    lRet=oQueue.CallFunction(ReturnValue, "RUN_OECGI_REQUEST", oiRequest)
    oQueue.CloseQueue
  Else
      ReturnValue=Create Queue Failed " & Now()
  End If
  oEngine.CloseEngine
Else
  html=Create Engine Failed " & Now() & " " & DbName
  html=html & "

Before Queue " & Now()

  html=html & "

Servername= & ServerName

  html=html & "

Queuename= & QueueName

  html=html & "

Application= & DbName

  html=html & "

Cur Dir= & CurDir()

End If

Dim strMimeType As String

strMimeType=Content-type: text/html"

If Left(ReturnValue, Len(strMimeType))=strMimeType Then

 ReturnValue=Mid(ReturnValue, Len(strMimeType) + 1)

End If

If InStr(1, RequestIn, "DEBUG=1") ] 0 Then

  RunRequest=html & "

" & ReturnValue

Else

  RunRequest=ReturnValue

End If

Set oRevelation=Nothing

Exit Function

Err_Handler:

  Set oQueue=Nothing
  Set oEngine=Nothing
  Set oRevelation=Nothing
  ReturnValue="
  RunRequest=ReturnValue
  Exit Function

End Function

Private Function GetKeyValue(ByVal sSectionName As String, ByVal sKeyName As String) As String

On Error GoTo e_Handler

'dims

Dim hr As Long

Dim sBuf As String

Dim lSize As Long

'default buffer size

lSize=128

'first things first, we really need a section name here

If Len(sSectionName)=0 Then

Err.Raise ERR_BASE + ERR_NOSECTION, , ERR_NOSECTIONSTRING

ElseIf Len(sKeyName)=0 Then

Err.Raise ERR_BASE + ERR_NOKEYNAME, , ERR_NOKEYNAMESTRING

End If

Do

'default buffer size

sBuf=Space$(lSize)

'call the API to get the key value

hr=GetPrivateProfileString(sSectionName, sKeyName, DEFAULT_VALUE, sBuf, Len(sBuf), ININAME)

'see API documentation for more info, suffice to say if the return val is size-1 then buffer was too small

If hr=lSize - 1 Then

'increase buffer size

lSize=lSize * 2

Else

'success

lSize=0

End If

'if lSize 0 then needs to loop again

Loop While lSize

'trim null chars

sBuf=Left$(sBuf, hr)

'return the value

GetKeyValue=sBuf

Exit Function

e_Handler:

'do nothing

Exit Function

End Function

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/2aef32ab7d67ee5d85256d470062ecb8.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1