Storing code in a table
I have a table called export_list, and a column called exec_code (type memo). In my program I want to execute the code stored in the 'exec_code' column if the column is not empty. Is this possible? My thought was that I could use macro expansion, but I get various errors when trying to execute multi-line statements. Do you all have any tips? Thanks, Justin Darnell ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
Justin: - - -- - Sure, just strToFile() into some temp file name, COMPILE it, and run it. I do it all the time. Ken ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
Various ways - you could dump it to a temporary file with STRTOFILE() and then _VFP.DoCmd("DO tempfile.prg") -- Alan Bourke [EMAIL PROTECTED] -- http://www.fastmail.fm - Faster than the air-speed velocity of an unladen european swallow ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
Thanks to both of you for your responses. That does work. Do you have to take it to a file? Not a big deal, just curious. Thanks again, J On 1/18/07, Alan Bourke <[EMAIL PROTECTED]> wrote: > Various ways - you could dump it to a temporary file with STRTOFILE() > and then _VFP.DoCmd("DO tempfile.prg") > -- > Alan Bourke > [EMAIL PROTECTED] > > -- > http://www.fastmail.fm - Faster than the air-speed velocity of an > unladen european swallow > > > [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: Storing code in a table
You may be able to use ExecScript. Tracy > -Original Message- > From: Justin Darnell > Sent: Thursday, January 18, 2007 5:02 PM > > Thanks to both of you for your responses. That does work. > > Do you have to take it to a file? Not a big deal, just curious. > > Thanks again, > > J > ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
It is funny, I am sitting here trying to figure out whether and how to do the same thing in PHP. I have always liked the idea of maintaining validation language and other utility code in tables. Developing my own framework in PHP is bringing out my "Wish I would have done it's" of my VFP framework. Ken On Jan 18, 2007, at 4:15 PM, Tracy Pearson wrote: > You may be able to use ExecScript. ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
On 1/18/07, Justin Darnell <[EMAIL PROTECTED]> wrote: > Thanks to both of you for your responses. That does work. > > Do you have to take it to a file? Not a big deal, just curious. > Are you running VFP9? EXECSCRIPT() should do the trick without a tempfile. -- Dave Thayer Denver, CO ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: Storing code in a table
This is strange, just 2 days ago I was wondering how to do the same thing. I was just getting ready to post to the list. Ain't that funny. Regards Rodney > -Original Message- > I have a table called export_list, and a column called exec_code (type > memo). In my program I want to execute the code stored in the > 'exec_code' column if the column is not empty. Is this possible? My > thought was that I could use macro expansion, but I get various errors > when trying to execute multi-line statements. == CONFIDENTIALITY NOTICE: The information in this electronic message (including any attachments) is confidential and may be privileged or proprietary. If you are not the intended recipient, any dissemination, disclosure, copying, downloading, or other use of the information is prohibited and unauthorized, and may be unlawful, regardless of address or routing. If you are not the intended recipient, please inform the sender immediately and permanently delete and destroy the original and any copies of this message, including any attachments. == ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: Storing code in a table
And just last week, I was telling the Chicago FUDG about how I store programs in a memo field that is launched via a combo box selection John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rodney Dixon Sent: Thursday, January 18, 2007 9:38 PM To: profox@leafe.com Subject: RE: Storing code in a table This is strange, just 2 days ago I was wondering how to do the same thing. I was just getting ready to post to the list. Ain't that funny. Regards Rodney > -Original Message- > I have a table called export_list, and a column called exec_code (type > memo). In my program I want to execute the code stored in the > 'exec_code' column if the column is not empty. Is this possible? My > thought was that I could use macro expansion, but I get various errors > when trying to execute multi-line statements. == CONFIDENTIALITY NOTICE: The information in this electronic message (including any attachments) is confidential and may be privileged or proprietary. If you are not the intended recipient, any dissemination, disclosure, copying, downloading, or other use of the information is prohibited and unauthorized, and may be unlawful, regardless of address or routing. If you are not the intended recipient, please inform the sender immediately and permanently delete and destroy the original and any copies of this message, including any attachments. == [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
Justin Darnell wrote: > I have a table called export_list, and a column called exec_code (type > memo). In my program I want to execute the code stored in the > 'exec_code' column if the column is not empty. Is this possible? My > thought was that I could use macro expansion, but I get various errors > when trying to execute multi-line statements. > > Do you all have any tips? > > Andy Kramek has done something like this recently, iirc. It certainly can be done, and you might seek his advice for tips since he's apparently been successful at it. See the tightlinecomputers.com website for his contact info. -- Michael J. Babcock, MCP MB Software Solutions, LLC http://mbsoftwaresolutions.com http://fabmate.com "Work smarter, not harder, with MBSS custom software solutions!" ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Storing code in a table
< Are you running VFP9? EXECSCRIPT() should do the trick without a tempfile. > I don't think that is entirely correct. I believe ExecScript does indeed create a tempfile (so your users will need write permissions to the temp directory), but you won't have to handle the creation and compilation of the temp file yourself. Eyvind. ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.