Re: 4GL variable substitution in SQL statements - a feature request
Posted in 1998
In article <362DF6F7.6D8E@bayer.co.uk>, Peter Lancashire <Peter.Lancashi re.PL1@bayer.co.uk> writes >Having been bitten by this one several times recently I thought I would >ask if anyone else finds it a problem. > >4GL will, without warning, recognise variable names in scope at the time >it compiles a SQL statement. It then links them to the SQL. Often, this >is what you want but sometimes not, hence the addition of the @ prefix >to variable names which you would like to remain unlinked. > >I almost always prefix column names in SELECT stements with a table >alias, which almost always prevents the problem. The almost refers to >DELETE and UPDATE statements where the use of an alias table qualifer to >the column is often not required or usual. > >I would prefer if 4GL had a switch to make it work the SQL standard way, >which is to require a : prefix to linked variables. Why: > >That way the programmer is under total and clear control of what is >going on. > >The current system makes it tricky to use variable names that are the >same as column names unless the column names are qualified with a table >name or given the @ prefix. > >The current behaviour can result in a change to a SQL statement as a >result of adding a DEFINE of a variable name that happens to occur in >the SQL statement. > >The reader of the program can also see what is happening without needing >to discover what variable names are in scope at the SQL statement. > >Is there any support for this or am I just whingeing into the wind? Stop whining....SLAP!! Prefix variable names with p_ (or l_.m_ and g_ for local,module,global is you want).. -- David Williams Maintainer of the Informix FAQ Primary site (Beta Version) http://www.smooth1.demon.co.uk Official site http://www.iiug.org/techinfo/faq/faq_top.html I see you standin', Standin' on your own, It's such a lonely place for you, For you to be If you need a shoulder, Or if you need a friend, I'll be here standing, Until the bitter end... So don't chastise me Or think I, I mean you harm... All I ever wanted Was for you To know that I care