dbTalk Databases Forums  

What's that error in tutorial?!?

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss What's that error in tutorial?!? in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pps
 
Posts: n/a

Default What's that error in tutorial?!? - 09-17-2005 , 12:50 PM






html/tutorial.html:
===================
3.5. Exceptions

....

There are a few classes of exceptions MySQL++ can throw that are not
optional:

*

The largest set of non-optional exceptions are those from the
Standard C++ Library. For instance, if your code said "row[21]" on a row
containing only 5 fields, the std::vector underlying the row object will
throw an exception. (It will, that is, if it conforms to the standard.)
You might consider wrapping your program's main loop in a try block
catching std::exceptions, just in case you trigger one of these exceptions.
=====================


And this isn't true! operator[] doesn't have to check the size (if it
conforms to the standard). Hopefully the code in the library doesn't
rely on that. (method .at() exist for size checking)
please verify and update the docs in order not to confuse people

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Chris Frey
 
Posts: n/a

Default Re: What's that error in tutorial?!? - 09-17-2005 , 01:37 PM






On Sat, Sep 17, 2005 at 01:49:45PM -0400, pps wrote:
Quote:
The largest set of non-optional exceptions are those from the
Standard C++ Library. For instance, if your code said "row[21]" on a row
containing only 5 fields, the std::vector underlying the row object will
throw an exception. (It will, that is, if it conforms to the standard.)
You might consider wrapping your program's main loop in a try block
catching std::exceptions, just in case you trigger one of these exceptions.
=====================


And this isn't true! operator[] doesn't have to check the size (if it
conforms to the standard). Hopefully the code in the library doesn't
rely on that. (method .at() exist for size checking)
please verify and update the docs in order not to confuse people
The docs are correct, although misleading without a knowledge of the code.

mysql++'s row object calls std::vector's at() from inside its own
operator[], so the standard library will indeed throw an execption.

Only row::raw_data() uses std::vector:perator[].

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Warren Young
 
Posts: n/a

Default Re: What's that error in tutorial?!? - 09-19-2005 , 11:35 AM



Chris Frey wrote:
Quote:
So we could just add an operator[](int),
No, because row[0] would still ambiguous w.r.t. the char* overload.

Quote:
or add a template with some
specializations for const char* and char*.
I hold out hope for this method.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.