usagi / virtual-keyboard-prototype-1

仮想キーボード試作1型
3 stars 0 forks source link

libWRP-SQLite3をせっかく使ってるのに実装がダサい。これはバグだ。 #29

Closed usagi closed 10 years ago

usagi commented 10 years ago

https://github.com/usagi/virtual-keyboard-prototype-1/blob/master/integration-sample/virtual-keyboard.cxx#L22

      auto sql_where = std::string(" where")
        + " x <= " + std::to_string(x) + " and x + w >= " + std::to_string(x)
        + " and"
        + " y <= " + std::to_string(y) + " and y + h >= " + std::to_string(y)
        + " and"
        + " s <= " + std::to_string(stroke)
        ;
      auto sql = std::string("select id from ") + table() + sql_where;

こうなってるけど、ほんらい、libWRP-SQLite3では、

https://github.com/usagi/libWRP-SQLite3/blob/master/example/example_01.cxx#L61

      auto sql = "select * from t where a < ? and b > ?";
      auto statement = database.prepare(sql);

      statement.bind(500 , 1)
               .bind(10.0, 2)
               ;

こうできる。