Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: autoinc in cursors

$
0
0
Re: autoinc in cursors
FoxInCloud
Re: autoinc in cursors
Jun. 4, 2013
06:15 pm
3SU134IA2Show this entire thread in new window
Gratar Image based on email address
From:Tuvia Vinitsky
To:FoxInCloud support
There are/were 3 problems:

The original code creates a structure array from a table and then uses that array to make a cursor

CREATECURSOR (m.lcResult) FROMARRAY laField

- if you take a table that has triggers, make an array, then try and make a cursor from that array, it will crash. You need to remove the triggers.

That was problem #1.

Problem #2 was that creating that cursor from an array will not work with autoinc, which you addressed by this:

STORE 0 TO; laField[m.liField, 17]; && NextValue for autoincrementing , laField[m.liField, 18]&& Step for autoincrementing

But that is not necessary. But you do need this:

laField[m.liField, 5] = .T. && Null values allowed laField[m.liField, 9] = '.NULL.'&& Field default value

The problem #3 is that the XMLTOCURSOR function does not work with any autoinc fields. The reason for this is that the autoinc fields throw off errors that crash the process. The VFP docs say only way around this is to turn off the autoinc error and turn it back on like this:

LOCAL lcAINStat lcAINStat = CURSORGETPROP("AutoIncError",m.lcResult) =CURSORSETPROP("AutoIncError", "off", m.lcResult)*XMLToCursor(m.tcXML, m.lcResult, 8192)* TBV put it back =CURSORSETPROP("AutoIncError", lcAINStat, m.lcResult)



Tuvia,

Are you sure that a cursor can have triggers?
Looks more like a dbc table feature ...

thanks,


* ------------------------------------------------------------* TBV* The first row is the table itself, and if that has* triggers in it , goodnigt charlie creating and updating the cursor. So check that laField[1,13]='' laField[1,14]='' laField[1,15]=''



Viewing all articles
Browse latest Browse all 10393

Trending Articles