Question
richard roeder · Sep 6, 2017

Limit of characters in call procedure with driver ODBC

Hi,

I'm developing an integration between Caché servers by ODBC conection, and I have the following problem.

In this call:

call COSClass_Methode('222169^^98^155^64530^06:30^021542987897458855441112877855^1^0^281992^GC')

the ODBC driver is truncating the string to 50 characters.


If I run this same command with $system.SQL.Shell(), this doesn't occur.
I did a test creating several parameters for COSClass_Methode, and they all have a 50 character limitation.

Does anyone know why the ODBC Cache Driver limits the number of characters per parameter of this type of call?
Or, how can I adjust this?

Example of implementation http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=BGOD_gateway#BGOD_C127276

For connection I used the %Library.SQLGatewayConnection class

Basic example of the called class

Class User.COSClass Extends %Persistent [ Owner = {_PUBLIC} ]
{

ClassMethod MethodeExecute(ByRef QHandle As %Binary, data1 As %Library.String, data2 As %Library.String, data3 As %Library.String) As %Status
{
set ^rht(2,1)=$get(data1)
set ^rht(2,2)=$get(data2)
set ^rht(2,3)=$get(data3)
quit 1
}

Query Methode(data1 As %Library.String, data2 As %Library.String, data3 As %Library.String) As %Library.Query(CONTAINID = 1, ROWSPEC = "Result,Par2:%String") [ SqlProc ]
{
}
00
1 1 4 1,320
Log in or sign up to continue

The default for %String is MAXLEN=50

if you write in your definition %String(MAXLEN="")   also in Method calls this should be enough.

Query Methode(data1 As %Library.String(MAXLEN=""), data2 As %Library.String(MAXLEN=""), data3 As %Library.String(MAXLEN="")) As %Library.Query(CONTAINID = 1, ROWSPEC = "Result,Par2:%String") [ SqlProc ]

  and so on.

Or you make you own data type  inheriting %String overwriting  Parameter MAXLEN=""

Or just use %Library.VarString which makes just this MAXLEN=""
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

Query Methode(data1 As %LibraryVar.String, data2 As %Library.VarString, data3 As %Library.VarString) As %Library.Query(CONTAINID = 1, ROWSPEC = "Result,Par2:%VarString") [ SqlProc ]

  and so on.

$system.SQL.Shell()  is bypassing ODBC Driver and talks directly to Caché Storage

an external query tool expects to get a MAXLEN by definition of ODBC  (ages back).
So this is a matter of backward compatibility.
Pls. check the grey hook left of ANSWER to confirm questions as done

Thx.

thaks,

that works!!

but, why this command work in the $system.SQL.Shell() without informing (MAXLEN="")?