The best book for c programming I found is the O'Reilly book, "MySQL & mSQL"
.  It has a good example of using the C API and even builds some simple C++
classes.

The book, "MySQL" by Paul DuBois is the best overall MySQL book I found.
Plus, Paul is a regular responder to this list, so I would buy his book,
too.

As far as creating tables (or just about anything else) the thing to
remember that about all the C API does is pass the command you want to the
SQL interpreter and then execute your command.

So, if you want to create a table, you would pass a CREATE statement into
mysql_query (or mysql_real_query) EXACTLY like you would have entered it
into the mysql client.

These is lots is some contributed software out there for the C/C++ API, but
they all have problems when it comes to inserting and updating records.  The
issues is in understanding exactly how MySQL returns stuff in the result
set.

I have attached some C++ classes (and a test program) to this document that
should get you started.  They deal with the type saftey issue, updating
different data types and different size strings, etc.

You will also need to go to boost.org and get some code to install something
called lexical_cast, too.


Zip file removed to post to list.  Email me if you want the classes



Hello MySQL employees - 

If you want to post this zip file on your contributed software section, you
have my permission to do so.  These would have saved me months of effort and
I know someone else can use them, too.


        > "Have A Great Scouting Day"
        > Ken Hylton
        > 7826 Falcon Ridge Drive
        > San Antonio, Texas 78239-4032
        > 210-646-9508 (home)
        > 210-949-7261 (work)
        > 210-949-7254 (fax)
        > 210-287-6756 (cell)
        > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
        > [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 


                -----Original Message-----
                From:   [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
[mailto:[EMAIL PROTECTED]] <mailto:[mailto:[EMAIL PROTECTED]]> 
                Sent:   Tuesday, March 05, 2002 9:01 AM
                To:     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

                Subject:        how can I use 'C' programs accessing a MySql

                The following form was submitted via MySQL.com feedback
engine: 
                  Name: Alexandre Adam
                  E-mail address: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
                  Company: sansoft informatica
                  Position/Title: user
                  Type of interest: for personal use
                  State or province: SP
                  Country: Brazil
                  Support contract: no

                  Enter Your Questions, Comments, Feedback or Your Message
here:

                    
                    I'm trying to understand how can I use 'C' programs
accessing a MySql
                    
                    DataBase, please, could you send me a small program or
so that creates
                    a 
                    Table or two and make some changes on them. 
                    I read so many examples but all of them only contain
parts of the
                    code.
                    please... help...what library I must include... 
                    
                    Sincerely
                    Alexandre Adam
                    Sao Paulo - SP - BRAZIL
                    
                    I wrote some code but nothing works... please read it
below.
                    
                    #include </usr/include/mysql/mysql.h>
                    # include <stream.h>
                    
                    int main () {  
                            { Printf ("Initializing...\n"); }
                            if (mysql_create_db (&mysql, "DB_TEST")) {
                                    fprintf (stderr, "Failed to create
DataBase, ERR!"
                    %x\n", mysql_error( 
                    &mysql));
                            }
                    return 0;
                    }
                   

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

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