title: SQLite and UTF8
body: <p>I have a strange problem. Cant add function to sqlite/ Write on c++/Qt. 
  Function should do upper to Utf-8 simbols; </p>
  
  <pre><code>    this-&gt;db = QSqlDatabase::addDatabase("QSQLITE");
      this-&gt;db.setDatabaseName(db);
      this-&gt;db.open();
      QVariant v = this-&gt;db.driver()-&gt;handle();
      sqlite3 *handler = *static_cast&lt;sqlite3 **&gt;(v.data());
      sqlite3_create_function( handler, "myUpper", 1, SQLITE_ANY, NULL, myFunc, NULL, NULL )
  </code></pre>
  
  <p>and the function is: </p>
  
  <pre><code>void myFunc( sqlite3_context * ctx, int argc, sqlite3_value ** argv )
  {
          if( argc != 1 ) return;
          QString str;
          switch(sqlite3_value_type(argv[0]))
          {
                  case SQLITE_NULL:
                  {
                          sqlite3_result_text( ctx, "NULL", 4, SQLITE_STATIC );
                          break;
                  }
                  case SQLITE_TEXT:
                  {
                          QString wstr((char*)sqlite3_value_text16(argv[0]));
                          wstr = wstr.toUpper();
                          sqlite3_result_text16( ctx, wstr.toStdString().c_str(), wstr.size() , SQLITE_TRANSIENT );
                          break;
                  }
                  default:
                          sqlite3_result_text( ctx, "NULL", 4, SQLITE_STATIC );
                  break;
          }
  }
  </code></pre>