>>>>>Use a CursorAdapater class if you need memofields from a dynamic query. It was made for that purpose, and you only need to map certain fields.
>>>>>
>>>>Not an option for us.
>>>
>>>And why would that be?
>>
>>Because in that huge application (which is currently being re-written) there are statements like
>>
>>=mySQLExec('select * from myTable where ', ...)
>>
>>MyTable can have varchar(max) columns or varbinary(max) columns or text columns (sometimes one table has both types).
>>
>>So, what exactly you're proposing that will require minimum changes (say, just a change in mySQLExec procedure)?
>
>Yes: you had the good sense to wrap the sqlexec, so making it into a cursoradapter class that does the same work is easily done. The only question is whether you have metadata available (e.g., you are using hungarian notation; you have a data dictionary; etc. -- assuming you have the VFP tables available, it would be short work to get a table with table and fieldnames available where the VFP side is a memofield). From there it's straight-forward.
>
>Hank
Can you clarify what you're saying with a code sample? In our application we're getting info into read-write cursors. Then we either just display the data in each form or we use another special program which makes the cursor obtained by the sqlexec writable (similar to the old FAQ here by Vlad Grynchyshyn).
So, the typical BeforeOpenTables method would look like:
lcPar = iif(substr(oAppObj.ViewParameter,1,5)=='*ADD*', '-1', oAppObj.ViewParameter)
if left(m.lcPar,5) = "*DUP*"
lcPar = substr(m.lcPar, 6)
llDuplicate = .t.
endif
cursorsetprop("MapVarchar", .t., 0)
nodefault
set multilocks on
thisform.addproperty('arrViews[2]')
lcName = 'MB_BenefitsItemsLink'
lcSQL = textmerge("select * from dbo.<<lcName>> where BenefitID = <<m.lcPar>>")
if not m.llDuplicate
mysqlexec(lcSQL, m.lcName, program())
else
mysqlexec(m.lcSQL, m.lcName + '_Temp', program())
replace all BenefitId with 0, BenefitsItemsLinkId with 0 in (m.lcName + '_Temp')
lcSQL = textmerge("select * from dbo.<<lcName>> where 1=0")
mysqlexec(m.lcSQL, m.lcName, program())
endif
select (m.lcName)
index on itemid tag itemid
make_view_updatable(m.lcName, 5)
If it's not broken, fix it until it is.
My Blog