Skip to content
This repository
Browse code

Project creation.

First cut at the revived ClojureQL with minimal backend support and
a few ideas on an improved frontend.
  • Loading branch information...
commit e3d0e3c3a59cdf5e6b715ca100b7abcbb7c52170 0 parents
Lau B. Jensen authored

Showing 4 changed files with 298 additions and 0 deletions. Show diff stats Hide diff stats

  1. +8 0 .gitignore
  2. +227 0 LICENSE
  3. +56 0 README.md
  4. +7 0 project.clj
8 .gitignore
... ... @@ -0,0 +1,8 @@
  1 +.cake
  2 +pom.xml
  3 +*.jar
  4 +*.war
  5 +lib
  6 +classes
  7 +build
  8 +clojureql
227 LICENSE
... ... @@ -0,0 +1,227 @@
  1 +Eclipse Public License - v 1.0
  2 +
  3 +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
  4 +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
  5 +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
  6 +
  7 +1. DEFINITIONS
  8 +
  9 +"Contribution" means:
  10 +
  11 +a) in the case of the initial Contributor, the initial code and
  12 +documentation distributed under this Agreement, and
  13 +
  14 +b) in the case of each subsequent Contributor:
  15 +
  16 +i) changes to the Program, and
  17 +
  18 +ii) additions to the Program;
  19 +
  20 +where such changes and/or additions to the Program originate from and
  21 +are distributed by that particular Contributor. A Contribution
  22 +'originates' from a Contributor if it was added to the Program by such
  23 +Contributor itself or anyone acting on such Contributor's
  24 +behalf. Contributions do not include additions to the Program which:
  25 +(i) are separate modules of software distributed in conjunction with
  26 +the Program under their own license agreement, and (ii) are not
  27 +derivative works of the Program.
  28 +
  29 +"Contributor" means any person or entity that distributes the Program.
  30 +
  31 +"Licensed Patents" mean patent claims licensable by a Contributor
  32 +which are necessarily infringed by the use or sale of its Contribution
  33 +alone or when combined with the Program.
  34 +
  35 +"Program" means the Contributions distributed in accordance with this
  36 +Agreement.
  37 +
  38 +"Recipient" means anyone who receives the Program under this
  39 +Agreement, including all Contributors.
  40 +
  41 +2. GRANT OF RIGHTS
  42 +
  43 +a) Subject to the terms of this Agreement, each Contributor hereby
  44 +grants Recipient a non-exclusive, worldwide, royalty-free copyright
  45 +license to reproduce, prepare derivative works of, publicly display,
  46 +publicly perform, distribute and sublicense the Contribution of such
  47 +Contributor, if any, and such derivative works, in source code and
  48 +object code form.
  49 +
  50 +b) Subject to the terms of this Agreement, each Contributor hereby
  51 +grants Recipient a non-exclusive, worldwide, royalty-free patent
  52 +license under Licensed Patents to make, use, sell, offer to sell,
  53 +import and otherwise transfer the Contribution of such Contributor, if
  54 +any, in source code and object code form. This patent license shall
  55 +apply to the combination of the Contribution and the Program if, at
  56 +the time the Contribution is added by the Contributor, such addition
  57 +of the Contribution causes such combination to be covered by the
  58 +Licensed Patents. The patent license shall not apply to any other
  59 +combinations which include the Contribution. No hardware per se is
  60 +licensed hereunder.
  61 +
  62 +c) Recipient understands that although each Contributor grants the
  63 +licenses to its Contributions set forth herein, no assurances are
  64 +provided by any Contributor that the Program does not infringe the
  65 +patent or other intellectual property rights of any other entity. Each
  66 +Contributor disclaims any liability to Recipient for claims brought by
  67 +any other entity based on infringement of intellectual property rights
  68 +or otherwise. As a condition to exercising the rights and licenses
  69 +granted hereunder, each Recipient hereby assumes sole responsibility
  70 +to secure any other intellectual property rights needed, if any. For
  71 +example, if a third party patent license is required to allow
  72 +Recipient to distribute the Program, it is Recipient's responsibility
  73 +to acquire that license before distributing the Program.
  74 +
  75 +d) Each Contributor represents that to its knowledge it has sufficient
  76 +copyright rights in its Contribution, if any, to grant the copyright
  77 +license set forth in this Agreement.
  78 +
  79 +3. REQUIREMENTS
  80 +
  81 +A Contributor may choose to distribute the Program in object code form
  82 +under its own license agreement, provided that:
  83 +
  84 +a) it complies with the terms and conditions of this Agreement; and
  85 +
  86 +b) its license agreement:
  87 +
  88 +i) effectively disclaims on behalf of all Contributors all warranties
  89 +and conditions, express and implied, including warranties or
  90 +conditions of title and non-infringement, and implied warranties or
  91 +conditions of merchantability and fitness for a particular purpose;
  92 +
  93 +ii) effectively excludes on behalf of all Contributors all liability
  94 +for damages, including direct, indirect, special, incidental and
  95 +consequential damages, such as lost profits;
  96 +
  97 +iii) states that any provisions which differ from this Agreement are
  98 +offered by that Contributor alone and not by any other party; and
  99 +
  100 +iv) states that source code for the Program is available from such
  101 +Contributor, and informs licensees how to obtain it in a reasonable
  102 +manner on or through a medium customarily used for software exchange.
  103 +
  104 +When the Program is made available in source code form:
  105 +
  106 +a) it must be made available under this Agreement; and
  107 +
  108 +b) a copy of this Agreement must be included with each copy of the Program.
  109 +
  110 +Contributors may not remove or alter any copyright notices contained
  111 +within the Program.
  112 +
  113 +Each Contributor must identify itself as the originator of its
  114 +Contribution, if any, in a manner that reasonably allows subsequent
  115 +Recipients to identify the originator of the Contribution.
  116 +
  117 +4. COMMERCIAL DISTRIBUTION
  118 +
  119 +Commercial distributors of software may accept certain
  120 +responsibilities with respect to end users, business partners and the
  121 +like. While this license is intended to facilitate the commercial use
  122 +of the Program, the Contributor who includes the Program in a
  123 +commercial product offering should do so in a manner which does not
  124 +create potential liability for other Contributors. Therefore, if a
  125 +Contributor includes the Program in a commercial product offering,
  126 +such Contributor ("Commercial Contributor") hereby agrees to defend
  127 +and indemnify every other Contributor ("Indemnified Contributor")
  128 +against any losses, damages and costs (collectively "Losses") arising
  129 +from claims, lawsuits and other legal actions brought by a third party
  130 +against the Indemnified Contributor to the extent caused by the acts
  131 +or omissions of such Commercial Contributor in connection with its
  132 +distribution of the Program in a commercial product offering. The
  133 +obligations in this section do not apply to any claims or Losses
  134 +relating to any actual or alleged intellectual property
  135 +infringement. In order to qualify, an Indemnified Contributor must: a)
  136 +promptly notify the Commercial Contributor in writing of such claim,
  137 +and b) allow the Commercial Contributor tocontrol, and cooperate with
  138 +the Commercial Contributor in, the defense and any related settlement
  139 +negotiations. The Indemnified Contributor may participate in any such
  140 +claim at its own expense.
  141 +
  142 +For example, a Contributor might include the Program in a commercial
  143 +product offering, Product X. That Contributor is then a Commercial
  144 +Contributor. If that Commercial Contributor then makes performance
  145 +claims, or offers warranties related to Product X, those performance
  146 +claims and warranties are such Commercial Contributor's responsibility
  147 +alone. Under this section, the Commercial Contributor would have to
  148 +defend claims against the other Contributors related to those
  149 +performance claims and warranties, and if a court requires any other
  150 +Contributor to pay any damages as a result, the Commercial Contributor
  151 +must pay those damages.
  152 +
  153 +5. NO WARRANTY
  154 +
  155 +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
  156 +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  157 +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
  158 +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
  159 +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
  160 +responsible for determining the appropriateness of using and
  161 +distributing the Program and assumes all risks associated with its
  162 +exercise of rights under this Agreement , including but not limited to
  163 +the risks and costs of program errors, compliance with applicable
  164 +laws, damage to or loss of data, programs or equipment, and
  165 +unavailability or interruption of operations.
  166 +
  167 +6. DISCLAIMER OF LIABILITY
  168 +
  169 +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
  170 +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
  171 +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
  172 +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
  173 +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  174 +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
  175 +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  176 +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  177 +
  178 +7. GENERAL
  179 +
  180 +If any provision of this Agreement is invalid or unenforceable under
  181 +applicable law, it shall not affect the validity or enforceability of
  182 +the remainder of the terms of this Agreement, and without further
  183 +action by the parties hereto, such provision shall be reformed to the
  184 +minimum extent necessary to make such provision valid and enforceable.
  185 +
  186 +If Recipient institutes patent litigation against any entity
  187 +(including a cross-claim or counterclaim in a lawsuit) alleging that
  188 +the Program itself (excluding combinations of the Program with other
  189 +software or hardware) infringes such Recipient's patent(s), then such
  190 +Recipient's rights granted under Section 2(b) shall terminate as of
  191 +the date such litigation is filed.
  192 +
  193 +All Recipient's rights under this Agreement shall terminate if it
  194 +fails to comply with any of the material terms or conditions of this
  195 +Agreement and does not cure such failure in a reasonable period of
  196 +time after becoming aware of such noncompliance. If all Recipient's
  197 +rights under this Agreement terminate, Recipient agrees to cease use
  198 +and distribution of the Program as soon as reasonably
  199 +practicable. However, Recipient's obligations under this Agreement and
  200 +any licenses granted by Recipient relating to the Program shall
  201 +continue and survive.
  202 +
  203 +Everyone is permitted to copy and distribute copies of this Agreement,
  204 +but in order to avoid inconsistency the Agreement is copyrighted and
  205 +may only be modified in the following manner. The Agreement Steward
  206 +reserves the right to publish new versions (including revisions) of
  207 +this Agreement from time to time. No one other than the Agreement
  208 +Steward has the right to modify this Agreement. The Eclipse Foundation
  209 +is the initial Agreement Steward. The Eclipse Foundation may assign
  210 +the responsibility to serve as the Agreement Steward to a suitable
  211 +separate entity. Each new version of the Agreement will be given a
  212 +distinguishing version number. The Program (including Contributions)
  213 +may always be distributed subject to the version of the Agreement
  214 +under which it was received. In addition, after a new version of the
  215 +Agreement is published, Contributor may elect to distribute the
  216 +Program (including its Contributions) under the new version. Except as
  217 +expressly stated in Sections 2(a) and 2(b) above, Recipient receives
  218 +no rights or licenses to the intellectual property of any Contributor
  219 +under this Agreement, whether expressly, by implication, estoppel or
  220 +otherwise. All rights in the Program not expressly granted under this
  221 +Agreement are reserved.
  222 +
  223 +This Agreement is governed by the laws of the State of Washington and
  224 +the intellectual property laws of the United States of America. No
  225 +party to this Agreement will bring a legal action under this Agreement
  226 +more than one year after the cause of action arose. Each party waives
  227 +its rights to a jury trial in any resulting litigation.
