Firstly, Jarle, when you reply don't just reply to me but the whole list.  I
may not know the answer or may not have the time to answer you.  Secondly,
you should include the full conversation so that others know what's going
on.

My meaning was that you should print variable "strbuf" to the screen and let
us know what it is.  It is really hard to tell as we can not see the full
SQL statement.  All I can tell is that you may be missing a comma


Sinisa this is the error he was getting

> The following message apear:
> [jarle@biri2 jarle]$ ./test_mysql_image "essolog.gif"
> "/home/jarle/essolog.gif" "2"
> Error: You have an error in your SQL syntax near
> '/home/jarle/essolog.gif"GIF89a\\\0>\0Õ\0\0ó÷úÞYoþèì$a¢åíô7oª®ÅÜCw®Z­Ï
>

----- Original Message -----
From: "Sinisa Milivojevic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 27, 2001 21:29
Subject: Re: insert


> jarle rudihagen writes:
>  > Problems inserting: to fields: imageID and imageData.
>  >
>  > run: ./mainprogram "file" "full_file_path" "imageID"
>  >
>  > Her is my code:
>  >
>  >  try {
>  >
>  >
con.real_connect(MY_DATABASE,MY_HOST,MY_USER,MY_PASSWORD,3306,(int)0,60,NULL
);
>  >     Query query = con.query();
>  >     ostrstream strbuf;
>  >     ifstream In(argv[1], ios::in | ios::binary);
>  >     struct stat for_len;
>  >     if (In.rdbuf()->is_open())
>  >     {
>  >       if (stat(argv[1], &for_len)==-1)
>  >          return -1;
>  >       unsigned int blen = for_len.st_size;
>  >       if (!blen)
>  >          return -1;
>  >       char *read_buffer = new char[blen];
>  >       In.read(read_buffer,blen);
>  >       string fill(read_buffer,blen);
>  >       strbuf << "INSERT INTO " << MY_TABLE << "values(" << argv[2] <<
>  > ",\""<<escape<<fill<<"\")";
>  >       query.exec(strbuf.str());
>  >       //strbuf2 << "update" << MY_TABLE << "set image_id=2";
>  >       //query.exec(strbuf2.str());
>  >       delete[] read_buffer;
>  >     }
>  >     else
>  >     {
>  >     cerr << "Your binary file " << argv[1] << "can not open, errno = "
>  >           << errno;
>  >     }
>  > return 0;
>  >
>  >   }catch (BadQuery er)
>  >    {
>  >     cerr << "Error: " << er.error << " " << con.errnum() << endl;
>  >     return -1;
>  >    }
>  >
>  >
>  > Any help here?
>  >
>  > /jarle
>  >
>
>
> Hi!
>
> The above program is actually my load_file.cc , that is very little
> changed.
>
> What error message do you get ??
>
>
> Regards,
>
> Sinisa
>
>       ____  __     _____   _____  ___     ==  MySQL AB
>      /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
>     /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
>    /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
>   /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
>   ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
>              /*/             \*\                Developers Team
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to