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
May. 30, 2013
06:04 am
3SP0D19NOShow this entire thread in new window
Gratar Image based on email address
From:FoxInCloud support
To:Tuvia Vinitsky
thanks Tuvia for this contribution
We'll review and implement

In order to make autoinc fields work in awserver.PropsRestore_DS_Alias_cXMLcursor you need to adjust the code as shown here:

* ------------------------------------------------------------HIDDENPROCEDURE PropsRestore_DS_Alias_cXMLcursor && Curseur chargé avec les données XMLLPARAMETERS tcXMLLOCAL laField[1], liField, lnSelect, lcResult&& CursorToXML() ne rendant pas les valeurs nulles,&& créer un curseur dont les champs sont .NULL. par défaut FOR liField = 1 TOAFields(laField)* 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]=''**TBV if you try and change a autoinc field you crash the cursor creation below,* so added a check if [x,17]> 0, which for sure would indicate an autoinc field.* the two lines in the if..then are the original code*IF laField[m.liField,17]< 1 AND laField[m.liField,18]< 1 laField[m.liField, 5] = .T. && Null values allowed laField[m.liField, 9] = '.NULL.'&& Field default valueENDIF*TBV do not do this!*STORE 0 TO;* laField[m.liField, 17]; && NextValue for autoincrementing* , laField[m.liField, 18] && Step for autoincrementing *ENDFOR lcResult = Alias() + '_XML' lnSelect = Select(0)CREATECURSOR (m.lcResult) FROMARRAY laFieldSELECT (m.lnSelect)* TBV* This XMLTCURSOR will aways fail because the autoinc field throws a read-only error message.* The VFP docs say the only way around that is to set autoincerror off.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)*&& 8192&& Specifies that cCursorName is the name or alias of an existing table or cursor&& and imports the data from the specified XML file into an existing table or predefined cursor.&& If cCursorName contains data, the data imported from the XML file is appended to the existing dataRETURN m.lcResult



Thierry Nivelet (FoxInCloud)
Never explain, never complain (Queen Elizabeth II)


Viewing all articles
Browse latest Browse all 10393

Trending Articles