Fix potential problems when calling polymorphic SQL functions from Tcl
Some functions are defined in the database with the same number of arguments but different types, e.g., first argument "package_key" (type text) or "package_id" (type integer). This is fine from the SQL standpoint, but when calling from Tcl via bind-vars (e.g. ":package_id"), everything is passed as a string, and potentially, the wrong function is called.
Now, all the automatically generated subs are generated with casts, when the integer based variant must be called.
Some examples:
Before: set s [ns_pg_bind 0or1row $__DB {select apm__set_value(:package_id,:parameter_name,:attr_value)}] set s [ns_pg_bind 0or1row $__DB {select apm__get_value(:package_id,:parameter_name)}]
Now: set s [ns_pg_bind 0or1row $__DB {select apm__set_value(CAST(:package_id AS integer),:parameter_name,:attr_value)}] set s [ns_pg_bind 0or1row $__DB {select apm__get_value(CAST(:package_id AS integer),:parameter_name)}]