GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jackross/threequel: What comes after the Sequel? The Threequel! A collection of SQL utilites for Ruby/Rails/ActiveRecord.

BranchesTags
Open more actions menu

Latest commit

 

History

85 Commits
85 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
.rubocop.yml
.rubocop.yml
 
 
.rubocop_todo.yml
.rubocop_todo.yml
 
 
.ruby-version
.ruby-version
 
 
.travis.yml
.travis.yml
 
 
Gemfile
Gemfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
threequel.gemspec
threequel.gemspec
 
 

Repository files navigation

Threequel

Code Climate Build Status

Modules

Commandant

Objectify your SQL scripts. Take blocks of SQL from an .sql script and turn them into class methods on your models/classes.

include Threequel::Commandant

Servant

Run a series of co-dependant .sql scripts to perform tasks.

Classes

SQL::CommandHash

A Hash subclass that maps to Commandant SQL class methods. Keys are the SQL class method names and Values are SQL::Command objects.

SQL::Command

A class that can execute a series of SQL blocks on a specified connection.

sql = <<-"SQL"
 CREATE TABLE dbo.foo (bar varchar(20) NOT NULL);
 GO

 DROP TABLE dbo.foo;
 GO
SQL

connection = ActiveRecord::Base.connection

cmd = Threequel::SQL::Command.new(sql, "My Command")
cmd.execute_on connection

# SQL (23.6ms)  CREATE TABLE dbo.foo (bar varchar(20) NOT NULL);
# SQL (37.1ms)  DROP TABLE dbo.foo;
# => {:message=>"Command executed successfully", :status=>:success} 

# or
Threequel::SQL::Command.new(sql, "My Command") do |cmd|
  cmd.execute_on connection
end

# SQL (23.6ms)  CREATE TABLE dbo.foo (bar varchar(20) NOT NULL);
# SQL (37.1ms)  DROP TABLE dbo.foo;
# => {:message=>"Command executed successfully", :status=>:success} 

Logging

Adds logging to any instance method.

sql = <<-"SQL"
 CREATE TABLE dbo.foo (bar varchar(20) NOT NULL);
 GO

 DROP TABLE dbo.foo;
 GO
SQL

connection = ActiveRecord::Base.connection

Threequel::SQL::Command.new(sql, "My Command") do |cmd|
  cmd.extend Threequel::Logging
  cmd.add_logging_to :execute_on, :console
  cmd.execute_on connection
end
# -- Starting execution of My Command at 2012-07-25 17:13:43 -0400
# SQL (23.6ms)  CREATE TABLE dbo.foo (bar varchar(20) NOT NULL);
# SQL (37.1ms)  DROP TABLE dbo.foo;
# -- Finishing execution of My Command at 2012-07-25 17:13:43 -0400 in 0.006583 seconds
# => [#<Threequel::ConsoleLogger:0x007ffc47f95240 @attributes={:sql=>"CREATE TABLE dbo.foo (bar varchar(20) NOT NULL);\nGO\n\nDROP TABLE dbo.foo;\nGO\n", :command=>"My Command", :statement=>nil, :name=>"My Command", :started_at=>2012-07-25 17:13:43 -0400, :finished_at=>2012-07-25 17:13:43 -0400, :duration=>0.006583, :stage=>:finished, :message=>"Command executed successfully", :status=>:success}>]

LoggingHandler

ConsoleLogger

DBLogger

DBLoggerStorage

Timer

Wrap code in a Timer.clock block and get timing information about your code block.

About

What comes after the Sequel? The Threequel! A collection of SQL utilites for Ruby/Rails/ActiveRecord.

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

0 watching

Forks

3 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.