xsharp.eu • SQL Example to get local Cursor???
Page 1 of 1

SQL Example to get local Cursor???

Posted: Sun Jul 14, 2019 8:32 pm
by Anonymous
Can someone give me a simple code example to send a query to SQL Server and get a local Cursor of records?

SQL Example to get local Cursor???

Posted: Sun Jul 14, 2019 8:46 pm
by lumberjack
Hi Matt,
FoxProMatt_MattSlay wrote:Can someone give me a simple code example to send a query to SQL Server and get a local Cursor of records?
I use DataTable as my local cursors

Code: Select all

var cmd := SQLCommand{"select * from <table>", oConn}
cmd:Connection:Open()
var dataReader := cmd:ExecuteReader()
var dataTable := DataTable{}
dataTable:Load(dataReader)

SQL Example to get local Cursor???

Posted: Sun Jul 14, 2019 9:49 pm
by FoxProMatt
I’m looking for work areas or cursors, like FoxPro, not .Net data tables.

SQL Example to get local Cursor???

Posted: Mon Jul 15, 2019 5:07 am
by wriedmann
Hi Matt,

the VO SQL classes have a SQLSelect and a SQLTable class for this, and therefore they are also in the current X# VO compatible libraries. But in VO they don't open up a workarea, they are objects that can be connected to a datawindow or databrowser.

To have such a functionality in X# you'll have to wait for the development team to build these classes (for the FoxPro runtime).

Wolfgang

SQL Example to get local Cursor???

Posted: Mon Jul 15, 2019 6:29 am
by lumberjack
Hi Wolfgang/Matt,
wriedmann wrote: the VO SQL classes have a SQLSelect and a SQLTable class for this, and therefore they are also in the current X# VO compatible libraries. But in VO they don't open up a workarea, they are objects that can be connected to a datawindow or databrowser.
To have such a functionality in X# you'll have to wait for the development team to build these classes (for the FoxPro runtime).
If my memory serves me right, Robert indicated that the idea would be to have a "cursor" type wrapped around DataTable, hence why I suggested DT. Otherwise, probably a bit of a rework of ArrayServer or bArrayServer might be the solution...

SQL Example to get local Cursor???

Posted: Mon Jul 15, 2019 6:53 am
by wriedmann
Hi Johan,

anyway - currently there is no way, since there is no FoxPro compatible runtime.
And it can take some time as it is a lot of work.... and IMHO it makes not too much sense to spend now time in these functionalities if other more basic FoxPro languages features are to be implemented.
As you know, development time is always too short.... Robert could easily quadruplicate his time, and it would always not be enough.
Wolfgang
P.S. as you know, I'm doing in X# what I see as possible (the last time a extension to Combit cRM), but I'm ways behind my plan to migrate my VO applications to X#

SQL Example to get local Cursor???

Posted: Mon Jul 15, 2019 7:15 am
by robert
Matt,
Wofgang is right. This is NOT in the product yet.
In VO we have an OOP layer on top of workareas and another OOP layer on the SQL API.

We are planning to support the FoxPro SQL.. functions and select the resulting data in a DataTable/DataView (like Johan said) and use this as data for a workarea. A SQL RDD you could call this. This will be part of the FoxPro runtime.

Robert

SQL Example to get local Cursor???

Posted: Mon Jul 15, 2019 7:22 am
by lumberjack
Hi Wolfgang,
wriedmann wrote: anyway - currently there is no way, since there is no FoxPro compatible runtime.
Fully agree, and hence why I try and stay away from XBase style interfaces if there is an alternative .NET feature. It is less work in the end to rather create wrappers around XBase style features, e.g. DBFToDataTable() etc. to not keep you bound to VO classes.
And it can take some time as it is a lot of work.... and IMHO it makes not too much sense to spend now time in these functionalities if other more basic FoxPro languages features are to be implemented.
As you know, development time is always too short.... Robert could easily quadruplicate his time, and it would always not be enough.
I know and I appreciate what Robert is doing, feels sometimes even when I try to assist as if I do not have the capability of assisting...
P.S. as you know, I'm doing in X# what I see as possible (the last time a extension to Combit cRM), but I'm ways behind my plan to migrate my VO applications to X#
I know, it is quite a balance between keeping software running and migrating to .NET/X#

SQL Example to get local Cursor???

Posted: Mon Jul 15, 2019 11:45 am
by FoxProMatt
Indeed, my interest was to explore X sharp from an Xbase programming style. I just wasn’t sure if the recent work with had brought it to that stage yet.

I know there are .net alternatives but since XSharp is billed as an X base replacement candidate, I want to work at it from the xBase perspective to see what limits it runs into.

I’ll keep waiting and maybe the September release may have this capability.