Introduction
AtomSQL is Simple Database Query Language for SQL Like systems.
Supported Features
ALL CRUD Operations are supported
Few Table metadata operations are supported
MySQL, Sqlite✳, Postgresql✳ are supported
Perl, PHP✳, Nodejs✳ are supported
Why ?
Current SQL is way too much to type for a UNIX/Linux user. So, came up with this simpler syntax to do most of the common tasks.
SQL Replacement ?
SQL itself is very complex and AtomSQL is not meant to be a replacement for it. Many Projects like Oracle, Postgresql, MySQL have invested lot of hours building a flexible SQL as per standards. Replacing all that effort in couple of weeks is not the idea.
TD;LR
AtomSQL libraries provide mechanism to convert AtomSQL queries to normal SQL queries.
AtomSQL Syntax
Below sections explain the syntax with few examples.
Few CLUES to Remember
=is an operator+is ADD operator-is DROP operator
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
|
|
Table/Create
Few CLUES to Remember
{}are borrowed fromC/C++Structure Definition. So, you can remember that way.
| AtomSQL | MySQL |
|---|---|
|
|
|
|
Table/Select
Few CLUES to Remember
<>- COLUMN selection expression()- WHERE expression[]- LIMIT, OFFSET expression
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
Table/Update
Few CLUES to Remember
//is like regular-expressions for substitution. Readperl,awkfor some intro()- WHERE expression[]- LIMIT, OFFSET expression
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
Table/Insert
Few CLUES to Remember
=- Copy Table Structure>- UNIX Redirection operator. Rows are REPLACEd>>- UNIX Append operator. Rows are INSERTEd()- WHERE expression()- TUPLE representation[()]- ARRAY of TUPLE representation
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table/Delete
Few CLUES to Remember
!- Bang means, somethings is going away !!!- Double Bang, somethings are really going away.[]- LIMIT, OFFSET expression()- WHERE expression
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
|
|
Table/Backup
Few CLUES to Remember
<>- COLUMN selection expression()- WHERE expression. Ignored by MySQL[]- LIMIT, OFFSET expression>- UNIX Redirection operator. Writes data to File.
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
|
|
Table/Restore
Few CLUES to Remember
<- UNIX like indirection symbol<<- Custom redirection symbol&- Specifies to IGNORE inserts on errors
| AtomSQL | MySQL |
|---|---|
|
|
|
|
|
|
|
|
LANGUAGES / PERL
- Download
git clone https://github.com/nareshv/atomsql/
- Create a simple Perl Script
#!/usr/bin/env perl
use AtomSQL;
use strict;
use warnings;
# set the driver
$ENV{ATOMSQL_DRIVER} = 'mysql';
# test the api
my $asql = "DUAL <now()>";
my $sql = atomsql_query($asql);
# print the results
print "ORIGINAL : $asql\n";
print "SQL : $sql\n";
Prints the following output
ORIGINAL : DUAL <now()>
SQL : SELECT now() FROM DUAL
LANGUAGES / PHP
- Download
git clone https://github.com/nareshv/atomsql/
- Create a simple PHP Script
<?php
// set the driver
$_ENV{ATOMSQL_DRIVER} = 'mysql';
// test the api
my $asql = "DUAL <now()>";
my $sql = atomsql_query($asql);
// print the results
echo "ORIGINAL : $asql\n";
echo "SQL : $sql\n";
Prints the following output
ORIGINAL : DUAL <now()>
SQL : SELECT now() FROM DUAL
Version
0.1 - Initial version
License
MIT
Contributing
Please submit a PR.
~~~