Mysql++/C++ - Optimierung `?
-
Hi,
ich brauche sehr schnelle Mysql scan routinen, die nicht sehr lange brauchen sollen.
Mir fällt jedoch keine weitere Optimierung dazu ein ...vielleicht könnt ihr mal einen Blick drüber werfen ..
Mysql::Result Mysql::Manager::Query( String query, int db ) { if( query.length() <= 0 ) return NULL; if( db < 0 || db >= m_numDbs ) return NULL; // is currently connected? if( !m_Servers[ m_Dbs[db].server_id ].connection.IsConnected() ) { // try to reconnect if( !m_Servers[ m_Dbs[db].server_id ].connection.Retry() ) return Mysql::Result( NULL ); } // Select db if( m_Servers[ m_Dbs[db].server_id ].connection.Select_db( m_Dbs[db].db ) ) return Mysql::Result( NULL ); // save last selected db m_Servers[ m_Dbs[db].server_id ].selected_db = db; // Define Query Mysql::Query mysql_query( &m_Servers[ m_Dbs[db].server_id ].connection ); mysql_query = query; // Exec query failed ? if( mysql_query.Exec() ) { return Mysql::Result( NULL ); } // check for last errors if( m_Servers[ m_Dbs[db].server_id ].connection.GetErrno() ) { return Mysql::Result( NULL ); } //return m_pLastRes; return mysql_query.Store(); }
// und hier ein paar string funktionen ...
wie kann man diese optimieren ??
/* String utils */ /********************************************************/ inline String __IntToStr( int i_num ) { char buf[256]; sprintf( buf, "%i", i_num ); return String( buf ); } /********************************************************/ inline String __DwordToStr( DWORD dw_num ) { char buf[256]; sprintf( buf, "%d", dw_num ); return String( buf ); } /********************************************************/ inline String __FloatToStr( float f_num ) { char buf[256]; sprintf( buf, "%f", f_num ); return String( buf ); } /********************************************************/
Wäre für jede Hilfe dankbar
-
Hallo,
auf welcher Ebene willst du denn optimieren?Zum Thema effiziente Zahl-nach-String-Konvertierung:
http://www.cuj.com/documents/s=8006/cuj0212wilson/
http://www.cuj.com/documents/s=8840/cujexp0309wilson/
http://www.cuj.com/documents/s=8906/cujexp0311wilson/
http://www.cuj.com/documents/s=8943/cujexp0312wilson/
-
Hi,
Super Thx. Genau sowas hab ich gesucht !
Bye