https://github.com/cellbis/cellbis-sql-abstract
SQL Query Generator
https://github.com/cellbis/cellbis-sql-abstract
sql-abstraction sql-query
Last synced: 8 months ago
JSON representation
SQL Query Generator
- Host: GitHub
- URL: https://github.com/cellbis/cellbis-sql-abstract
- Owner: CellBIS
- License: artistic-2.0
- Created: 2018-07-05T05:56:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-08T21:35:49.000Z (about 5 years ago)
- Last Synced: 2025-10-22T07:54:38.317Z (8 months ago)
- Topics: sql-abstraction, sql-query
- Language: Perl
- Homepage: https://metacpan.org/pod/CellBIS::SQL::Abstract
- Size: 111 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# CellBIS::SQL::Abstract - SQL Query Generator 
The purpose of this module is to generate SQL Query. General queries has covered
`insert`, `delete`, `update`, `select`, and **select** with **join** - (`select_join`).
And the additional query has covered to create table
You can use this module for [Mojo::mysql](https://metacpan.org/pod/Mojo::mysql)
or [DBI](https://metacpan.org/pod/DBI).
## How to Install :
From Source :
```bash
git clone -b v1.5 git@github.com:CellBIS/CellBIS-SQL-Abstract.git
perl Makefile.PL
make && make test
make install && make clean
```
with `cpan` command :
```bash
cpan -i CellBIS::SQL::Abstract
```
with `cpanm` command :
```bash
cpanm CellBIS::SQL::Abstract
```
## Synopsis Module :
```perl
use CellBIS::SQL::Abstract
my $sql_abstract = CellBIS::SQL::Abstract->new;
# For create table SQLite
my $sql_abstract = CellBIS::SQL::Abstract->new(db_type => 'sqlite');
# Create Table
my $table_name = 'my_table_name'; # Table name.
my $col_list = []; # List of column table
my $col_attr = {}; # Attribute column table.
# insert
my $table_name = 'my_table_name'; # Table name.
my $column = []; # List of column in the table (array ref data type)
my $value = []; # Value of column (array ref data type)
$sql_abstract->insert($table_name, $column, $value);
# update
my $table_name = 'my_table_name'; # Table name.
my $column = []; # List of column in the table (array ref data type)
my $value = []; # Value of column (array ref data type)
my $clause = {}; # Clause of SQL Query, like where, order by, group by, and etc.
$sql_abstract->update($table_name, $column, $value, $clause);
# delete
my $table_name = 'my_table_name'; # Table name.
my $clause = {}; # Clause of SQL Query, like where, order by, group by, and etc.
$sql_abstract->delete($table_name, $clause);
# select
my $table_name = 'my_table_name'; # Table name.
my $column = []; # List of column in the table (array ref data type)
my $clause = {}; # Clause of SQL Query, like where, order by, group by, and etc.
$sql_abstract->select($table_name, $column, $clause);
# select_join
my $table_list = []; # List of table. (array ref data type)
my $column = []; # List of column to select. (array ref data type)
my $clause = {}; # Clause of SQL Query.
$sql_abstract->select_join($table_list, $column, $clause);
```
For more information you can see on [CPAN](https://metacpan.org/pod/CellBIS::SQL::Abstract).