Permalink
Browse files

Committing Bella to her own repo.

  • Loading branch information...
Tom Krush
Tom Krush committed Feb 7, 2011
0 parents commit 888ab84c3f0e54c2ce2a75d107f2c4485a083c65
@@ -0,0 +1 @@
+.DS_Store
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Tom Krush
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
+# Bella
+
+Bella is a PHP project inspired by [Arel](http://github.com/rails/arel). Bella has the same internal structure as Arel and has a very similar syntax to it as well.
+
+## Installation
+
+1. Clone *https://github.com/tomkrush/bella*
+2. Make sure bella is visible on server and target index.php for the unit tests.
+3. So far I can confirm that Bella runs on at least PHP 5.2.13.
+
+## Examples
+
+*as you can see they are not here yet*
@@ -0,0 +1,7 @@
+<?php
+
+require_once 'treemanager.php';
+require_once 'selectmanager.php';
+require_once 'table.php';
+require_once 'nodes.php';
+require_once 'visitors.php';
@@ -0,0 +1,22 @@
+<?php
+
+require_once 'nodes/node.php';
+require_once 'nodes/binary.php';
+require_once 'nodes/function.php';
+require_once 'nodes/primitive.php';
+require_once 'nodes/and.php';
+require_once 'nodes/average.php';
+require_once 'nodes/count.php';
+require_once 'nodes/equality.php';
+require_once 'nodes/grouping.php';
+require_once 'nodes/having.php';
+require_once 'nodes/maximum.php';
+require_once 'nodes/minimum.php';
+require_once 'nodes/number.php';
+require_once 'nodes/offset.php';
+require_once 'nodes/or.php';
+require_once 'nodes/ordering.php';
+require_once 'nodes/selectstatement.php';
+require_once 'nodes/sqlliteral.php';
+require_once 'nodes/string.php';
+require_once 'nodes/sum.php';
@@ -0,0 +1,3 @@
+<?php
+
+class NodeBinaryAnd extends NodeBinary {}
@@ -0,0 +1,3 @@
+<?php
+
+class NodeFunctionAverage extends NodeFunction {}
@@ -0,0 +1,12 @@
+<?php
+
+class NodeBinary extends Node
+{
+ public $left, $right;
+
+ public function __construct($left, $right)
+ {
+ $this->left = $left;
+ $this->right = $right;
+ }
+}
@@ -0,0 +1,12 @@
+<?php
+
+class NodeFunctionCount extends NodeFunction
+{
+ public $distinct;
+
+ public function __construct($expression, $distinct = FALSE, $alias = NULL)
+ {
+ parent::__construct($expression, $alias);
+ $this->distinct = $distinct;
+ }
+}
@@ -0,0 +1,3 @@
+<?php
+
+class NodeBinaryEquality extends NodeBinary {}
@@ -0,0 +1,18 @@
+<?php
+
+class NodeFunction extends Node
+{
+ public $expression, $alias;
+
+ public function __construct($expression, $alias = NULL)
+ {
+ $this->expression = $expression;
+ $this->alias = $alias;
+ }
+
+ public function is($alias)
+ {
+ $this->alias = new NodeSQLLiteral($alias);
+ return $this;
+ }
+}
@@ -0,0 +1,11 @@
+<?php
+
+class NodeGrouping extends Node
+{
+ public $expression;
+
+ public function __construct($expression)
+ {
+ $this->expression = $expression;
+ }
+}
@@ -0,0 +1,10 @@
+<?php
+
+class NodeHaving extends Node {
+ public $expression;
+
+ public function __construct($expression)
+ {
+ $this->expression = $expression;
+ }
+}
@@ -0,0 +1,3 @@
+<?php
+
+class NodeFunctionMaximum extends NodeFunction {}
@@ -0,0 +1,3 @@
+<?php
+
+class NodeFunctionMinimum extends NodeFunction {}
@@ -0,0 +1,3 @@
+<?php
+
+class Node {}
@@ -0,0 +1,3 @@
+<?php
+
+class NodeNumber extends NodePrimitive {}
@@ -0,0 +1,10 @@
+<?php
+
+class NodeOffset extends Node {
+ public $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+}
@@ -0,0 +1,3 @@
+<?php
+
+class NodeBinaryOr extends NodeBinary {}
@@ -0,0 +1,7 @@
+<?php
+
+class NodeOrdering extends Node
+{
+ const ASC = 0;
+ const DESC = 1;
+}
@@ -0,0 +1,11 @@
+<?php
+
+class NodePrimitive extends Node
+{
+ public $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+}
@@ -0,0 +1,18 @@
+<?php
+
+class NodeSelectStatement extends Node
+{
+ public $orders, $froms, $projections, $wheres, $groups, $having, $offset, $limit;
+
+ public function __construct()
+ {
+ $this->limit = NULL;
+ $this->offset = NULL;
+ $this->orders = array();
+ $this->froms = array();
+ $this->projections = array();
+ $this->wheres = array();
+ $this->groups = array();
+ $this->having = NULL;
+ }
+}
Oops, something went wrong.

0 comments on commit 888ab84

Please sign in to comment.