MySQL++ v3.1.0 User Manual
Kevin Atkinson
Sinisa Milivojevic
Monty Widenius
Warren Young
Copyright © 1998-2001, 2005-2010 Kevin Atkinson (original author)MySQL ABEducational Technology
Resources
June 03, 2010
Table of Contents
1. Introduction .................................................................................................................................... 3
1.1. A Brief History of MySQL++ .................................................................................................. 3
1.2. If You Have Questions... .......................................................................................................... 4
2. Overview ........................................................................................................................................ 5
2.1. The Connection Object ........................................................................................................... 5
2.2. The Query Object .................................................................................................................. 5
2.3. Result Sets ........................................................................................................................... 5
2.4. Exceptions ............................................................................................................................ 7
3. Tutorial .......................................................................................................................................... 8
3.1. Running the Examples ............................................................................................................ 8
3.2. A Simple Example ................................................................................................................. 9
3.3. A More Complicated Example ................................................................................................ 10
3.4. Exceptions .......................................................................................................................... 11
3.5. Quoting and Escaping ........................................................................................................... 12
3.6. C++ vs. SQL Data Types ....................................................................................................... 13
3.7. Handling SQL Nulls ............................................................................................................. 15
3.8. MySQL++’s Special String Types ........................................................................................... 16
3.9. Dealing with Binary Data ...................................................................................................... 17
3.10. Using Transactions ............................................................................................................. 21
3.11. Which Query Type to Use? ................................................................................................... 25
3.12. Conditional Result Row Handling .......................................................................................... 26
3.13. Executing Code for Each Row In a Result Set .......................................................................... 28
3.14. Connection Options ............................................................................................................ 30
3.15. Dealing with Connection Timeouts ........................................................................................ 33
3.16. Concurrent Queries on a Connection ...................................................................................... 34
3.17. Getting Field Meta-Information ............................................................................................. 35
4. Template Queries ............................................................................................................................ 37
4.1. Setting up Template Queries ................................................................................................... 38
4.2. Setting the Parameters at Execution Time ................................................................................. 38
4.3. Default Parameters ............................................................................................................... 39
4.4. Error Handling .................................................................................................................... 40
5. Specialized SQL Structures .............................................................................................................. 41
5.1. sql_create ........................................................................................................................... 41
5.2. SSQLS Comparison and Initialization ...................................................................................... 42
5.3. Retrieving data .................................................................................................................... 43
5.4. Adding data ........................................................................................................................ 45
1