Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird problem
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01519939
Message ID:
01519968
Views:
48
This message has been marked as a message which has helped to the initial question of the thread.
>>>Do you want me to torture you? :)
>>
>>:o)))))))))))))))))
>>
>>>I give you 5 more minutes for figuring this out. BTW, I should have figured it out myself right away, but only after I run Profiler by your advice it became obvious for me.
>>
>>
>>Why not put everything in one query?, why you need to split it to 3 different batches?
>>
>>>
>>>Funny thing that I spent more than 1h. on this problem - now, it seems I have to go back as I don't see an alternative.
>
>Because I need to get both cursors back and make both updatable. May be it will be also quick without using temp table (with subquery), but since that's how it was originally coded, I'll keep it and for this case embed parameters as it was before. We're using special function VFP2SQL, so it's almost safe.
>
>BTW, there are 2 batches, not 3.
PRIVATE cDep, cCat, cItem
cDep = EVL(substr(lcViewVar,1,10),NULL)
cCat = EVL(substr(lcViewVar,11,10),NULL)
cItem = EVL(substr(lcViewVar,21,10),NULL)


TEXT TO lcS TEXTMERGE noshow
SELECT * FROM ItemFund
where department = ?m.cDep and Category = ?m.cCat and Item = ?m.cItem
endtext

mysqlexec(m.lcS, 'csrItemfund', program())
select csrItemfund
if reccount() = 0
	append blank
endif

TEXT TO lcS noshow
SELECT * FROM i_invent
where department = ?m.cDep and Category = ?m.cCat and Item = ?m.cItem
endtext

mysqlexec(m.lcS, 'i_invent', program())

make_view_updatable('i_invent',5)	&&table buffering 

TEXT to lcS NOSHOW 
if object_id('tempdb..#csrI_Item') is not null
   drop table #csrI_Item
select * 
  into #csrI_Item
  from i_items  
  where 1 = 0
ENDTEXT  

mysqlexec(m.lcS, '', PROGRAM()) && no cursor is created, so call this function as it should :-)


TEXT to lcS NOSHOW 
INSERT INTO #csrI_Item
select * 
  from i_items  
  where department = ?m.cDep
  and category = ?m.cCat
  and item = ?m.cItem
SELECT * from #csrI_Item
ENDTEXT  

mysqlexec(m.lcS, 'i_items', PROGRAM())

TEXT to lcS NOSHOW 

select * from i_attlnk WHERE invent_id in (select invent_id FROM #csrI_Item)
DROP TABLE #csrI_Item
ENDTEXT  
mysqlexec(m.lcS, 'i_attlnk', PROGRAM())
Something like that.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform