Paradox Community

Items in pnews.paradox-client_server

Subject:Re: ODBC to an Amazon WS Postgressql db.
Date:Wed, 26 Feb 2020 12:50:48 +1100
From:Tom Krieg <REMOVEtomkCAPITALS@sdassociates.com.au>
Newsgroups:pnews.paradox-client_server
Yes. I did it by trapping datapost/dataunlock record in the tableframe. 
Then call a library method (passing the record data) which did the SQL 
thing and returned true or false. Then I would raise an error condition 
in Paradox and fail the tableframe update if the sql didn't work. This 
way, the TF was always in sync with the database.

The beauty of it is that you can create a whole series of inserts and 
updates in one transaction from a tableframe update. And roll them back 
if necessary.

Everything should be done with pass-through sql. With forms and 
libraries triggering the updates, inserts, deletes etc. These are then 
protected by PostgreSQL transactions so there is no need to worry about 
integrity of data.

And yes, you could have wireless workstations. Last system I did they 
had techs on the road with laptops and a 4G dongle. "Can I sign you up 
for $2mill worth of extrusions? Great. I've just put  through your order."

Of course, if you use Azure and Citrix you could put everything in the 
cloud, including Paradox.

For example:
method action(var eventInfo ActionEvent)
var
    stError string
    dynResponse dyAny
    siStatus smallint
endvar
if eventInfo.id() = DataPostRecord
or eventInfo.id() = DataUnlockRecord then
    if ORDLINES.RecordStatus("New") = True then
       liLineNo = liLineNo + 1
       dmPut("ORDLINES","ORDER_NUMBER",liOrderNo)
       dmPut("ORDLINES","ORDER_LINE",liLineNo)
       dmPut("ORDLINES","QUANTITY_RECEIVED",0.00)
    endif
    if SaveOrderLine(siStatus,stError) then
       LINE_STATUS.value = siStatus
    else
       eventInfo.setErrorCode(UserError)
       msgStop("Could not save order line",stError)
      if ORDLINES.RecordStatus("New") = True then
         liLineNo = liLineNo - 1
      endif
      ORDLINES.PostAction(DataCancelRecord)
      EXTERNAL_NUMBER.MoveTo()
      return
    endif
endif
if eventInfo.id() = DataDeleteRecord then
    disableDefault
    self.PostAction(DataCancelLine)
endif
if eventInfo.id() = DataCancelLine then
    CancelOrderLine()
endif

SaveOrderLine and CancelOrderLine are custom methods that do the SQL stuff.

On 26/02/2020 9:18 am, Mark Bannister wrote:
> Thanks.  Trying to get my head around this....
> So I've copied data to priv that is now a Paradox table.  Made changes.
>   How do I insert back into the Postgresql table?  I keep getting an
> saying the table in the PRIV directory does not exist:
> 'Relations ":PRIV:tablename.db" does not exist'
> 
> So for editing data do I have to build an insert query and NOT update
> from the PRIV table?
> ex:
> INSERT INTO films (code, title, did, date_prod, kind) VALUES
>      ('B6717', 'Tampopo', 110, '1985-02-10', 'Comedy'),
>      ('HG120', 'The Dinner Game', 140, DEFAULT, 'Comedy');
> 
> 


Copyright © 2004 thedbcommunity.com