ocarina 0.1.0

A small package that is working on abstracting sql.


Ocarina is a basic SQL-parser, that is abstracting the execution of an expression {keyword - data} into a easy to understand string that could later be used by another program to execute the query.

It is project orientated is therefore written in a way, so that it can be used in combination with other projects. At least I try to write it in that way.


Ocarina is a rust beginner project that I wanted to create in order to get better at rust as well as editing code in vim. Therefore it should not be used or integrated with other code at the moment.

If you find the interest or time to contribute to the project, please feel free to do so. I'm a big fan of contribution, so if you want I would enjoy working with you.


The main part of the library, is a parser {parser.rs} that is combining the different elements of the library and is using the different parts of the library in order to convert a start_query into an abstract representation of the actions that need to be taken by the database in order to perform the query that is requested by the user/system.


The project is in its first state, where I research and try a lot of different things in order to find a fitting and easy to use layer between sql and an application.


First of all, the system has to create a new parser for a query.

let query = "SELECT * FROM users WHERE userID = 1";
let _parser = parser::Parser::new(query);

After that, the parser offers different methods that can manipulate and change the query as well as splitting it into better to understand format, like tokens. At the moment, a token is just a whitespace seperated word that was split into a vec.

In order to get the end tokens for the entered query, one would have to follow the following flow:

# This method splits the query into tokens that can be parsed in later steps.
# Iterating over the query tokens and finding the indexes of each keyword it can find.

After performing these operations on your query, you receave something that looks like this:

expressions = [

	keyword: "SELECT",
	data: "*",

	keyword: "FROM",
	data: "users",
	keyword: "WHERE",
	data: ["userID","=","1"],

In this current state, we can't really operate on these tokens/expressions. This is my task for the near future to implement a system, that can better split up the query into a better parseable list.

The end goal of Ocarina is to create a query parser, that can be used in a database or a other type of system where a user can insert commands via an SQL-Syntax.

But the main part of the interpretation of the output of Ocarina is not in my current interest and would have to be implement by a adapter or implementor of Ocarina into a system.