Entry
Why does php3.exe crash when calling odbc_do with no errors logged or explanation when I try to query a SQL Server 7.0 database?
How can i search for a pattern , the data stored in a image datatype, i used to store long text data
Feb 7th, 2008 21:14
dman, Deepak Bansal, Ian Smith, Rachit Bagda, Jeff Connolly, Nathan Wallace, Manish Kaushik, http://sturly.com
When querying SQL Server if the table you query has either of these
two blob fields: Image or ntext, odbc_do will quit without giving any
error or explanation. This will crash php as well. I don't know of a
solution to this problem other than avoiding using the Image or ntext
objects. When using the mssql_query function to retrieve an image
field, php throws an exception and then shuts down. When using the
mssql_query function to return an ntext field, SQL Server 7.0 denies
the
request and returns an error message to php.
You can duplicate the error by using an odbc connection to SQL Server
7.0 and querying the provided Northwind database Employee table for the
fields Picture or Notes. Or by using the mssql_query function to do
the
same.
=====================================================
In fact, a better solution than avoiding the fields is to issue the
following SQL command before performing your query:
SET TEXTSIZE nnnnnnnn
where nnnnnnnn is the maximum size you think you will require.
I was having a problem retrieving LONG fields thru SQL Server where it
would just crash and this solved the problem.
I had an ntext field which I couldn't just avoid using and i was able
to set the textsize to 800,000 and retrieve all my very long text
fields.
I can't say whether or not this will work for image blobs but it
definitely works for ntext.
Jeff Connolly
jeff@k-linx.com
=====================================================
Searching for patterns is generally performed by using wildcards
surrounding whatever pattern you are looking for. In ANSI SQL, _ is a
single character wildcard and % is a wildcard of unknown length. The
filesystem equivalents are ? and * respectively.
More information than that will probably require more information in
the
question :)
Ian Smith