Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLExec() will no longer create generator in FireBird
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQLExec() will no longer create generator in FireBird
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Firebird
Miscellaneous
Thread ID:
01136637
Message ID:
01136637
Views:
94
Hi all

I have the following, previously working function to generate a remote back-end PK. It no longer works in VFP9 (was working in VFP6). Please advise what am I missing here. I am sure I have not changed anything for the back-end recently.
LPARAMETERS tcBaseTable

LOCAL lnConHnd, lnOldArea, luRetVal

*** we are overriding the parent logic for FireBird databases
*** we are also assuming that the generator is named as follows
*** gen_maccounts_iid

lnOldArea = SELECT(0)

lnConnHnd = CURSORGETPROP("ConnectHandle")

SQLEXEC(lnConnHnd , [SELECT gen_id(GEN_] + STRTRAN(tcBaseTable, "DBO.", "") ;
	+ [_IID, 1) AS nNextId from rdb$database])

*** 15/07/2006 new VFP9 behaviour will not return an empty cursor
IF USED("sqlResult")
	luRetVal = VAL(sqlResult.nNextID)
ELSE
	*** 15/07/2006 FB return such a number(?) to signify non-existant generator
	luRetVal = 2147483647 + 1
ENDIF


*** If going beyond the Integer values
IF NOT BETWEEN(luRetVal, -2147483647, 2147483647)
	luRetVal = 1

	SQLEXEC(lnConnHnd , [SET GENERATOR GEN_] + STRTRAN(tcBaseTable, "DBO.", "") ;
		+ [_IID TO 1])
lncnt = AERROR(laerr)
FOR lni = 1 TO lncnt
WAIT WINDOW laerr[lni, 1]  && 1526
WAIT WINDOW laerr[lni, 2]  && Connectivity error: invalid request BLR at offset 25 generator GEN_MSERVICEOFFICE_IID is not defined
WAIT WINDOW laerr[lni, 3]  && invalid request BLR at offset 25 generator GEN_MSERVICEOFFICE_IID is not defined
WAIT WINDOW laerr[lni, 4]  && HY000
WAIT WINDOW laerr[lni, 5]  && 335544343
WAIT WINDOW laerr[lni, 6]  && 3
WAIT WINDOW laerr[lni, 7]  && .NULL.
endfor
ENDIF

CloseUsed("sqlResult")

SELECT (lnOldArea)

RETURN luRetVal
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Next
Reply
Map
View

Click here to load this message in the networking platform