Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

character set (no replies)

$
0
0
Hi,

I'm relatively new to mysql and the Connector/C++.
I'm using MySQL 5.1.45 with MySQL Connector C++ 1.0.5. I do compile under VC++.

I've created with no options database: d;
I've created a table with no options: t with only field f varchar(1);

I've created my program as follows:
string SQL = "INSERT INTO T1(f) VALUES(?)";
prep_stmt = con -> prepareStatement (SQL);
prep_stmt -> setString (1, "e");
int updatecount = prep_stmt -> executeUpdate();

And it works great.
Then I change
prep_stmt -> setString (1, "é"); // E with an accent...
and the execute update fails.

if I start the mysql prompt and do the insert statement it works fine.

Windows is using the latin1 characterset and mysql is using utf, so... I tried to change my table to use latin1, but still it fails.

Since I don't have to tell mysql what my characterset is when I connect, I think it expects unicode.

But I hope that I can tell in my C++ program that the data it get's is latin1 and that the table remains unicode. If not has anyone any idea on what is the best approach in this?

Thanks in advance,
Freek

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>