Re: [Fwd: Re: [PHP-DB] how to update a text BLOB in ODBC?]

2002-11-22 Thread Nick Gorham
Jeff Stern wrote:


it turns out it is probably a bug -- firebird does not have this 
behavior, but interbase does. they do not think it is an easysoft issue. 
they think if we juse use firebird here we will be fine.

but we cannot risk switching to firebird, here. my IP dept would never 
go for it.  maybe an upgrade to ib 7 would fix it, i don't know.. i am 
still looking further into it. anyone have any contacts at interbase?

I don't know anything about BLOBs under ODBC, but I could help you with
direct Interbase connectivity, which I use extensively (but not for text
fields - it makes it difficult and slow to search).
Let me know if you need help with direct connection BLOB handling under
Interbase. I am using Firebird, not that it should make any difference.



Just to sum up the problem, Interbase 6 and 6.5 (not sure about 7, I 
will check) does not allow you to do a literal insert into a blob, ie

insert into blob_table ( blob_column ) values( 'hello' );

The only way it can be done, is via a bound parameter, that allows the 
ODBC driver, to catch the fact its a blob, and to use the correct 
methods to create and insert the blob.

I only discovered that firebird supported this, when I was about to 
demonstrate to someone here, how the problem happened, and to my 
suprise, it didn't.

The only other way I could suggest would involve adding support in 
php_odbc for binding parameters, that wouldn't be that difficult, but as 
the last few changes I did to php_odbc have either been backed out or 
altered to fit different drivers, I don't know what the developers want 
to do.

---
Nick Gorham
Easysoft Limited


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



[Fwd: Re: [PHP-DB] how to update a text BLOB in ODBC?]

2002-11-20 Thread Jeff Stern


hi, david, thanks for responding..

David Russell wrote:


Hi Jeff,

Just a question - why are you using ODBC instead of PHP's native
Interbase connectivity? ODBC is definitely slower.


good question.. i think it pretty much boils down to the following reasons:

1) my IP dept has voiced the possibility of switching away from IB at 
some point because of the lack of support and common user base. i want 
the php code to use unified drivers so that i don't have to re-write 
everything at that time.

2) the php-ib api is not automatically compiled in to the php 
distribution which comes from redhat. while i'm not normally averse to a 
separate compile, it is extra effort, esp. in the case of php, where 
there are many compile-time flags to mimick correctly from the redhat 
compile. not getting these right could potentially give us even more 
problems down the road with more quirky "undocumented" behavior which is 
owed solely to my own compilation and a flag i didn't set right. i'd 
rather not get into it.

3) on linux (where our apache/php sits), the odbc drivers use the same 
shared libraries that odbc does (the odbc easysoft drivers) since as i 
understand it, in the later versions of ib, borland decided that the 
only way to connect to a remote ib server was with the unixodbc/easysoft 
drivers anyway, and removed the ib-specific connection libraries 
(something like that).

4) while much less important than the first 3, i do see a Unified ODBC 
interface as advantageous to us all. the various db api's are all 
different. thus, when i read books about PHP, and look in the sections 
on databasing, i see the MySQL api referred to. this doesn't do me any 
good because i'm an interbase user. if we all used the same api, odbc, 
then, even though it may be pie in the sky, we'd all -- authors, users, 
etc etc -- benefit from a common knowledge base, not to mention a robust 
and dependable api.

