I have a link generator written that is reading Source (Oracle) tables and that uses the %Library.ResultSet class. for each it gets column name, type, maxsize, precision, lais, readonly, required & data type name and builds Cache Linked Table.
Are you referring to this logic where I need to apply scale? I do not see any SCALE references in logic.
if (jdbc) {
s rs= ##class(%Library.ResultSet).%New("%GTWCatalog:SQLFieldsJ")
} else {
s rs= ##class(%Library.ResultSet).%New("%GTWCatalog:SQLFields")
}
s sc = rs.Execute(gateway, table, schema)
if ($$$ISERR(sc)) {
d $system.OBJ.DisplayError(sc)
quit sc
}
s tname = schema _ "." _ table
s cols = ""
while rs.Next() {
s externalcolumnname=rs."COLUMN_NAME",
columnname = externalcolumnname,
columntype=rs.DATATYPE,
columnmaxsize=rs."COLUMN_SIZE",
columnprecision=rs."DECIMAL_DIGITS",
columnalias="" /* defaults to externalcolumnname */,
readonly=0 /* hardcoded */,
required='rs.NULLABLE,
notused="",
datatypename=rs."DATATYPE_NAME"
if prikey="",(externalcolumnname["_cd")!(externalcolumnname["_id") SET prikey=externalcolumnname
s col=$LTS($LB( externalcolumnname,
columnname,
columntype,
columnmaxsize,
columnprecision,
columnalias,
readonly,
'required,
notused,
datatypename ),"^")
s cols = cols_$LB(col)
}
s cols=$LTS(cols,"@")
d rs.Close()
Hi Robert,
When I review the existing DDL Mapping for NUMBER, the datatype states: %Library.Numeric(SCALE=0)
This does not make any sense my generated SQL Table code(.cls & .int) is validating with EXTERNALSQLTYPE=2 and $isvalidnum(%val,2,,)
I thought SCALE=0 allowed any decimal value but it appears somewhere else there is logic that is defaulting this SCALE to 2.
Why SCALE=4? Wouldn't that fix 4 decimal placement? I'm am looking for a SCALE that will allow any number with any decimal placement.