473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help transfer ring blobs using perl

i am using postgres 7.0.3
and also postgres 7.2.1

I am new towards using blobs,I want to transfers
records with blobs from a table to different
database(postgres) using
perl without extracting the blob to disk(i.e without
using lo_export/lo_import).

Below is my perl script which is not working can
anybody help in this.
$rest = $conn->exec("begin");
$stmt="select * from image ;";
$result = $conn->exec($stmt);
if ( $result->resultStatus ne PGRES_TUPLES_OK )
{
die $conn->errorMessage unless PGRES_TUPLES_OK eq
$result->resultStatus;
}
$n=$result->ntuples;
print "\n Number of Processes Scheduled $n \n";

while ( @row=$result->fetchrow)
{
$fld=$row[0];
$fd=Pg::lo_open($conn,$fld,"r");
if ( $fd )
{
$buf="";
Pg::lo_read($conn,$fd,$buf,20000);
}
Pg::lo_close($conn,$fd);

$foid=Pg::lo_creat($conn,"w");
$fdw=Pg::lo_open($conn,$foid,"w");
Pg::lo_write($conn,$fdw,$buf,20000);
Pg::lo_close($conn,$foid);
$stmt="insert into photo values($foid)";
$resi = $conn->exec($stmt);

if ( $resi->resultStatus ne PGRES_COMMAND_OK )
{
die $conn->errorMessage unless PGRES_TUPLES_OK eq
$resi->resultStatus;
}

}

$rest = $conn->exec("end");


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #1
0 1230

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

Similar topics

3
by: FLOTServer | last post by:
Here's my problem: I run a gameserver that runs the game "Medal of Honor". On the game server is log file which contains all of the data from the players for that day (kills, deaths, etc...). I...
0
by: Ole Hansen | last post by:
Hi, Is it at all possible to insert BLOBs using the Array Interface? Today I have an application using the array interface. It works fine but so far I haven't been using BLOBs. I insert...
2
by: Beyonder | last post by:
I have five tables in my database, there are actually NO common fields between them, not even a KEY or ID or anything like that, except for the "body" of a blob field. and that text is not...
1
by: picaza | last post by:
hi, does anyone have a perl example of loading blobs from either a bin file or an input stream? much thanks, peter
7
by: Howard Lowndes | last post by:
My situation is that I am interacting PHP 4.1.2 to PostgreSQL 7.2.2 I have no difficulty inserting and managing BLOBs into the Large Object system table, and I have a user table called images...
0
by: Bing | last post by:
Hi there, I am using the DB2 universal JDBC driver type 4 to insert BLOBs into a DB2 database. The Method I used for supplying the BLOB data value is setBinaryStream(). Everything works fine as...
27
by: SK | last post by:
Hi I am trying to teach myself how to program in C. I am a physician hoping to be able to help restructure my office. Anyhow, I amhoping that the porblem I am having is simple to those much more...
17
by: Yuri CHUANG | last post by:
Hi, I'm the beginner of the CPL.I write a program about the problem of Ring of Josephus,using DoubleLinkList data structure. I'm very confused that I think there is really no error in my...
1
by: raghavshastri | last post by:
You are to write a C++ program to perform a statistical analysis of the blobs in an image. The image will be a grayscale image in PGM format for simplicity. Here is a sample PGM image with 10...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.