DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Utilizing Database Hooks Like a Pro in Node.js
  • Building the Next-Generation Data Lakehouse: 10X Performance
  • My 7 Must-Have Tools for JavaScript Pros That I Can’t Live Without in 2023
  • A Beginner's Guide to Back-End Development

Trending

  • Debugging Tips and Tricks: A Comprehensive Guide
  • Top 7 Best Practices DevSecOps Team Must Implement in the CI/CD Process
  • What Is Kubernetes RBAC and Why Do You Need It?
  • Modular Software Architecture: Advantages and Disadvantages of Using Monolith, Microservices and Modular Monolith
  1. DZone
  2. Data Engineering
  3. Databases
  4. SQLike: SQL-like Querying Engine for JavaScript and ActionScript

SQLike: SQL-like Querying Engine for JavaScript and ActionScript

Mitch Pronschinske user avatar by
Mitch Pronschinske
·
Jun. 01, 10 · Interview
Like (0)
Save
Tweet
Share
13.22K Views

Join the DZone community and get the full member experience.

Join For Free
A lightweight query engine that can filter arrays in JavaScript using a 'SQL-like' syntax was revealed today by creator Thomas Frank.  Named "SQLike," the small (10kB) ECMAscript (JavaScript and ActionScript) query engine is used on the browser's client side to make it easier for searching, combining, and updating data when an SQL-like approach is better suited (e.g. in flat table-like structures).

Frank admits that SQLite isn't as fast as SQLite, but it's "a handy alternative for small amounts of data."  He goes on to say:

"Data structures in JavaScript and ActionScript are JSON:esque and sometimes deeply nested. When they are nested into XML-like structures a query language such as JSONPath (XPath for JSON) is a sound approach. But sometimes you might also use flat table-like structures. In those cases a more SQL-like approach can be more suited for searching, combining and updating data."

Developers who are familiar with SQL should be able to easily pick up SQLike.  It supports a multitude of language elements including SELECT, JOIN, EXCEPT, UPDATE, JOIN (implicit), SELECT DISTINCT, INTERSECT, and more.  It also uses aggregate functions such as COUNT, SUM, and AVERAGE.

Some differences between SQL and SQLike are the way in which you write queries.  In SQLike, they are written as literal objects.  The where and set keywords take JavaScript and ActionScript functions as arguments.  Those functions can also be included in select statements.  In SQLike, you don't alter tables or create them, because they are identical to arrays and easily generated outside of SQLike.  Finally, you don't index tables.

Because SQLike consists of ECMA-262 code, all of the code inside function q is identical and has been compressed by the YUI compressor.  The only difference in languages is at the beginning lines defining SQLike as:

  • JS object
  • AS2 class
  • AS3 class inside a package

Here are some examples of SQLike's SQL-like syntax:






YQL provides the same functionality using web services, but SQLite does it in-memory.

Read more about SQLike in this blog or try a demo and short reference.

Also check out a similar solution in LINQ to JavaScript. [http://jslinq.codeplex.com/]
JavaScript ActionScript Database Engine

Opinions expressed by DZone contributors are their own.

Related

  • Utilizing Database Hooks Like a Pro in Node.js
  • Building the Next-Generation Data Lakehouse: 10X Performance
  • My 7 Must-Have Tools for JavaScript Pros That I Can’t Live Without in 2023
  • A Beginner's Guide to Back-End Development

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: