Re: Testing for no input with CONSTRUCT statement
Posted in 1994
In article <1994Jan28.201140.15960@fripp.ri.cadre.com> you write: } I had a situation where I wanted to prevent the users of a query screen from } simply hitting the escape key and selecting every row in a table. My } problem was that we are using the CONSTRUCT statement to generate the WHERE } clause of the SELECT statement. After many gyrations, I finally discovered } that in such a situation, the CONSTRUCT statement builds its where clause } simply as "1=1", which of course, simply evaluates to TRUE. Unfortunately, } it buries this in a string surrounded by newlines and spaces. I built the } following function to check for these situations, and I thought it might } be helpful to others, so here it is. } } } # Here's an example of how the function can be called } function foo() } define where_part char(2000) } define allrows smallint } } construct by name where_part on screen-rec.* } call test_select_all(where_part) returning allrows <<<<< } if (allrows = TRUE) then <<<<< } error "You must enter some search criteria." } return FALSE } end if } . } . } end function } Why can't you replace the two lines (the <<<<< ones) with: IF where_part MATCHES "*1=1*" THEN DAS -- David Snyder @ Snide Computer Services - Folcroft, PA Current Release is db4glgen-3.17 UUCP: ..!uunet!das13!dave INTERNET: dave@das13.snide.com