List:MySQL++« Previous MessageNext Message »
From:Jonatan Taminau Date:November 7 2005 1:28pm
Subject:Mysql++ and stl bitset class.
View as plain text  
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?

Thanks in advance,
Jonatan Taminau.


Thread
Mysql++ and stl bitset class.Jonatan Taminau7 Nov
  • RE: Mysql++ and stl bitset class.Steve Povilaitis7 Nov
  • Re: Mysql++ and stl bitset class.Warren Young7 Nov