5) i wanted something simple: read a blob into a string (currently 
works) in a select statement, and write the BLOB back out from a string 
via update (currently does not work with ib but apparently does with 
firebird and others). the php-odbc api promises this ease of use, and 
the php-ib api does not. :(

this just in:

the easysoft guys wrote back to me btw, just today.

it turns out it is probably a bug -- firebird does not have this 
behavior, but interbase does. they do not think it is an easysoft issue. 
they think if we juse use firebird here we will be fine.

but we cannot risk switching to firebird, here. my IP dept would never 
go for it.  maybe an upgrade to ib 7 would fix it, i don't know.. i am 
still looking further into it. anyone have any contacts at interbase?

I don't know anything about BLOBs under ODBC, but I could help you with
direct Interbase connectivity, which I use extensively (but not for text
fields - it makes it difficult and slow to search). 

Let me know if you need help with direct connection BLOB handling under
Interbase. I am using Firebird, not that it should make any difference.


thank you for the offer. i will take you up on it if i do in fact end up 
going the php-ib api route, or in the unprobably event we switch to 
firebird (which the easysoft guys say works right with php-odbc api 
anyway).. i do appreciate your taking the time out of your day to 
respond, david. that was kind of you, and thank you very much.

--
 Jeff Stern 949-824-2326 [EMAIL PROTECTED]
 Social Sciences Computing Services
 University of California, Irvine
 3151 Social Science Plz
 Irvine CA 92697-5100





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



RE: [PHP-DB] how to update a text BLOB in ODBC?

2002-11-19 Thread David Russell
Hi Jeff,

Just a question - why are you using ODBC instead of PHP's native
Interbase connectivity? ODBC is definitely slower.

I don't know anything about BLOBs under ODBC, but I could help you with
direct Interbase connectivity, which I use extensively (but not for text
fields - it makes it difficult and slow to search). 

Let me know if you need help with direct connection BLOB handling under
Interbase. I am using Firebird, not that it should make any difference.

HTH

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com

-Original Message-
From: Jeff Stern [mailto:[EMAIL PROTECTED]] 
Sent: 20 November 2002 08:24 AM
To: Miles Thompson; Martin Allan Jensen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] how to update a text BLOB in ODBC?


thanks for the correction, miles and martin.. just an email typo.

i still have the problem though. :(

--
  Jeff Stern 949-824-2326 [EMAIL PROTECTED]
  Social Sciences Computing Services
  University of California, Irvine
  3151 Social Science Plz
  Irvine CA 92697-5100

On Tue, 19 Nov 2002, Miles Thompson wrote:

> Jeff,
>
> Check your SQL. Shouldn't
> $sql = "insert into note_tbl
> (note) values ('${note}')
> where pkey = '45'";
>
> be UPDATE  where pkey = '45' ?


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




smime.p7s
Description: application/pkcs7-signature


Re: [PHP-DB] how to update a text BLOB in ODBC?

2002-11-19 Thread Ryan Gallagher
Quoting Jeff Stern <[EMAIL PROTECTED]>:

> thanks for the correction, miles and martin.. just an email typo.
> 
> i still have the problem though. :(
> 
> 
> On Tue, 19 Nov 2002, Miles Thompson wrote:
> 
> > Jeff,
> >
> > Check your SQL. Shouldn't
> > $sql = "insert into note_tbl
> > (note) values ('${note}')
> > where pkey = '45'";
> >
> > be UPDATE  where pkey = '45' ?

With MSSQL the blobs (text/image) can be handled with READ_IMAGE/READ_TEXT and
WRITE_IMAGE/WRITE_TEXT.  This writes/reads from the paged resource directly,
bypassing the transaction log etc etc.  I don't know if your DB possibly has a
similiar method?

Aside: Insert and Update work normally as well... but are fully logged.

-- 
Ryan T. Gallagher
[EMAIL PROTECTED]
International Studies Abroad
http://www.studiesabroad.com
(512)480-8522



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




Re: [PHP-DB] how to update a text BLOB in ODBC?

2002-11-19 Thread Jeff Stern
thanks for the correction, miles and martin.. just an email typo.

i still have the problem though. :(

--
  Jeff Stern 949-824-2326 [EMAIL PROTECTED]
  Social Sciences Computing Services
  University of California, Irvine
  3151 Social Science Plz
  Irvine CA 92697-5100

On Tue, 19 Nov 2002, Miles Thompson wrote:

> Jeff,
>
> Check your SQL. Shouldn't
> $sql = "insert into note_tbl
> (note) values ('${note}')
> where pkey = '45'";
>
> be UPDATE  where pkey = '45' ?


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




Re: [PHP-DB] how to update a text BLOB in ODBC?

2002-11-19 Thread Miles Thompson
Jeff,

Check your SQL. Shouldn't
$sql = "insert into note_tbl
(note) values ('${note}')
where pkey = '45'";

be UPDATE  where pkey = '45' ?

Or, do a delete where pkey = '45' followed by an insert. In that case check 
the synatx of your insert 'cause it doesn't look correct.

HTH - Miles Thompson


At 04:42 PM 11/19/2002 -0800, Jeff Stern wrote:
hi, i am having the devil of a time with this. have been researching it 
for 3 weeks. have posted to php.faqts.com (no answer), looked a million 
times on php.net, and www.borland.com/interbase, written people email (no 
response!) and even tried to get the people at easysoft to answer (they 
are working on it)..

but it's been 3 weeks now and i cannot seem to get this question answered, 
and our project is waiting..

the question simply is: how to write a BLOB (sub-typwith ODBC in PHP?

fyi, it shouldn't make a difference, but i am using interbase 6.0 as the 
back end, and the blob is SUB-TYPE 1 (text).

*reading* the blob is trivial with php Unified ODBC. I just use a normal 
SQL select statement:

==
$sql = "select note from note_tbl where pkey = '45'";

# get result
$result = @odbc_exec($conn, $sql);

# assign values
if ( @odbc_fetch_into($result, $row)) {
  $note = $row[0];
}
==

(where notes is the BLOB field). pretty simple.

however, when i try to *write* it back:
==
$sql = "insert into note_tbl
(note) values ('${note}')
where pkey = '45'";

$result = odbc_exec($conn, $sql);
==

i get an error message:

==
Invalid modify request. Conversion error from string "BLOB"
==

.. so apparently i cannot simply write the string back out to the BLOB.
(tho' IMHO if i can read in a SUB-TYPE 1 (text) BLOB that easily, then i 
should be able to write it back out that easily).

apparently this is not just at the PHP Unified ODBC level.. if i run 
easysoft's isql program at the command prompt and try to run the same 
commands, while i don't get as specific an error message, it does return 
an error:

==
SQL> update notes_tbl set note = 'hello there' where pkey = '16784'
[ISQL]ERROR: Could not SQLExecute
SQL> _
==

does anyone have some example code for how to do this (in PHP)?

i'd be most grateful..


--
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




[PHP-DB] how to update a text BLOB in ODBC?

2002-11-19 Thread Jeff Stern
hi, i am having the devil of a time with this. have been researching it 
for 3 weeks. have posted to php.faqts.com (no answer), looked a million 
times on php.net, and www.borland.com/interbase, written people email 
(no response!) and even tried to get the people at easysoft to answer 
(they are working on it)..

but it's been 3 weeks now and i cannot seem to get this question 
answered, and our project is waiting..

the question simply is: how to write a BLOB (sub-typwith ODBC in PHP?

fyi, it shouldn't make a difference, but i am using interbase 6.0 as the 
back end, and the blob is SUB-TYPE 1 (text).

*reading* the blob is trivial with php Unified ODBC. I just use a normal 
SQL select statement:

==
$sql = "select note from note_tbl where pkey = '45'";

# get result 

$result = @odbc_exec($conn, $sql);

# assign values 

if ( @odbc_fetch_into($result, $row)) {
  $note = $row[0];
}
==

(where notes is the BLOB field). pretty simple.

however, when i try to *write* it back:
==
$sql = "insert into note_tbl
(note) values ('${note}')
where pkey = '45'";

$result = odbc_exec($conn, $sql);
==

i get an error message:

==
Invalid modify request. Conversion error from string "BLOB"
==

.. so apparently i cannot simply write the string back out to the BLOB.
(tho' IMHO if i can read in a SUB-TYPE 1 (text) BLOB that easily, then i 
should be able to write it back out that easily).

apparently this is not just at the PHP Unified ODBC level.. if i run 
easysoft's isql program at the command prompt and try to run the same 
commands, while i don't get as specific an error message, it does return 
an error:

==
SQL> update notes_tbl set note = 'hello there' where pkey = '16784'
[ISQL]ERROR: Could not SQLExecute
SQL> _
==

does anyone have some example code for how to do this (in PHP)?

i'd be most grateful..


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