List:MySQL++« Previous MessageNext Message »
From:Forums Date:April 6 2006 6:33am
Subject:Re: mysql info with mysql++ vers 1.7.4
View as plain text  
Hello Paoletti,

PV> after I've connected with mysql (4.1.12) I need to know some info like
> CHARACTER-SET.
PV> I've tried with Connection->info() but the result is always "...";
PV> How can I obtain this information with mysql++?

you can use the piece of code like this for that puproses:

Connection con_this(use_exceptions);
try {
    con_this.connect( "", "localhost", "root", "" );
    Query query_this = con_this.query();
    query_this << "SHOW GLOBAL VARIABLES";
    Result res_this = query_this.store();
    Row row_this;
    Result::iterator i_this;
    for( i_this = res_this.begin(); i_this < res_this.end(); i_this++ )
    {
         row_this = *i_this;
         std::string var_name = (std::string)row_this.at(0);
         if( var_name == "character_set" )
         {
             // !!! here do something with obtained value
         }
    }
}

just note, that this code compiled against 2.0.7 and you may need to
change syntax a bit (I'm changed it once move from 1.7.4 to 2.0.7, not
sure if reverse changes is required).

this code also may be used for "datadir" variable quering (that
question appeared on list approximately two monthes ago).

-- 
Best regards,
 Forums                            mailto:forum_reply@stripped

Thread
mysql info with mysql++ vers 1.7.4Paoletti Vincenzo5 Apr
  • Re: mysql info with mysql++ vers 1.7.4Warren Young5 Apr
  • Re: mysql info with mysql++ vers 1.7.4Forums6 Apr