OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: how to insert blob data remotely.. SOLVED :)

From: Héctor Maldonado (hmmtci.net.pe)
Date: Thu Jul 01 2004 - 11:14:15 CDT


Hi Again..

Fortunately I found a way to do this using C++/Qt. Here's the code for
who are interested in:

QFile *myFile;
QSqlQuery query;
QString strQuery;
QByteArray myByteArray;
    
// open the image and fill the bytearray
myFile = new
        QFile("/root/hm/variostepsa/fotos_marcopolo/paradiso1.jpg");
myFile->open(IO_ReadOnly);
myByteArray = myFile->readAll();
myFile->close();
    
// Insert the image
strQuery = "INSERT INTO Model (Brand, Picture) VALUES ('Subaru', :pic)";
    
    query.prepare(strQuery);
    query.bindValue(":pic", myByteArray);
    
    if (!query.exec())
        qWarning("Errrrrrrrorrr");

I don't know if this is optimal, but it works.. :)

Thanks to all those reply..

Regards,

Hector.

El jue, 01-07-2004 a las 20:32, Peter L. Berghold escribió:
> On Thu, 2004-07-01 at 11:06, Héctor Maldonado wrote:
> > But LOAD_FILE only works if 'picture.jpg' is placed on the same machine
> > where the server is running.
> >
>
> That makes sense. You could of course NFS mount from the remote machine
> to the machine you are working from but that is much the same thing.
>
> Alternatively if you are working in a language like Perl there are other
> tricks you can play...

--
Ing. Héctor Maldonado Melgar
Dpto. Desarrollo de Software
TCI S.A., Lima-Perú
hmmtci.net.pe
Of.: 421-3222
Cel: 9503-9205

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql