Sujet : Re: VMS x86-64 database server
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.vmsDate : 09. Jul 2025, 08:22:19
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <104l5bb$4bv9$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Pan/0.162 (Pokrosvk)
On Tue, 8 Jul 2025 20:31:37 -0400, Arne Vajhøj wrote:
On 7/8/2025 7:37 PM, Lawrence D'Oliveiro wrote:
>
On Tue, 8 Jul 2025 18:20:50 -0400, Arne Vajhøj wrote:
>
Standards evolve. They add lots of new stuff. And sometimes they
remove stuff that is not needed anymore.
>
But those standards in particular have not evolved.
>
SQL standard has evolved. Lot of stuff has been added.
But nothing new in EXEC SQL. For example, did they offer any
equivalent to the following utility functions?
def sql_string_list(the_list) :
"returns a list containing the quoted items of the_list, suitable" \
" for use in an “in” clause."
return \
"(" + ", ".join([sql_string(s) for s in the_list]) + ")"
#end sql_string_list
def escape_sql_wild(s, escch) :
"escapes SQL pattern wildcards in s with escch. The same escch needs" \
" to be passed to the ESCAPE clause for the LIKE operator."
if not isinstance(s, str) :
raise TypeError("expecting s to be a string")
#end if
if not isinstance(escch, str) or len(escch) != 1 :
raise TypeError("expecting escch to be a single-character string")
#end if
result = []
for ch in s :
if ch == escch or ch == "%" or ch == "_" :
result.append(escch)
#end if
result.append(ch)
#end for
return "".join(result)
#end escape_sql_wild
def escape_sql_name(n, escch = "\"") :
"converts n to escaped form to avoid potential conflicts with SQL keywords" \
" and other syntax errors (e.g. from embedded spaces). escch should be “\"”" \
" as per the SQL standard."
assert len(escch) == 1
out = []
for i, split1 in enumerate(n.split(escch)) :
if i != 0 :
out.append(escch * 2)
#end if
out.append(split1)
#end for
return escch + "".join(out) + escch
#end escape_sql_name