Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there an advantage to using SQLPREPARE()?
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00366557
Message ID:
00367300
Views:
38
Thanks Larry.

Thanks also, Erik and Perry.


>Yes, this is true. Any explicit call clears the prepared statement.
>
>>Just so I'm clear, I assume that this only applies if the selects are in succession? If a different SELECT is run against the back end after the first call, I would have to do the whole call again and not just SQLEXEC(gnConnHandle)?
>>
>>>Actually, it's great for parameterized selects. From the SQLPREPARE help:
>>>gcAuthor = 'Smith'
>>>= SQLPREPARE(gnConnHandle, 'SELECT * FROM authors;
>>>   WHERE au_lname = ?gcAuthor')
>>>= SQLEXEC(gnConnHandle)
>>>
>>>...
>>>
>>>gcAuthor = 'Jones'
>>>= SQLEXEC(gnConnHandle)
>>>
>>>>The purpose is not necessarily for "Select ...." its more for Inserts and deletes that would be repeated multiple times.
>>>>
>>>>PF
>>>>
>>>>>>>Is there an advantage to using:
>>>>>>>
>>>>>>>SQLPREPARE(mnconnection,'SELECT....','cMyCursor')
>>>>>>>SQLEXEC(mnconnection)
>>>>>>>
>>>>>>>as opposed to just:
>>>>>>>
>>>>>>>SQLEXEC(mnconnection,'SELECT....','cMyCursor')
>>>>>>
>>>>>>From what I understand, SQLPREPARE will make the call faster for functions that will be called multiple times, because the the request doesn't have to be compiled each time...
>>>>>
>>>>>Well, unless I'm missing something, that seems kind of useless. I can't even think of a reason why I would run the same SQL-SELECT multiple times in a row.
>>>>>
>>>>>Thanks for the reply.
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Previous
Reply
Map
View

Click here to load this message in the networking platform