Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP8 Frontend to Postgres Backend Server
Message
General information
Forum:
Linux
Category:
Databases and Admin issues
Miscellaneous
Thread ID:
00722327
Message ID:
00722390
Views:
13
Hi R. Mathew,

You could give it a try. Here what I'm doing with postgres:

This is a simple app. I begins by creating a simple menu with two options
1) Do form lee
2) Exit App

It then create a CursorAdapter cursor object name oCA with alias of 'client'

Once the app starts, I can click on the menu to start form lee. Form lee has a grid. It is set to automatically append new rows when page down is issue from the last row of the grid. I have a custom button [Edit] that must be clicked to enable the grid. Buttonset1 cann't be used as it does not have code to work with the new cursorAdapter properties, method, and events, so I had to use custom buttons. If buffermodeoverride is set to 3, updates and inserts occur as I move between rows. If buffermodeoverride is set to 5, a custom button must be clicked. The custom button has:
tableupdate(1,.F.,'client')  && update all rows, but do not overwrite anothe user's updates.
oCA.CursorRefresh()  && requery the backend and refresh the grid
If I click on the delete mark column of the grid the record is deleted whether in buffer 3 or 5. Probably should have delete set on, since this permanently remove the record from the backend. Then the row in the VFP8 cursor will not be visible to tuggle back on, as this would not accomplish anything.

If menu option [Exit App] is selected, the form issue "clears events" from the queryunlaod if [X] in right hand corner of form is clicked, or from the Exit button's destroy event, if the [Exit] button is clicked.

Here is the code:
Do lee1.mpr
Set Sysmenu Automatic

connstring = "DATABASE=vfp2pg;SERVER=www.smvfp.com; port=5432;UID=VfP2Pg;pwd=HelloWorld;provider=MSDASQLR;DRIVER=postgreSQL;"
the_select = "select clintmst.clientno,clintmst.firstname,clintmst.lastname,"+;
                "clintmst.ccompany from clintmst"

oCA = createobject('CursorAdapter')
with oCA
    .name               = 'oCA'
    .Alias              = 'client'
    .AllowUpdate        = .T.
    .AllowDelete        = .T.
    .AllowInsert        = .T.
    .DataSourceType     = 'ODBC'
    .DataSource         = sqlstringconnect(connstring)
    .SelectCmd          = the_select
    .Tables             = 'clintmst'
    .CursorSchema       = "CLIENTNO I, FIRSTNAME C(21), LASTNAME C(20), CCOMPANY C(32)"
    .KeyFieldList       = "CLIENTNO"
    .UpdatableFieldList = "CLIENTNO, FIRSTNAME, LASTNAME, CCOMPANY"
    .UpdateNameList     = "CLIENTNO CLINTMST.CLIENTNO, FIRSTNAME CLINTMST.FIRSTNAME, LASTNAME CLINTMST.LASTNAME, CCOMPANY CLINTMST.CCOMPANY"
    .AllowUpdate        = .T.
    .SendUpdates        = .T.
    .UpdateType         = 1 && update
    .UseDeDataSource    = .T.
    .WhereType          = 1 && key field only
    .BufferModeOverride = 3
    prep = .CursorFill()
endwith

browse  && just added in case you don't have time to create menu/forms/etc.

read events

clear all
close all
set sysmenu to default

return
Leland F. Jackson, CPA
Software - Master (TM)
smvfp@mail.smvfp.com
Software Master TM
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform