473,473 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Fetching PDO Large Data Object

I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>

Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');

$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

var_dump($coverSteam);
Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)
Jun 2 '08 #1
7 2402
Fe**********@gmail.com wrote:
I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>

Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');

$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

var_dump($coverSteam);
Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)
Where does $coverStream come from? The first time you use it here is on
the var_dump() call.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #2
On May 7, 3:15 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
FeelLikeA...@gmail.com wrote:
I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>
Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');
$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
var_dump($coverSteam);
Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)

Where does $coverStream come from? The first time you use it here is on
the var_dump() call.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Sorry. It was a mistake in the post. Shoulda been $avatarSteam.
Jun 2 '08 #3
On May 7, 3:15 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
FeelLikeA...@gmail.com wrote:
I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>
Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');
$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
var_dump($coverSteam);
Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)

Where does $coverStream come from? The first time you use it here is on
the var_dump() call.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Sorry. That was a mistake in the post. It should be $avatarSteam.
Jun 2 '08 #4
On Wed, 07 May 2008 20:43:45 +0200, <Fe**********@gmail.comwrote:
I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>

Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');

$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

var_dump($coverSteam);

Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)
I'll see if I can reproduce this tomorrow, in the mean while: a big report
that isn't yet solved seems to be filed:
http://bugs.php.net/bug.php?id=40913
--
Rik Wasmus
Jun 2 '08 #5
On Thu, 08 May 2008 03:26:24 +0200, Rik Wasmus
<lu************@hotmail.comwrote:
On Wed, 07 May 2008 20:43:45 +0200, <Fe**********@gmail.comwrote:
>I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>

Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');

$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

var_dump($coverSteam);

Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)

I'll see if I can reproduce this tomorrow, in the mean while: a big
report that isn't yet solved seems to be filed:
http://bugs.php.net/bug.php?id=40913
s/big/bug/

It's late.....
--
Rik Wasmus
Jun 2 '08 #6
Rik Wasmus wrote:
On Thu, 08 May 2008 03:26:24 +0200, Rik Wasmus
<lu************@hotmail.comwrote:
>On Wed, 07 May 2008 20:43:45 +0200, <Fe**********@gmail.comwrote:
>>I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>

Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');

$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

var_dump($coverSteam);

Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)

I'll see if I can reproduce this tomorrow, in the mean while: a big
report that isn't yet solved seems to be filed:
http://bugs.php.net/bug.php?id=40913

s/big/bug/

It's late.....
Hmmm, over a year old and just assigned? Doesn't seem to be a very high
priority with them. Or maybe it's really tough to fix.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #7
On Thu, 08 May 2008 14:52:56 +0200, Jerry Stuckle
<js*******@attglobal.netwrote:
Rik Wasmus wrote:
>On Thu, 08 May 2008 03:26:24 +0200, Rik Wasmus
<lu************@hotmail.comwrote:
>>On Wed, 07 May 2008 20:43:45 +0200, <Fe**********@gmail.comwrote:

I'm using the example on the following page for selecting and fetching
a large data object. <http://publib.boulder.ibm.com/infocenter/db2luw/
v9/index.jsp?topic=/com.ibm.db2.udb.apdv.php.doc/doc/t0023504.htm>

Here's what I've tried:
$avatarFile = tempnam('', '');
$avatarSteam = fopen($avatarFile, 'wb');

$stmt = $dbh->prepare('SELECT user_avatar FROM users WHERE user_id =
29');
$stmt->execute();
$stmt->bindColumn('user_avatar', $avatarSteam, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

var_dump($coverSteam);

Ideally, $coverSteam should be a stream to a temporary file containing
the large data, but instead it's coming out as a string. And holding
the large data as a string in memory is exactly what I'm trying to
avoid. What am I doing wrong and how do I fix it? (I'm using SQLite,
in case it matters.)

I'll see if I can reproduce this tomorrow, in the mean while: a big
report that isn't yet solved seems to be filed:
http://bugs.php.net/bug.php?id=40913
s/big/bug/
It's late.....

Hmmm, over a year old and just assigned? Doesn't seem to be a very high
priority with them. Or maybe it's really tough to fix.
Indeed. Just verified it here, it still doesn't work in 5.2.4. A shame, I
was just going to use it in a project next week... It seems almost every
PDO driver has had this issue, however, for MySQL it's not fixed.

Perhaps the OP can abuse INTO DUMPFILE in MySQL if both webserver &
database are on the same machine.
--
Rik Wasmus
Jun 2 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: yatharth | last post by:
Hi Mike I have Datagrid and i am fetching data around about 1 million into it , i think which is not good deal this makes my system slow.Please tell the way so that i can fetch data in my...
5
by: Louis LeBlanc | last post by:
Hey folks. I'm new to the list, and not quite what you'd call a DB Guru, so please be patient with me. I'm afraid the lead up here is a bit verbose . . . I am working on an application that...
1
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start...
1
by: nasirmajor | last post by:
Dear All, im fetching record from database using datareader, and is displaying them in the textboxes. when user change the text fields and then presses the update button the record should be...
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
0
by: Bhavesh | last post by:
Hello genious people, I m trying to insert a LARGE text from Multiline Textbox into my table of sqlserver2000. I m using vs-2005. Please note that I dont want to store blob data From FILE TO...
5
by: Bhavesh | last post by:
Hello genious people, I m trying to insert a LARGE text from Multiline Textbox into my table of sqlserver2000. I m using vs-2005. Please note that I dont want to store blob data From FILE...
1
by: Bhavesh | last post by:
Hi Bruce, Thanks For Reply. U were right, Needed to pass string , but also need to pass size of Data( instead of 16, passed actual length of data). So that worked for me & didn't get any...
2
by: SunshineInTheRain | last post by:
I'm trying to modify a long long code within a button click by make the insert/update/delete/select using the same transaction. Purpose is to make sure every operation can be rollback instead of some...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.