[フレーム]
BT

InfoQ Software Architects' Newsletter

A monthly overview of things you need to know as an architect or aspiring architect.

View an example

We protect your privacy.

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Unlock the full InfoQ experience

Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources.

Log In
or

Don't have an InfoQ account?

Register
  • Stay updated on topics and peers that matter to youReceive instant alerts on the latest insights and trends.
  • Quickly access free resources for continuous learningMinibooks, videos with transcripts, and training materials.
  • Save articles and read at anytimeBookmark articles to read whenever youre ready.

Topics

Choose your language

InfoQ Homepage News SQLite 3.9 Supports JSON, Indexes on Expressions and More

SQLite 3.9 Supports JSON, Indexes on Expressions and More

This item in japanese

Oct 20, 2015 1 min read

Write for InfoQ

Feed your curiosity. Help 550k+ global
senior developers
each month stay ahead.
Get in touch

Recently released SQLite 3.9 provides a number of new features and enhancements, including support for JSON encoding/decoding, full text search version 5, indexes on expressions, eponymous virtual tables and more.

According to the newly adopted semantic versioning standard, SQLite 3.9 is a new version that includes changes that break forward compatibility by introducing new features, while being backward compatible with older versions. Among the new features that SQLite 3.9 introduces:

  • JSON support through the json1 extension that implements a set of functions to validate JSON strings, construct JSON arrays and objects, manipulate JSON strings by updating, inserting, or replacing values, etc. Additionally, two table-valued functions allow to transform a JSON string into a virtual table with each JSON element mapped to a row.
  • Indexes on expressions , which complement the traditional indexes that reference table columns and allow to define indexes on expressions involving columns. This features would allow to efficiently perform queries, e.g., to list all changes to a given account number that amount to more than a given quantity:
    CREATE INDEX account_change_magnitude ON account_change(acct_no, abs(amt)); SELECT * FROM account_change WHERE acct_no=$xyz AND abs(amt)>=10000; 
    
  • Eponymous virtual tables , which are virtual tables that can be used by simply referring their module name, i.e., without running CREATE VIRTUAL TABLE. An example of this is the dbstat virtual table, which provides low-level information about btree and overflow pages in a database file.
  • Full text search version 5 (FTS5), a virtual table module that allows to create a virtual table that can be later full-text searched. This is how you can populate a virtual table through FTS5:
    CREATE VIRTUAL TABLE email USING fts5(sender, title, body); 
    
    Once you have an FTS5 virtual table, you can search a term in it in three different ways:
    SELECT * FROM email WHERE email MATCH 'fts5'; SELECT * FROM email WHERE email = 'fts5'; SELECT * FROM email('fts5'); 
    
    This feature is still considered experimental.

Other changes worth mentioning are the addition of an optional list of column names when using CREATE_VIEW, the possibility of referencing undefined tables when creating a VIEW and having them checked at query-time.

For more details, check SQLite 3.9.0 and 3.9.1 release notes.

Rate this Article

Adoption
Style

Related Content

The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.

BT

AltStyle によって変換されたページ (->オリジナル) /