![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
#Arc (Arel Connection) Arc is a database connection engine that provides everything Arel needs to construct an AST. You can use sqlite, postgresql and/or mysql.
Arc gives you:
There are two dependencies: q and arel itself.
Arc lets you use arel without the cost of including active record as a dependency.
Arel is a very capable and inspired bit of code which provides machinery for building an abstract syntax tree(ast) of a complex sql query in pure ruby.
##Arc is not: Arc isn't an ORM. There has been some recent discussion about the state of ruby ORMs. Arc does not make any attempt to pass judgement against any of the fine ORMs out there. Arc came out of a need for a lighter weight method for manipulating data in a database. Arc gives developers flexibility to build their own frameworks and write smaller libraries with fewer dependencies.
##Installation Add this to your Gemfile gem 'pg' #'mysql2' or 'sqlite' gem 'arc'
##Basics ####Connect to a database:
require 'arc'
@store = Arc::DataStores[:postgres].new({
database: arc_development,
host: localhost,
user: superman
})
@store[:superheros]
# => <Arc::DataStores::ObjectDefinitions::SqliteTable:0x007f86d4026f68 @name="superheros">
@store[:superheros].column_names
# => [:is_awesome, :name, :id ]
@store[:superheros][:id]
# => #<Arc::DataStores::ObjectDefinitions::SqliteColumn @name='id'>
@store[:superheros][:id].primary_key?
# => true
@store[:superheros][:is_awesome].type
# => :bool
####Execute a query Build an Arel query and pass it to one of the store's CRUD methods:
"Read" Example:
s = Arel::Table.new :superheros
s.project(s[:name], s[:id], s[:is_awesome])
@store.read s
# => [{ :id => 1, :name => 'superman', :is_awesome => true }
# => { :id => 2, :name => 'batman', :is_awesome => false }
# => { :id => 3, :name => 'ironman', :is_awesome => nil }]
"Create" example
im = Arel::InsertManager.new
im.insert([
[superheros[:name], 'green hornet'],
[superheros[:is_awesome], true]
])
@store.create im
# => { :id => 4, :name => 'green hornet', :is_awesome => true }
##Advanced Arc handles some of the more complex features of arel, like complex joins:
s = Arel::Table.new :superheros
sp = Arel::Table.new :superheros_powers
p = Arel::Table.new :powers
stmt = s.join(sp).on(s[:id].eq(sp[:superhero_id]))
.join(p).on(p[:id].eq(sp[:power_id]))
.project(
s[:name].as('superhero_name'),
p[:name].as('power_name')
)
@store.read stmt
# => [{:superhero_name => 'superman', :power_name => 'flight'},
# => {:superhero_name => 'superman', :power_name => 'x-ray-vision'},
# => {:superhero_name => 'batman', :power_name => "a belt'}]
##TODO Arc is a new library. The test suite has excellent coverage, but bugs need to be identified, tested and fixed. Next step is to add RDoc magic. A long term goal would be to add on to the schema interface to allow for some ddl operations.
##Development Install dependencies with bundler Make sure you have bundler installed, point your terminal to the project's root directory and run
$ bundle install
Running the tests:
$ rake test
To run the tests agains a particular adapter
$ rake test:adapter[<your-adapter-here>]
FAQs
Unknown package
We found that arc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.