Well, I should confess that it's some bug in this code of mine, although
I've retooled this to totally eliminate the DBF file and just go right
to my backend (MySQL). This was the old code. No doubt I had something
assumed/wrong with my DBF table:
FUNCTION Audit(tcFormName as String, tcUniqueID as String, tlEntering as
Logical, tcUserID as String, tcSessionID as String) as Logical
* Audits form usage.
*** mjb 05/15/2014 - using local audit table so no remote database
connection needed at startup; will be
*** mjb 01/07/2015 - using PRIVATE vars in INSERT cmd
*** mjb 07/29/2015 - changed local name to match for client
LOCAL llOK as Logical, lcSQL as String, loException as Exception,
lcLocal as String, liHandle as Integer
PRIVATE pcUserID, pcModule, pcUniqueID, pcSessionID
TRY
liHandle = this.GetHandle() && mjb 07-29-15
lcLocal = ADDBS(JUSTPATH(this.cAuditDBF)) + this.GetTableName('audit')
+ ".dbf"
IF NOT FILE(lcLocal) THEN
CREATE TABLE (lcLocal) (user c(16), module c(30), uniqueid c(10),
sessionid c(10), entering l, uploaded l, tlocal t)
ENDIF
USE IN (SELECT(JUSTSTEM(lcLocal))) && make sure not exclusive
IF VARTYPE(tcUserID) = "C" AND NOT EMPTY(tcUserID) THEN
pcUserID = tcUserID
ELSE
*** mjb 07/29/2015 - adjusted for startup call from main where
oUtils.oUser not yet existing
IF TYPE("oUtils.oUser") = "O" THEN
pcUserID = ALLTRIM(oUtils.oUser.cID)
ELSE
pcUserID = SYS(0)
ENDIF
ENDIF && VARTYPE(tcUserID) = "C" AND NOT EMPTY(tcUserID)
IF PEMSTATUS(_screen,"cUniqueID",5) THEN
pcSessionID = _screen.cUniqueID
ELSE
pcSessionID = 'unknown'
ENDIF
ltLocal = DATETIME()
IF VARTYPE(tcUniqueID) = "C" AND NOT EMPTY(tcUniqueID) THEN
pcUniqueID = tcUniqueID
ELSE
pcUniqueID = ''
ENDIF && VARTYPE(tcUniqueID) = "C" AND NOT EMPTY(tcUniqueID)
INSERT INTO (this.cAuditDBF) (user, module, uniqueid, sessionid,
entering, tlocal) ;
VALUES (pcUserID, ALLTRIM(tcFormName), pcUniqueID, pcSessionID,
tlEntering, ltLocal)
IF liHandle > 0 THEN
lcTable = this.GetTableName('audit')
TEXT TO lcSQL PRETEXT 15 NOSHOW TEXTMERGE
INSERT INTO <<lcTable>> (user, module, uniqueid, sessionid,
entering, tlocal)
VALUES
(?pcUserID,'<<ALLTRIM(tcFormName)>>',?pcUniqueID,?pcSessionID,<<IIF(tlEntering,1,0)>>,'<<TTOC(ltLocal,1)>>')
ENDTEXT
llOK = this.ExecuteSQL(lcSQL) = 1
IF llOK THEN
REPLACE uploaded WITH .T. IN
(JUSTSTEM(this.cAuditDBF))
ELSE
SET STEP ON
ENDIF && llOK
ENDIF
CATCH TO loException
llOK = .F.
*SET STEP ON
ENDTRY
RETURN llOK
ENDFUNC && Audit(tcFormName as String, tcUniqueID as String, tlEntering
as Logical, tcUserID as String, tcSessionID as String) as Logical
Thanks again to all of you who chimed in!
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.