Re: A more proper workaround for this Perl DBD::ODBC workaround ....

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Chad Johnson wrote:
> 
> I perused the ODBC docs at:
> 
> http://msdn.microsoft.com/en-us/library/ms712631(VS.85).aspx
> 
> And the correct `Attribute` to pass into SQLSetStmtAttr is not jumping
> out at me to increase the size of the buffer for one parameter.  I
> make no claims to being an ODBC guru, but, from what I can discern
> these `Attributes` effect the entire statement (as the name of the
> function would imply) as opposed to just one parameter on the
> statement.  Am I missing something obvious?

It wasn't clear to me from your first message what it was you wanted to
do.  But, as one nonguru to another, I don't think you're missing
anything.  

Given a buffer, you can of course change the length at any time by
modifying the value of the SQLLEN pointed to by StrLen_or_IndPtr when you
called SQLBindParameter().  

As you found, you can change all the parameter buffers with
SQLSetStmtAttr() SQL_ATTR_PARAM_BIND_OFFSET_PTR.  A singularly odd
operation, I must say.  

To change part of one binding, you can tweak the descriptor with
SQLSetDescField():

	"The SQLSetDescRec function sets a variety of fields that affect the data
type and buffer bound to a column or parameter (the SQL_DESC_TYPE,
SQL_DESC_DATETIME_INTERVAL_CODE, SQL_DESC_OCTET_LENGTH,
SQL_DESC_PRECISION, SQL_DESC_SCALE, SQL_DESC_DATA_PTR,
SQL_DESC_OCTET_LENGTH_PTR, and SQL_DESC_INDICATOR_PTR fields). SQLBindCol
or SQLBindParameter can be used to make a complete specification for the
binding of a column or parameter. These functions set a specific group of
descriptor fields with one function call."

IOW, SQLBindParameter() is supposed to behave as a set of calls to
SQLSetDescRec(), and you should be able to modify any particular part of
what it did using SQLSetDescRec().  To change the bound data buffer, you
want SQL_DESC_DATA_PTR.  

I'm just an ODBC tourist; Frediano and others wrote the code.  I read the
documentation and write the occasional test or demonstration program to
improve the driver and my understanding.  I can't promise it works or is
even supposed to work as described.  I'm just pointing out what it seems
to say.  

HTH.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.