Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM OBJECT TO READ ANY TABLE

Status
Not open for further replies.

LALLORA

Programmer
Aug 6, 2003
22
IT
Hi all.

I'm trying to find a (VFox) COM object which allows me to read any table, simply passing the proper parameters, I mean, a COM object I can call from Java, for example, to read a VFox dbase so as to create a Java application which read the data from a VFox DB.

I do not want to use an ODBC connection.

Thanks.
Ciao.
Marco.


Marco (Italy)
marco.dicesare@elmec.it
 
This should be an easy COM object to create.. Do you have a VFP IDE to do this with, or are you looking to have some one build one for you?
 
Yes, I'm trying to find an already existing object but not only a 'bridge' to VFox but an object which, for example, optimize the search choosing a SEEK instead of a SELECT when possible, allows me to manage multiple updates in only one transaction so as to get all things written or all reverted... it's not so simple and my boss asked me to search for an already existing one before starting developing...

Ciao.

Marco (Italy)
marco.dicesare@elmec.it
 
The closest thing I can think of is to use the OLE DB driver for VFP data.

The SEEK/SELECT optimizations are supposed to be done by Rushmore inside VFP by simply using a SELECT (the index lets VFP jump straight to the records desired... provided there is an appropriate index that could be SEEK'd on)
 
You could do something really simple like wrap the _VFP object, provide a method EXEC(), and then just use that to manipulate an instance of VFP:

Compile this .PRG into a COM DLL project (eg: VfpCom), then use it from any COM compliant language like:
Code:
oVFP = CREATEOBJECT('VfpCom.VfpApp')
oVFP.Exec('SELECT * FROM people WHERE peopleID=5 INTO CURSOR cPpl')
cFirstName = oVFP.Eval('cPpl.FirstName')
oVFP.Visible = .T.
oVFP.SCREEN.Height = 500
* etc

*******************************************
* The reason for this, is so that it can be an OLEPUBLIC, ActiveX Automation Server,
*   which OLEPUBLIC class can only be created in code (in VFP6).
* So far, these adjustments are:
*   o  Wrap _SCREEN and _VFP so the client program can get to them directly.
*   o  Expose the current directory as a property: DataDir
*   o  Provide EVAL() and EXEC() methods, to wrap the functions by the same name
******************************************
DEFINE CLASS VfpApp AS Custom OLEPUBLIC
  DataSession = 1 && Default
  SCREEN      = .NULL.
*  SCREEN      = _Screen  && v10.11 wgcs..Now you can bind to _SCREEN Events!..This is broken deliberately in VFP8SP1 claiming it was unstable.
  VFP         = .NULL.
  oApp        = .null.
  DataDir     = ''
  Visible     = .f.
  
  PROCEDURE INIT
    SET EXCLUSIVE OFF
    * Etc.
  ENDPROC  

  FUNCTION Visible_Access
    RETURN _Screen.Visible
  ENDFUNC
  FUNCTION Visible_Assign( lVal )
    _Screen.Visible = lVal
  ENDFUNC

  FUNCTION DataDir_Access
    RETURN Set('default')+addBs(Curdir())
  ENDFUNC
  FUNCTION DataDir_Assign( cVal )
    set default to (cVal)
  ENDFUNC
  
  FUNCTION VFP_ACCESS
    RETURN _VFP
  ENDFUNC

  FUNCTION SCREEN_ACCESS
    RETURN _SCREEN
  ENDFUNC
  
  FUNCTION Exec( p1,p2,p3,p4,p5,p6,p7,p8,p9 )
    LOCAL lnI, lcI
    for lnI = 1 to PCOUNT()
      lcI = 'p'+tran(lnI)
      &lcI
    endfor
  ENDFUNC
  FUNCTION Eval( cStr )
    RETURN Eval( cStr )
  ENDFUNC
  
  FUNCTION DESTROY()
    THIS.Screen = .NULL.
    THIS.VFP    = .NULL.
    THIS.oApp   = .NULL.
    ON SHUTDOWN
  ENDFUNC
ENDDEFINE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top