A virtual table would do the trick. CREATE VIRTUAL TABLE IF NOT EXISTS key_val USING keyval;
Inside the xCreate function you would call sqlite3_declare_vtab with CREATE TABLE x (key text, value text, _content hidden text); Then you can SELECT value FROM key_val WHERE _content = '<your string>' and key = 'some_key'; Or even SELECT ... k.value ... FROM <table> t CROSS JOIN key_val k ON (_content = t.<field> and key = 'some_key'); The xFilter function needs to store/parse the string, xNext move to the next key/value pair and xColumn return the current key and or value. -----Ursprüngliche Nachricht----- Von: Stefan Keller [mailto:sfkel...@gmail.com] Gesendet: Dienstag, 18. März 2014 02:47 An: General Discussion of SQLite Database; spatialite-us...@googlegroups.com Betreff: [sqlite] How to query key-value-pairs similar to PostgreSQL HSTORE type? Hi, I have a column which contains a string structure taken from the PostgreSQL HSTORE key-value-pairs type. This is an example of one column value: "operator"=>"police","name"=>"Zurich","some_key"=>"some_value" Any suggestions on how to query this most efficiently (like [select value from "some_key"])? Yours, Stefan _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ----------------------------------------------------------------------- Gunter Hick Software Engineer Scientific Games International GmbH Klitschgasse 2 – 4, A - 1130 Vienna, Austria FN 157284 a, HG Wien Tel: +43 1 80100 0 E-Mail: h...@scigames.at This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice as to its status and accordingly please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any person as to do so could be a breach of confidence. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users