Remote views, VFP database container (.dbc) and database connections

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
RajNZ
Posts: 5
Joined: Sun Sep 27, 2020 11:03 pm

Remote views, VFP database container (.dbc) and database connections

Post by RajNZ »

Hi,

Sorry if this is answered elsewhere, but I haven't found a document covering this area.

An important part of making X# feasible for converting our large VFP project is support for :
Remote views
VFP database container (.dbc) to hold the remote views (or some alternative)
Database connections, defined in the .dbc to hold the connection string etc that the views are based on (or some alternative)

For example :
open database xyz
set database to xyz
create connection myconn ... connstring "Driver=SQL Server;Server= etc" ...
create sql view myview remote connection myconn as select * from mytable
use myview
...do stuff with myview, including writing with row and table buffering...
use in myview

Would also be great if tableupdate() and tablerevert() are supported, but even just immediate writes might be fine.

While it would be possible to use SQLStringConnect() and sqlexec() instead of remote views, that would involve a great deal of re-coding in VFP and would make an X# conversion impractical at that point.

Could someone please point me to a document that might cover this, or an entry in the roadmap that either includes or excludes support for these concepts?

Thanks.
Paul
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Remote views, VFP database container (.dbc) and database connections

Post by robert »

Paul,
This is indeed not supported yet.
Can you create a small example against the Sql Server Northwind database that shows how you are using this ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
RajNZ
Posts: 5
Joined: Sun Sep 27, 2020 11:03 pm

Remote views, VFP database container (.dbc) and database connections

Post by RajNZ »

Hi,

A simple example would be this :

Code: Select all

*** It is assumed that the Northwind VFP database has already been created.
*** The following 2 lines would be executed once near the start of the application.
open database Northwind
set database to Northwind
*** The following 2 lines would be executed as needed, whenever changing between back-end databases.
create connection myconn  connstring "Driver=SQL Server;Server= etc..."
create sql view OrdersView remote connection myconn as select * from Orders where OrderID = ?InputOrderID

*** Fetch the details for order 10248 into a cursor with an alias of CurrentOrder.
local InputOrderID
InputOrderID = "10248"
use OrdersView in 0 alias CurrentOrder
*** Update the shipping address.
replace CurrentOrder.ShipAddress with "my new address" in CurrentOrder
*** Could execute a TableUpdate() now to explicitly commit the data, or simply rely on the automatic commit whenever the row is navigated away from or the cursor is closed.
use in CurrentOrder
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Remote views, VFP database container (.dbc) and database connections

Post by robert »

Paul,
Thanks for the example.
I tried this here and the update was not sent to the server.

I checked the FoxPro docs, and after adding DBSETPROP("OrdersView","VIEW","SendUpdates",.t.) then indeed the changes were sent back to the server.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply