Problem when using SQL_CUR_USE_ODBC on connect

Problem when using SQL_CUR_USE_ODBC on connect

am 31.03.2008 22:27:20 von cfs

I'm using PHP with Apache. PHP code connects to MS SQL server using ODBC.

I'm doing a query against a table that is very simple: one column of the
real data type, one of the text data type.

The text field is set to "testing 1,2,3". The real column is set to
10.0199995.

When I use the default connect options, I get both values back fine.

When I use SQL_CUR_USE_ODBC, which I very much want to use, then the text
column data comes back as boolean(false).

Does anyone know of a solution?

Table:

CREATE TABLE [dbo].[test1](
[ID] [int] IDENTITY(1,1) NOT NULL,

[real1] [real] NULL,

[text1] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

CONSTRAINT [PK_test1] PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

Code:

$conn = odbc_connect(db-name, user-name,password, SQL_CUR_USE_ODBC);
$result = odbc_exec($conn, "select * from test1");
if (odbc_fetch_row($result)) {
print "Values: " . odbc_result($result,"real1") . "," .
odbc_result($result,"text1");
}
?>





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem when using SQL_CUR_USE_ODBC on connect

am 01.04.2008 20:00:41 von jonllmsed

------=_Part_14312_29687493.1207072841369
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

(This isn't a solution, per se...just a suggestion.)

I don't know how they compare; I've never personally used the ODBC
functions...

But, you may give the MSSQL functions a try:
http://php.net/mssql

- Jon L.

On Mon, Mar 31, 2008 at 3:27 PM, cfs wrote:

> I'm using PHP with Apache. PHP code connects to MS SQL server using ODBC.
>
> I'm doing a query against a table that is very simple: one column of the
> real data type, one of the text data type.
>
> The text field is set to "testing 1,2,3". The real column is set to
> 10.0199995.
>
> When I use the default connect options, I get both values back fine.
>
> When I use SQL_CUR_USE_ODBC, which I very much want to use, then the text
> column data comes back as boolean(false).
>
> Does anyone know of a solution?
>
> Table:
>
> CREATE TABLE [dbo].[test1](
> [ID] [int] IDENTITY(1,1) NOT NULL,
>
> [real1] [real] NULL,
>
> [text1] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
>
> CONSTRAINT [PK_test1] PRIMARY KEY CLUSTERED
>
> (
>
> [ID] ASC
>
> )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
>
> ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
>
> Code:
>
> > $conn = odbc_connect(db-name, user-name,password, SQL_CUR_USE_ODBC);
> $result = odbc_exec($conn, "select * from test1");
> if (odbc_fetch_row($result)) {
> print "Values: " . odbc_result($result,"real1") . "," .
> odbc_result($result,"text1");
> }
> ?>
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

------=_Part_14312_29687493.1207072841369--

Re: Problem when using SQL_CUR_USE_ODBC on connect

am 02.04.2008 17:49:24 von cfs

The mssql driver uses a dll that has a limitation on varchar fields of 255
characters. And the 30 chracter column name limit. And after SQL 2005, may
not be supported at all.

So that alt has been tried, and then adandoned.

""Jon L."" wrote in message
news:5ad2dbbf0804011100l49d19e97x76f849c2e7119726@mail.gmail .com...
> (This isn't a solution, per se...just a suggestion.)
>
> I don't know how they compare; I've never personally used the ODBC
> functions...
>
> But, you may give the MSSQL functions a try:
> http://php.net/mssql
>
> - Jon L.
>
> On Mon, Mar 31, 2008 at 3:27 PM, cfs wrote:
>
>> I'm using PHP with Apache. PHP code connects to MS SQL server using ODBC.
>>
>> I'm doing a query against a table that is very simple: one column of the
>> real data type, one of the text data type.
>>
>> The text field is set to "testing 1,2,3". The real column is set to
>> 10.0199995.
>>
>> When I use the default connect options, I get both values back fine.
>>
>> When I use SQL_CUR_USE_ODBC, which I very much want to use, then the
>> text
>> column data comes back as boolean(false).
>>
>> Does anyone know of a solution?
>>
>> Table:
>>
>> CREATE TABLE [dbo].[test1](
>> [ID] [int] IDENTITY(1,1) NOT NULL,
>>
>> [real1] [real] NULL,
>>
>> [text1] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
>>
>> CONSTRAINT [PK_test1] PRIMARY KEY CLUSTERED
>>
>> (
>>
>> [ID] ASC
>>
>> )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
>>
>> ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
>>
>> Code:
>>
>> >> $conn = odbc_connect(db-name, user-name,password, SQL_CUR_USE_ODBC);
>> $result = odbc_exec($conn, "select * from test1");
>> if (odbc_fetch_row($result)) {
>> print "Values: " . odbc_result($result,"real1") . "," .
>> odbc_result($result,"text1");
>> }
>> ?>
>>
>>
>>
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php