Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I execute a VFP stored procedure using SQLEXEC()/
Message
De
16/09/1998 06:59:03
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
16/09/1998 00:21:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00135933
Message ID:
00137205
Vues:
15
>>Hidy Kamal,
>>I also later noticed I have added other procs while old handle was alive. Good news order of proc and length doesn't bother :) I could understand why #define doesn't work but will need experimenting before really using. It's good to know it works with vital ones :) One row dummy table is the best for "cheat". I created that dummy before select and drop after select. Here is my working copy code :
sqlexec(gnConnHandle,"create table dummy (mydummy L)")
>>sqlexec(gnConnHandle,"insert into dummy values (.f.)")
>>cSQL = "select "+;
>>	"getmykey(3,[testtable]) as retval1,"+;
>>	" getkey(5) as retval2,"+;
>>	" check() as retval3 from dummy"
>>sqlexec(gnConnHandle,cSQL)
>>? retval1, retval2, retval3
>>sqlexec(gnConnHandle,"drop table dummy")
Cetin
>>
>>>Hi Cetin,
>>>
>>>This is really a good cheat. The good news though is that it works. From my testing on Codebook's NewId function to get new id's from VFP StoredProcedure. What I found that #DEFINES don't work, though functions like LOCK, UNLOCK, SEEK, EVAL work perfectly. The length of the name of the function, the position i.e. 1st one, 2nd one etc also does not matter.
>>>
>>>What is required is an table with an single record on which the select can be issued to return just one row.
>>>
>>>I tested this on local machine (NT workstation) and a remote one too (NT Server) and the results have been positive. Though the one on the server was a little slower... obviously... but this time it was slower than running a query but the results returned were right.
>>>
>>>This was also tested on VFP 5 (Build 415) and VFP6 and worked at both the places.
>>>
>>>>Only a cheat (select storedproc(parm) as result ...) but that also succeeds if "storedproc is the first proc in stored procs.
>
>What about if two users run it at the same time ???

Hi Nabil,
Comeon ! It was just an example so it was harmless to hardcode tablename as "dummy". Fox has nice functions such as sys(2015) to provide a temp table name instead of "dummy". Rest is SQL and won't be affected with multiusing.
Jeroen I think I needn't this CC at all.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform