RE: sql_create_basic_N questions

2001-04-20 Thread Sinisa Milivojevic

Steve Newell writes:
 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


Yes, I am afraid that VC++ can not chew up any of the above macros.

We shall investigate it further.


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




Re: sql_create_basic_N questions

2001-04-19 Thread Sinisa Milivojevic

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.
  
 
 StoryBodysb;
  
 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




sql_create_basic_N questions

2001-04-18 Thread Steve Newell

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.
 

StoryBodysb;
 
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