JSON1 support for SQLite
JSON1 support for SQLite
I see from a prior post that the JSON1 SQLite loadable extension has been included/enabled for the dotConnect product. Can this also be done for UniDAC? Thanks.
Re: JSON1 support for SQLite
We will consider a possibility to support JSON1 extension in UniDAC in the next version of our product and will inform you about the results.
Re: JSON1 support for SQLite
We investigated the possibility of using JSON1 extension in UniDAC. Currently, you can work with JSON1 SQLite loadable extension when using our product in the Direct Mode. The following code snippet demonstrates the loading of the 'json1.dll' extension:
After that, you can create a table with a field of the JSON type and fill it in as follows:
Code: Select all
...
UniConnection.ProviderName := 'SQLite';
UniConnection.SpecificOptions.Values['Direct'] := 'True';
UniConnection.SpecificOptions.Values['EnableLoadExtension'] := 'True';
UniConnection.Connect;
UniConnection.ExecSQL('SELECT load_extension(''json1.dll'')')
...
Code: Select all
...
UniConnection.ExecSQL('CREATE TABLE test_table (id INTEGER, json_field JSON);');
UniConnection.ExecSQL('insert into test_table (id, json_field) values (1, json(''{"name":"donald"}''));');
UniConnection.ExecSQL('insert into test_table (id, json_field) values (2, json(''{"name":"melania"}''));');
...