Error on Long variable value

I have a SQL Stored procedure that updates a table of “comments”. The comment field is a varchar(2500) on the database table. I’m using the following PHP code to execute the stored procedure on the database.

   require_once("../dhtmlxConnector/php/codebase/db_sqlsrv.php");
   require_once("../dhtmlxConnector/php/codebase/data_connector.php");
	
    $serverName = "10.xx.x.xx";
    $uid="xxxxx";
    $pwd="xxxx";

    $connectionInfo = array( "UID"=>$uid, "PWD"=>"xxxxx", "Database"=>"xxxx", "LoginTimeout"=>15); 

    parse_str($_SERVER['QUERY_STRING']);	
    $comments = substr($comments, 0, 128);
    $comments .= '"';

    $data = new JSONDataConnector($res,"SQLSrv");
	
    $data->render_complex_sql("exec Portfolio.addComments $entity,$entity_id,$comments","","");

When I run this code just passing the values as they are sent via the URL string it appears that the $comments variable gets set to NULL if it is longer than 128 bytes long, but runs just fine if the $comments variable passed in the URL string is equal to or less 128 bytes. In the code above I have truncated the $comments field to only be 128 bytes long and when I do this the code works fine. This was only done to try to figure out what was going on with this process and wouldn’t be in the final code if it was working correctly.

Is there a limit on how long a parameter can be when using the connector object?

There is no any limitations on connector level. Values are sent to DB without any modifications, so it must be some DB level problem. ( When you are using render_complex_sql - connector don’t make any changes at all )

If you are calling the same query directly against DB - does it work correctly ?