I tried using the sql_create_N macros, but my compiler crashes with an
"INTERNAL COMPILER ERROR".  I'm using VC++ 6.0 sp5.  I spent several days
trying to work around that and finally went back to the sql_create_basic_N.

Steve

-----Original Message-----
From: Sinisa Milivojevic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 5:35 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: sql_create_basic_N questions


Steve Newell writes:
> NOTE: I have cross-posted this to the plusplus mailing list as well.
>  
>  
> I am using sql_create_basic_N to generate structures that mirror my
database
> tables.  The problem I have is that some of the fields in my database are
> "blobs" that need to be escaped before insertion.
>  
> Questions:
>  
> 1. I am using a string to represent the data in the structure:
> 
> sql_create_basic_2(StoryBody, 0, 0,
>        INT32, StoryID,
>        string, Body);    // this is actually a blob
> 
> Is there a better data structure for this?
>  
> 2. The data that I am trying to store has nulls scattered throughout.
When
> I create the insert string using the following code, it only puts in the
> data up to the first null.  That's a side effect of the string, so I have
> tried escaping the string before I create the insert statement.  That
> doesn't seem to work either.  Apparently, MySql is ignoring the escaped
> characters.
>  
> 
> StoryBody    sb;
>  
> sb.StoryID = -1;
> string tmpS(blobSize, blob);
> sb.Body = tmpS;
>  
> escape_string(sb.Body);
>  
>  Query q = m_dbconn->query();
>  stringstream strbuf; 
>  
>  try {
>   string tmpQS = "INSERT INTO STORYBODY (Body) VALUES('";
>  
>       strbuf << "INSERT INTO STORYBODY (Body) VALUES(" << quote <<
sb.Body
> << ")";
>       q.exec(strbuf.str());
> } catch(BadQuery e) {
>     // handle error here
> }
> 
> Any help would be greatly appreciated.
>  
> Thanks,
>  
> Steve

Hi!

No you should use sql_create_3. 

Please take a look at custum1.cc and custom3.cc examples.


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

Reply via email to