56 README.md
Source Rendered
... ... @@ -0,0 +1,56 @@
  1 +ClojureQL
  2 +=========
  3 +
  4 +ClojureQL is an abstraction layer sitting on top of standard low-level JDBC SQL integration.
  5 +It let's you interact with a database through a series of objects which work as Clojure data
  6 +type.
  7 +
  8 +ClojureQL provides little to no assistance in creating specialized query strings, so that
  9 +compatability with the database backend is left to the users.
  10 +
  11 +
  12 +Query
  13 +-----
  14 +
  15 + (def users (table connection-info :users ["*"])) ; All columns in table 'users'
  16 +
  17 + @users
  18 + > ({:id 1 :name "Lau"} {:id 2 :name "Christophe"} {:id 3 :name "Frank"})
  19 +
  20 + (pick users "id=1")
  21 + > ({:id 1 :name "Lau"})
  22 +
  23 + (drop users "id=1")
  24 + > ({:id 2 :name "Christophe"} {:id 3 :name "Frank"})
  25 +
  26 +Manipulation
  27 +------------
  28 +
  29 + @(conj! users {:name "Jack"})
  30 + > ({:id 1 :name "Lau"} {:id 2 :name "Christophe"} {:id 3 :name "Frank"} {:id 4 :name "Jack"})
  31 +
  32 + @(disj! users {:name "Jack"})
  33 + > ({:id 1 :name "Lau"} {:id 2 :name "Christophe"} {:id 3 :name "Frank"})
  34 +
  35 +Compound ops
  36 +------------
  37 +
  38 + (-> (conj! users {:name "Jack"})
  39 + (disj! {:name "Lau"})
  40 + (sort :id :desc))
  41 + > ({:id 3 :name "Frank"} {:id 2 :name "Christophe"})
  42 +
  43 +Joins
  44 +------
  45 +
  46 + (def visitors (table connection-info :visitors [:id :guest]))
  47 +
  48 + (join users visitors #{users.id visitors.id})
  49 + ({:id 1 :name "Lau" :guest "false"} {:id 3 :name "Frank" :guest "true"})
  50 +
  51 +Helpers
  52 +-------
  53 +
  54 + (sql-clause "(%1 < %2) AND (avg(%1) < %3)" :income :cost :expenses)
  55 + > "(income < cost) AND (avg(income) < expenses)"
  56 +
7 project.clj
... ... @@ -0,0 +1,7 @@
  1 +(defproject clojureql "0.0.1-SNAPSHOT"
  2 + :description "SQL abstractions for Clojure"
  3 + :dependencies [[org.clojure/clojure "1.2.0"]
  4 + [org.clojure/clojure-contrib "1.2.0"]
  5 + [mysql/mysql-connector-java "5.1.6"]]
  6 + :dev-dependencies [[swank-clojure "1.2.0-SNAPSHOT"]])
  7 +

0 comments on commit e3d0e3c

Please sign in to comment.
Something went wrong with that request. Please try again.