3 messages in com.mysql.lists.plusplusRE: Mysql++ and stl bitset class.
FromSent OnAttachments
Jonatan Taminau07 Nov 2005 05:27 
Steve Povilaitis07 Nov 2005 06:52 
Warren Young07 Nov 2005 12:02 
Subject:RE: Mysql++ and stl bitset class.
From:Steve Povilaitis (spov@aegistg.com)
Date:11/07/2005 06:52:31 AM
List:com.mysql.lists.plusplus

Jonatan,

Sorry I can't help you, but I may be doing some bit oriented message storing in my database as well. If you don't mind, please post what you learn to this forum, or if inappropriate for this forum, please feel free to email me directly.

Thanks,

Steve

-----Original Message----- From: Jonatan Taminau [mailto:jona@silicos.com] Sent: Monday, November 07, 2005 8:28 AM To: plus@lists.mysql.com Subject: Mysql++ and stl bitset class.

I want to store some bitstrings in a mysql database so for testing i made a simple program:

MySql:

CREATE TABLE table ( bitString VARCHAR(1024) )

Program:

bitset<1024> bitString; query << "INSERT INTO table VALUES (\'" << bitString.to_string() << "\');"; query.execute();

...

query << "SELECT * FROM table;"; ResUse result(query.use()); if (result) { Row row; while (row = result.fetch_row()) { bitset<1024> bitString(row[0]); //do something with bitString } }

However, I should be able to do this in a more performant way without the 'string-conversion'. Is this possible? I have seen Mysql supports some datatypes like BINARY and VARBINARY, so has someone experience in using them for this kind of purposes?