Working with MySQL database from C/C++

Working with MySQL database from C/C++

am 19.03.2007 14:37:56 von TreatmentPlant

Hi all,

I asked this over at alt.comp.lang.learn.c-c++ and
alt.comp.databases.mysql and didn't get the response I was hoping, so I
hope someone here might be able to help?

Can someone please point me in the right direction to use C/C++ to
update a mySQL database table on localhost.

I have annoyed Google enough in the last few days, but have not turned
up anything useful at my newbie level.

I would really appreciate a guide/tutor/mentor/sample code/decent
weblink for this task: all I need to do is add a record to an existing
table. It sounds simple enough, except that I have no idea how! Any
help is appreciated.

{I need some method to open the database, then}

INSERT INTO myTable(field1, field2, field3) VALUES(value1, value2, value3)

{then, some method to close the connection}

I am new to this databases game, so simplicity would be the order of the
day, please. :)

Re: Working with MySQL database from C/C++

am 19.03.2007 14:42:58 von Florian Laws

On 2007-03-19, TreatmentPlant wrote:
> Hi all,
>
> I asked this over at alt.comp.lang.learn.c-c++ and
> alt.comp.databases.mysql and didn't get the response I was hoping, so I
> hope someone here might be able to help?
>
> Can someone please point me in the right direction to use C/C++ to
> update a mySQL database table on localhost.

Did you see http://tangentsoft.net/mysql++/doc/userman/html/ ?

Bye,

Florian

Re: Working with MySQL database from C/C++

am 19.03.2007 14:58:57 von TreatmentPlant

Florian Laws wrote:
> On 2007-03-19, TreatmentPlant wrote:
>> Hi all,
>>
>> I asked this over at alt.comp.lang.learn.c-c++ and
>> alt.comp.databases.mysql and didn't get the response I was hoping, so I
>> hope someone here might be able to help?
>>
>> Can someone please point me in the right direction to use C/C++ to
>> update a mySQL database table on localhost.
>
> Did you see http://tangentsoft.net/mysql++/doc/userman/html/ ?
>
> Bye,
>
> Florian

Dear Florian,

No I didn't, so thanks for pointing out mySQL++ for me; it might get me
closer to my destination.

All I have to do now is deal with, "mysql++-1.7.1-win32-vc++.zip (786
KB, 2000.05.01) — Ancient version for Visual C++ 6.0. Use this only if
you absolutely, positively cannot upgrade to Visual C++ 2003 or newer.
It is known to have bugs, and there is almost no chance they will ever
be fixed. The path forward is to switch to a newer compiler; see below
for information on obtaining a free version of Visual C++ 2005!"

My boss (for whatever reason) will NOT upgrade from VC++ 6.0?


Have a good day.

Re: Working with MySQL database from C/C++

am 19.03.2007 15:05:09 von Florian Laws

On 2007-03-19, TreatmentPlant wrote:
> Florian Laws wrote:
>> On 2007-03-19, TreatmentPlant wrote:
>>> Hi all,
>>>
>>> I asked this over at alt.comp.lang.learn.c-c++ and
>>> alt.comp.databases.mysql and didn't get the response I was hoping, so I
>>> hope someone here might be able to help?
>>>
>>> Can someone please point me in the right direction to use C/C++ to
>>> update a mySQL database table on localhost.
>>
>> Did you see http://tangentsoft.net/mysql++/doc/userman/html/ ?
>
> No I didn't, so thanks for pointing out mySQL++ for me; it might get me
> closer to my destination.
>
> All I have to do now is deal with, "mysql++-1.7.1-win32-vc++.zip (786
> KB, 2000.05.01) — Ancient version for Visual C++ 6.0. Use this only if
> you absolutely, positively cannot upgrade to Visual C++ 2003 or newer.
> It is known to have bugs, and there is almost no chance they will ever
> be fixed. The path forward is to switch to a newer compiler; see below
> for information on obtaining a free version of Visual C++ 2005!"
>
> My boss (for whatever reason) will NOT upgrade from VC++ 6.0?

You can also try the official MySQL C client library:
http://dev.mysql.com/doc/refman/5.0/en/c.html

Bye,

Florian

Re: Working with MySQL database from C/C++

am 19.03.2007 16:03:51 von Axel Schwenke

TreatmentPlant wrote:
>
> I asked this over at alt.comp.lang.learn.c-c++ and
> alt.comp.databases.mysql and didn't get the response I was hoping, so I
> hope someone here might be able to help?

Please try comp.databases.mysql as well.

> Can someone please point me in the right direction to use C/C++ to
> update a mySQL database table on localhost.
>
> I would really appreciate a guide/tutor/mentor/sample code/decent
> weblink for this task: all I need to do is add a record to an existing
> table. It sounds simple enough, except that I have no idea how! Any
> help is appreciated.

Why not start with the manual? I find
http://dev.mysql.com/doc/refman/5.0/en/c.html

quite instructive. It contains a lot of example code as well.


XL