Hi! There is no deserialize operation currently implemented in Libgda (the main reason is because the serialization was introduced as a way of representing SQL statements to compare statements, not as a way to store them).
Here is what I suggest you do: - parse the JSON string (using for example JSON-Glib https://developer.gnome.org/json-glib/unstable/) and use the GdaSqlBuilder API to re-create the strings (this code could then be incorporated in Libgda if you want); or - store the SQL as well as the other JSON parts in your MongoDB database. Regards, Vivien On 9 December 2013 04:50, Lương Nguyễn Xuân <[email protected]> wrote: > I'm using ligdga-5.0 to parse SQL string to JSON (it will be serialize to > JSON) to store in MongoDB ,something like this : > > SQL string : SELECT col1,col2 FROM table_test > And result serialized is : > > { > "statement": { > "sql": "SELECT col1,col2 FROM table_test\n", > "stmt_type": "SELECT", > "contents": { > "distinct": "false", > "fields": [ > { > "expr": { > "value": "col1" > }, > "field_name": "col1" > }, > { > "expr": { > "value": "col2" > }, > "field_name": "col2" > } > ], > "from": { > "targets": [ > { > "expr": { > "value": "table_test" > }, > "table_name": "table_test" > } > ] > } > } > } > } > > > I've been store this part in MOngoDB (without 'sql' ) : > > { > "stmt_type": "SELECT", > "contents": { > "distinct": "false", > "fields": [ > { > "expr": { > "value": "col1" > }, > "field_name": "col1" > }, > { > "expr": { > "value": "col2" > }, > "field_name": "col2" > } > ], > "from": { > "targets": [ > { > "expr": { > "value": "table_test" > }, > "table_name": "table_test" > } > ] > } > } > } > > And today I want to convert this JSON to SQL string ('SELECT col1,col2 FROM > table_test') . What can i do ? > > Regards, > > > > _______________________________________________ > gnome-db-list mailing list > [email protected] > https://mail.gnome.org/mailman/listinfo/gnome-db-list > >
_______________________________________________ gnome-db-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gnome-db-list
