Skip to Content.
Sympa Menu

freetds - [freetds] two questions about executing stored procedures

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Kall, Bruce A." <kall AT mayo.edu>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] two questions about executing stored procedures
  • Date: Thu, 23 Dec 2004 10:38:06 -0600

I'm attempting to execute a store procedure on a Sybase system from php on my Linux box using freetds. This stored procedure requires a combination of required parameters, some of which have to be null.

Question #1

I've tried using mssql_query to do this, but as soon as I put any parameter on the query I get the following error:

php: dblib.c:303: buffer_add_row: Assertion `row_size <= buf->element_size' failed.

For instance,

==============================================================
mssql_query("execute myprocedure")

just fails because I am not sending it a required parameter:

PHP Warning: mssql_query(): message: Proc: myprocedure Tab: N/A No input parameters were entered.
==============================================================

When I try to put the parameter in I get the following:

mysql_query("execute myprocedure @parm1=1295 ")

php: dblib.c:303: buffer_add_row: Assertion `row_size <= buf->element_size' failed.

Any ideas on how to fix this error?

Question #2

I've also tried using a combination of mysql_init, mysql_bind and mssql_execute, but this always fails on the assignment of a null varchar input parameters:

$parm1=1295
$parm2 = null; <==setting this to anything else has the same effect

$stmt=mssql_init("myprocedure",$conn);
mssql_bind($stmt, "@parm1", $parm1, SQLINT4); <== this is ok
mssql_bind($stmt, "@parm2", $parm2, SQLVARCHAR, false,true);< fails here

and returns this error:
Warning: mssql_bind(): Unable to set parameter

and never gets to the following statement.

$result = mssql_execute($stmt);


Any ideas on how to get this null input parameter to bind correctly?

Thanks,
Bruce











Archive powered by MHonArc 2.6.24.

Top of Page