fbpx
Welcome, Guest
Username: Password: Remember me
This public forum is meant for questions and discussions about Visual FoxPro
  • Page:
  • 1

TOPIC: USED(), DELETED(), INSERT INTO

USED(), DELETED(), INSERT INTO 1 week 5 days ago #11911

  cecilchamp's Avatar Topic Author cecilchamp Offline Posts: 49
I suppose these are not working yet? USED(), DELETED() and INSERT INTO? I tried them out in code and they are not recognized. I think I read that INSERT INTO is not working. APPEND BLANK and REPLACE work well.

USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text

#command SET DEFAULT TO <*path*> => SetDefault(<(path)>)

FUNCTION Start() AS VOID STRICT
LOCAL i AS INT
SET DEFAULT TO C:\addr\data
SELECT 0
IF !USED("names")
USE names Index LastName
SELECT NAMES
* INSERT INTO does not work.
*INSERT INTO Names (LastName, FirstName) Values ('Champenois', 'Sean')
*APPEND BLANK
*REPLACE LastName WITH 'Champenois', FirstName WITH 'Sean'
SCAN for LastName = "Champenois" AND !DELETED()
? LastName, FirstName
ENDSCAN
WAIT
SELECT Names
USE
ELSE
? "The table, NAMES, is in use by another program."
ENDIF
RETURN

Please Log in or Create an account to join the conversation.

USED(), DELETED(), INSERT INTO 1 week 5 days ago #11913

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 419
Hi Cecil,

when you look at the latest Used() and Deleted() Github sources you´ll see that the next release will contain the overloads:
FUNCTION Deleted(uArea AS USUAL) AS LOGIC STRICT
	RETURN (uArea)->(Deleted())


FUNCTION Used(uArea AS USUAL) AS LOGIC
    RETURN (uArea)->(Used())

github.com/X-Sharp/XSharpPublic/blob/5da...Dbfunctions.prg#L383

For the moment simply add both funcs to your sources and you can already do something like:
IF !USED("names") 

!! But don´t forget to remove both funcs from your sources as soon the next release is published !!

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

USED(), DELETED(), INSERT INTO 1 week 5 days ago #11916

  robert's Avatar robert Offline Posts: 1364
Cecil,
The function overloads that take an alias or workarea number will be added in the next build.
You can already see that code in Githib:
github.com/X-Sharp/XSharpPublic/blob/mas...Dbfunctions.prg#L383

Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

USED(), DELETED(), INSERT INTO 1 week 4 days ago #11920

  FoxProMatt_MattSlay's Avatar FoxProMatt_MattSlay Away Posts: 305

I suppose these are not working yet? USED(), DELETED() and INSERT INTO?


Cecil - Used() and Deleted() are VFP functions, and it sounds like those are easy, if not already done, ready for next release.

However, INSERT INTO is a different beast that X# Team will have to tackle. It's not quite as easy, if I had guess.

Please Log in or Create an account to join the conversation.

Last edit: by FoxProMatt_MattSlay.

USED(), DELETED(), INSERT INTO 1 week 4 days ago #11921

  robert's Avatar robert Offline Posts: 1364
Matt,

Yes you are right. INSERT TO belongs to the "embedded SQL" commands.
We will implement these but this requires some work.

Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

USED(), DELETED(), INSERT INTO 1 week 4 days ago #11922

  FoxProMatt_MattSlay's Avatar FoxProMatt_MattSlay Away Posts: 305
Robert - what is your priority between the "embedded SQL" commands, and the SqlExec() stack?

I bet SqlExec() is an easier task, but I think the "embedded SQL" commands are an important piece to demonstrate to VFP community to show X# is ready for serious consideration.

I know you mentioned using VFPOLEDB to handle embedded SQL, but one thing my little brain sees as an issue with that is that it seems like VFPOLEDB expects that the query will be run against all DISK-based DBFs, but in real apps we also need to execute embedded SQL commands against existing local cursors that are not on disk.

For instance, I often run SqlExec() to pull over a few separate cursors from Sql Server into VFP, then I run embedded SQL commands on the cursors to do JOINs, UNIONS, UPDATEs, INSERTs, etc on those local cursors to present data to user in reports, grids, etc.

Can you see getting VFPOLEDB to work with local cursors?

Please Log in or Create an account to join the conversation.

Last edit: by FoxProMatt_MattSlay.

USED(), DELETED(), INSERT INTO 1 week 4 days ago #11927

  robert's Avatar robert Offline Posts: 1364
Matt,

VFPOLEDB was an idea, nothing more.We now realize that VFP also uses SQL against open cursors and that won't work.
We realize how important these queries are, so we will work on them, you can be assured of that.
I don't want to make promises here about priorities. We are doing some research into this at this moment. Based on the results of this research we will make the decision about priorities.

And yes we know what you want:



Robert
XSharp Development Team
The Netherlands

Please Log in or Create an account to join the conversation.

  • Page:
  • 1