More method simplification
This commit is contained in:
parent
008e65a872
commit
dc0a8b7bc1
10
autoload.php
10
autoload.php
@ -20,12 +20,12 @@
|
||||
/**
|
||||
* Reference to root path
|
||||
*/
|
||||
define('BASE_PATH', dirname(__FILE__).'/');
|
||||
define('QBASE_PATH', dirname(__FILE__).'/');
|
||||
|
||||
/**
|
||||
* Path to driver classes
|
||||
*/
|
||||
define('DRIVER_PATH', BASE_PATH.'drivers/');
|
||||
define('QDRIVER_PATH', QBASE_PATH.'drivers/');
|
||||
|
||||
if ( ! function_exists('do_include'))
|
||||
{
|
||||
@ -43,12 +43,12 @@ if ( ! function_exists('do_include'))
|
||||
}
|
||||
|
||||
// Load base classes
|
||||
array_map('do_include', glob(BASE_PATH.'classes/*.php'));
|
||||
array_map('do_include', glob(QBASE_PATH.'classes/*.php'));
|
||||
|
||||
// Load PDO Drivers
|
||||
foreach(pdo_drivers() as $d)
|
||||
{
|
||||
$dir = DRIVER_PATH.$d;
|
||||
$dir = QDRIVER_PATH.$d;
|
||||
|
||||
if(is_dir($dir))
|
||||
{
|
||||
@ -59,7 +59,7 @@ foreach(pdo_drivers() as $d)
|
||||
// Load Firebird driver, if applicable
|
||||
if (function_exists('fbird_connect'))
|
||||
{
|
||||
array_map('do_include', glob(DRIVER_PATH.'/firebird/*.php'));
|
||||
array_map('do_include', glob(QDRIVER_PATH.'/firebird/*.php'));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -397,19 +397,20 @@ class Query_Builder {
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Creates a Like clause in the sql statement
|
||||
* Simplify 'like' methods
|
||||
*
|
||||
* @param string $field
|
||||
* @param mixed $val
|
||||
* @param string $pos
|
||||
* @return $this
|
||||
* @param string $like
|
||||
* @param string $conj
|
||||
*/
|
||||
public function like($field, $val, $pos='both')
|
||||
private function _like($field, $val, $pos, $like='LIKE', $conj='AND')
|
||||
{
|
||||
$field = $this->quote_ident($field);
|
||||
|
||||
// Add the like string into the order map
|
||||
$l = $field. ' LIKE ?';
|
||||
$l = $field. " {$like} ?";
|
||||
|
||||
if ($pos == 'before')
|
||||
{
|
||||
@ -426,13 +427,27 @@ class Query_Builder {
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'like',
|
||||
'conjunction' => (empty($this->query_map)) ? 'WHERE ' : ' AND ',
|
||||
'conjunction' => (empty($this->query_map)) ? 'WHERE ' : " {$conj} ",
|
||||
'string' => $l
|
||||
);
|
||||
|
||||
// Add to the values array
|
||||
$this->values[] = $val;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Creates a Like clause in the sql statement
|
||||
*
|
||||
* @param string $field
|
||||
* @param mixed $val
|
||||
* @param string $pos
|
||||
* @return $this
|
||||
*/
|
||||
public function like($field, $val, $pos='both')
|
||||
{
|
||||
$this->_like($field, $val, $pos);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -448,21 +463,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function or_like($field, $val, $pos='both')
|
||||
{
|
||||
// Do the like method
|
||||
$this->like($field, $val, $pos);
|
||||
|
||||
$l = $field. ' LIKE ?';
|
||||
|
||||
// Pop the incorrect query mapping off of the array
|
||||
array_pop($this->query_map);
|
||||
|
||||
// Add the like string into the order map
|
||||
$this->query_map[] = array(
|
||||
'type' => 'like',
|
||||
'conjunction' => (empty($this->query_map)) ? 'WHERE ' : ' OR ',
|
||||
'string' => $l
|
||||
);
|
||||
|
||||
$this->_like($field, $val, $pos, 'LIKE', 'OR');
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -478,21 +479,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function not_like($field, $val, $pos='both')
|
||||
{
|
||||
// Do the like method
|
||||
$this->like($field, $val, $pos);
|
||||
|
||||
// Pop the incorrect query mapping off of the array
|
||||
array_pop($this->query_map);
|
||||
|
||||
// Add the like string into the order map
|
||||
$l = $field. ' NOT LIKE ?';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'like',
|
||||
'conjunction' => (empty($this->query_map)) ? ' WHERE ' : ' AND ',
|
||||
'string' => $l
|
||||
);
|
||||
|
||||
$this->_like($field, $val, $pos, 'NOT LIKE');
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -508,21 +495,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function or_not_like($field, $val, $pos='both')
|
||||
{
|
||||
// Do the like method
|
||||
$this->like($field, $val, $pos);
|
||||
|
||||
// Pop the incorrect query mapping off of the array
|
||||
array_pop($this->query_map);
|
||||
|
||||
// Add the like string into the order map
|
||||
$l = $field. ' NOT LIKE ?';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'like',
|
||||
'conjunction' => (empty($this->query_map)) ? ' WHERE ' : ' OR ',
|
||||
'string' => $l
|
||||
);
|
||||
|
||||
$this->_like($field, $val, $pos, 'NOT LIKE', 'OR');
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -632,6 +605,36 @@ class Query_Builder {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Simplify where_in methods
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $val
|
||||
* @param string
|
||||
* @param string
|
||||
* @return void
|
||||
*/
|
||||
private function _where_in($key, $val=array(), $in='IN', $conj='AND')
|
||||
{
|
||||
$field = $this->quote_ident($field);
|
||||
$params = array_fill(0, count($val), '?');
|
||||
|
||||
foreach($val as $v)
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
$string = $field . " {$in} ".implode(',', $params).') ';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'where_in',
|
||||
'conjunction' => ( ! empty($this->query_map)) ? " {$conj} " : ' WHERE ',
|
||||
'string' => $string
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Specify condition(s) in the where clause of a query
|
||||
* Note: this function works with key / value, or a
|
||||
@ -720,22 +723,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function where_in($field, $val=array())
|
||||
{
|
||||
$field = $this->quote_ident($field);
|
||||
$params = array_fill(0, count($val), '?');
|
||||
|
||||
foreach($val as $v)
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
$string = $field . ' IN ('.implode(',', $params).') ';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'where_in',
|
||||
'conjunction' => ( ! empty($this->query_map)) ? ' AND ' : ' WHERE ',
|
||||
'string' => $string
|
||||
);
|
||||
|
||||
$this->_where_in($field, $val);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -750,23 +738,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function or_where_in($field, $val=array())
|
||||
{
|
||||
// Do the were_in method
|
||||
$this->where_in($field, $val);
|
||||
|
||||
// Pop the incorrect query mapping off of the array
|
||||
array_pop($this->query_map);
|
||||
|
||||
$field = $this->quote_ident($field);
|
||||
$params = array_fill(0, count($val), '?');
|
||||
|
||||
$string = $field . ' IN ('.implode(',', $params).') ';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'where_in',
|
||||
'conjunction' => ( ! empty($this->query_map)) ? ' OR ' : ' WHERE ',
|
||||
'string' => $string
|
||||
);
|
||||
|
||||
$this->_where_in($field, $val, 'IN', 'OR');
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -781,22 +753,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function where_not_in($field, $val=array())
|
||||
{
|
||||
$field = $this->quote_ident($field);
|
||||
$params = array_fill(0, count($val), '?');
|
||||
|
||||
foreach($val as $v)
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
$string = $field.' NOT IN ('.implode(',', $params).') ';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'where_in',
|
||||
'conjunction' => ( ! empty($this->query_map)) ? ' AND ' : ' WHERE ',
|
||||
'string' => $string
|
||||
);
|
||||
|
||||
$this->_where_in($field, $val, 'NOT IN', 'AND');
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -811,22 +768,7 @@ class Query_Builder {
|
||||
*/
|
||||
public function or_where_not_in($field, $val=array())
|
||||
{
|
||||
$field = $this->quote_ident($field);
|
||||
$params = array_fill(0, count($val), '?');
|
||||
|
||||
foreach($val as $v)
|
||||
{
|
||||
$this->values[] = $v;
|
||||
}
|
||||
|
||||
$string = $field.' NOT IN ('.implode(',', $params).') ';
|
||||
|
||||
$this->query_map[] = array(
|
||||
'type' => 'where_in',
|
||||
'conjunction' => ( ! empty($this->query_map)) ? ' OR ' : ' WHERE ',
|
||||
'string' => $string
|
||||
);
|
||||
|
||||
$this->_where_in($field, $val, 'NOT IN', 'OR');
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -662,7 +662,7 @@ the connection/database</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -151,7 +151,7 @@ and organizes database connections</p></p>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -268,7 +268,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -208,7 +208,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -812,7 +812,7 @@ the last query executed</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -503,7 +503,7 @@ the query</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -296,7 +296,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -211,7 +211,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -848,7 +848,7 @@ the connection/database</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -280,7 +280,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -207,7 +207,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -850,7 +850,7 @@ the connection/database</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -280,7 +280,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -202,7 +202,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -850,7 +850,7 @@ the connection/database</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -296,7 +296,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -207,7 +207,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -107,9 +107,11 @@ passed array with key / value pairs</span><pre>where()</pre></a></li>
|
||||
<li class="method public "><a href="#where_not_in" title="where_not_in :: WHERE NOT IN (FOO) clause"><span class="description">WHERE NOT IN (FOO) clause</span><pre>where_not_in()</pre></a></li>
|
||||
<li class="nav-header private">» Private</li>
|
||||
<li class="method private "><a href="#_compile" title="_compile :: String together the sql statements for sending to the db"><span class="description">String together the sql statements for sending to the db</span><pre>_compile()</pre></a></li>
|
||||
<li class="method private "><a href="#_like" title="_like :: Simplify 'like' methods"><span class="description">Simplify 'like' methods</span><pre>_like()</pre></a></li>
|
||||
<li class="method private "><a href="#_reset" title="_reset :: Clear out the class variables, so the next query can be run"><span class="description">Clear out the class variables, so the next query can be run</span><pre>_reset()</pre></a></li>
|
||||
<li class="method private "><a href="#_select" title="_select :: Method to simplify select_ methods"><span class="description">Method to simplify select_ methods</span><pre>_select()</pre></a></li>
|
||||
<li class="method private "><a href="#_where" title="_where :: Do all the repeditive stuff for where/having type methods"><span class="description">Do all the repeditive stuff for where/having type methods</span><pre>_where()</pre></a></li>
|
||||
<li class="method private "><a href="#_where_in" title="_where_in :: Simplify where_in methods"><span class="description">Simplify where_in methods</span><pre>_where_in()</pre></a></li>
|
||||
<li class="nav-header">
|
||||
<i class="icon-custom icon-property"></i> Properties</li>
|
||||
<li class="property public "><a href="#%24conn_name" title="$conn_name :: Convenience property for connection management"><span class="description">Convenience property for connection management</span><pre>$conn_name</pre></a></li>
|
||||
@ -949,6 +951,35 @@ passed array with key / value pairs</h2>
|
||||
<div class="subelement response"><code>\$string</code></div>
|
||||
</div></div>
|
||||
</div>
|
||||
<a name="_like" id="_like"></a><div class="element clickable method private _like" data-toggle="collapse" data-target="._like .collapse">
|
||||
<h2>Simplify 'like' methods</h2>
|
||||
<pre>_like(string $field, mixed $val, string $pos, string $like, string $conj) </pre>
|
||||
<div class="labels"></div>
|
||||
<div class="row collapse"><div class="span8">
|
||||
<p class="long_description"></p>
|
||||
<h3>Parameters</h3>
|
||||
<div class="subelement argument">
|
||||
<h4>$field</h4>
|
||||
<code>string</code>
|
||||
</div>
|
||||
<div class="subelement argument">
|
||||
<h4>$val</h4>
|
||||
<code>mixed</code>
|
||||
</div>
|
||||
<div class="subelement argument">
|
||||
<h4>$pos</h4>
|
||||
<code>string</code>
|
||||
</div>
|
||||
<div class="subelement argument">
|
||||
<h4>$like</h4>
|
||||
<code>string</code>
|
||||
</div>
|
||||
<div class="subelement argument">
|
||||
<h4>$conj</h4>
|
||||
<code>string</code>
|
||||
</div>
|
||||
</div></div>
|
||||
</div>
|
||||
<a name="_reset" id="_reset"></a><div class="element clickable method private _reset" data-toggle="collapse" data-target="._reset .collapse">
|
||||
<h2>Clear out the class variables, so the next query can be run</h2>
|
||||
<pre>_reset() </pre>
|
||||
@ -993,6 +1024,29 @@ passed array with key / value pairs</h2>
|
||||
<div class="subelement response"><code>array</code></div>
|
||||
</div></div>
|
||||
</div>
|
||||
<a name="_where_in" id="_where_in"></a><div class="element clickable method private _where_in" data-toggle="collapse" data-target="._where_in .collapse">
|
||||
<h2>Simplify where_in methods</h2>
|
||||
<pre>_where_in(mixed $key, mixed $val, $in, $conj) : void</pre>
|
||||
<div class="labels"></div>
|
||||
<div class="row collapse"><div class="span8">
|
||||
<p class="long_description"></p>
|
||||
<h3>Parameters</h3>
|
||||
<div class="subelement argument">
|
||||
<h4>$key</h4>
|
||||
<code>mixed</code>
|
||||
</div>
|
||||
<div class="subelement argument">
|
||||
<h4>$val</h4>
|
||||
<code>mixed</code>
|
||||
</div>
|
||||
<div class="subelement argument">
|
||||
<h4>$in</h4>
|
||||
<code></code><p>string</p></div>
|
||||
<div class="subelement argument">
|
||||
<h4>$conj</h4>
|
||||
<code></code><p>string</p></div>
|
||||
</div></div>
|
||||
</div>
|
||||
<h3>
|
||||
<i class="icon-custom icon-property"></i> Properties</h3>
|
||||
<a name="%24conn_name" id="$conn_name"> </a><div class="element clickable property public $conn_name" data-toggle="collapse" data-target=".$conn_name .collapse">
|
||||
@ -1099,7 +1153,7 @@ for complex select queries</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -865,7 +865,7 @@ method if the database does not support 'TRUNCATE';</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -280,7 +280,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -207,7 +207,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -243,7 +243,7 @@ directly - the settings should be safe!</h2>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -66,7 +66,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -92,7 +92,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -63,7 +63,7 @@
|
||||
</script><div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -68,7 +68,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -264,15 +264,15 @@ instantiates the specific db driver</p>
|
||||
</div>
|
||||
<h3>
|
||||
<i class="icon-custom icon-constant"></i> Constants</h3>
|
||||
<a name="BASE_PATH" id="BASE_PATH"> </a><div class="element clickable constant BASE_PATH" data-toggle="collapse" data-target=".BASE_PATH .collapse">
|
||||
<a name="QBASE_PATH" id="QBASE_PATH"> </a><div class="element clickable constant QBASE_PATH" data-toggle="collapse" data-target=".QBASE_PATH .collapse">
|
||||
<h2>Reference to root path</h2>
|
||||
<pre>BASE_PATH </pre>
|
||||
<pre>QBASE_PATH </pre>
|
||||
<div class="labels"></div>
|
||||
<div class="row collapse"><div class="span8"><p class="long_description"></p></div></div>
|
||||
</div>
|
||||
<a name="DRIVER_PATH" id="DRIVER_PATH"> </a><div class="element clickable constant DRIVER_PATH" data-toggle="collapse" data-target=".DRIVER_PATH .collapse">
|
||||
<a name="QDRIVER_PATH" id="QDRIVER_PATH"> </a><div class="element clickable constant QDRIVER_PATH" data-toggle="collapse" data-target=".QDRIVER_PATH .collapse">
|
||||
<h2>Path to driver classes</h2>
|
||||
<pre>DRIVER_PATH </pre>
|
||||
<pre>QDRIVER_PATH </pre>
|
||||
<div class="labels"></div>
|
||||
<div class="row collapse"><div class="span8"><p class="long_description"></p></div></div>
|
||||
</div>
|
||||
@ -282,7 +282,7 @@ instantiates the specific db driver</p>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -66,7 +66,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -61,8 +61,8 @@
|
||||
</li>
|
||||
<li class="nav-header">
|
||||
<i class="icon-custom icon-constant"></i> Constants</li>
|
||||
<li class="constant "><a href="#BASE_PATH" title="BASE_PATH :: Reference to root path"><span class="description">Reference to root path</span><pre>BASE_PATH</pre></a></li>
|
||||
<li class="constant "><a href="#DRIVER_PATH" title="DRIVER_PATH :: Path to driver classes"><span class="description">Path to driver classes</span><pre>DRIVER_PATH</pre></a></li>
|
||||
<li class="constant "><a href="#QBASE_PATH" title="QBASE_PATH :: Reference to root path"><span class="description">Reference to root path</span><pre>QBASE_PATH</pre></a></li>
|
||||
<li class="constant "><a href="#QDRIVER_PATH" title="QDRIVER_PATH :: Path to driver classes"><span class="description">Path to driver classes</span><pre>QDRIVER_PATH</pre></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span8 package-contents">
|
||||
@ -75,15 +75,15 @@
|
||||
<div class="package-indent">
|
||||
<h3>
|
||||
<i class="icon-custom icon-constant"></i> Constants</h3>
|
||||
<a name="BASE_PATH" id="BASE_PATH"> </a><div class="element clickable constant BASE_PATH" data-toggle="collapse" data-target=".BASE_PATH .collapse">
|
||||
<a name="QBASE_PATH" id="QBASE_PATH"> </a><div class="element clickable constant QBASE_PATH" data-toggle="collapse" data-target=".QBASE_PATH .collapse">
|
||||
<h2>Reference to root path</h2>
|
||||
<pre>BASE_PATH </pre>
|
||||
<pre>QBASE_PATH </pre>
|
||||
<div class="labels"></div>
|
||||
<div class="row collapse"><div class="span8"><p class="long_description"></p></div></div>
|
||||
</div>
|
||||
<a name="DRIVER_PATH" id="DRIVER_PATH"> </a><div class="element clickable constant DRIVER_PATH" data-toggle="collapse" data-target=".DRIVER_PATH .collapse">
|
||||
<a name="QDRIVER_PATH" id="QDRIVER_PATH"> </a><div class="element clickable constant QDRIVER_PATH" data-toggle="collapse" data-target=".QDRIVER_PATH .collapse">
|
||||
<h2>Path to driver classes</h2>
|
||||
<pre>DRIVER_PATH </pre>
|
||||
<pre>QDRIVER_PATH </pre>
|
||||
<div class="labels"></div>
|
||||
<div class="row collapse"><div class="span8"><p class="long_description"></p></div></div>
|
||||
</div>
|
||||
@ -93,7 +93,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -210,7 +210,7 @@ data-fetching methods</p>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -96,7 +96,7 @@
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -114,7 +114,7 @@ instantiates the specific db driver</p>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -315,7 +315,7 @@ instantiates the specific db driver</p>
|
||||
<div class="row"><footer class="span12">
|
||||
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
|
||||
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a2</a> and<br>
|
||||
generated on 2012-04-30T15:29:34-04:00.<br></footer></div>
|
||||
generated on 2012-04-30T16:05:55-04:00.<br></footer></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
BIN
tests/TEST_DIRDSdb_filesDStest_sqlite.db
Normal file
BIN
tests/TEST_DIRDSdb_filesDStest_sqlite.db
Normal file
Binary file not shown.
@ -22,7 +22,7 @@ class FirebirdQBTest extends QBTest {
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$dbpath = TEST_DIR.DS.'db_files'.DS.'FB_TEST_DB.FDB';
|
||||
$dbpath = QTEST_DIR.QDS.'db_files'.QDS.'FB_TEST_DB.FDB';
|
||||
|
||||
// Test the query builder
|
||||
$params = new Stdclass();
|
||||
|
@ -22,7 +22,7 @@ class FirebirdTest extends DBTest {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$dbpath = TEST_DIR.DS.'db_files'.DS.'FB_TEST_DB.FDB';
|
||||
$dbpath = QTEST_DIR.QDS.'db_files'.QDS.'FB_TEST_DB.FDB';
|
||||
|
||||
// Test the db driver directly
|
||||
$this->db = new Firebird('localhost:'.$dbpath);
|
||||
|
@ -20,9 +20,9 @@ class MySQLQBTest extends QBTest {
|
||||
parent::__construct();
|
||||
|
||||
// Attempt to connect, if there is a test config file
|
||||
if (is_file(BASE_DIR . "test_config.json"))
|
||||
if (is_file(QBASE_DIR . "test_config.json"))
|
||||
{
|
||||
$params = json_decode(file_get_contents(BASE_DIR . "test_config.json"));
|
||||
$params = json_decode(file_get_contents(QBASE_DIR . "test_config.json"));
|
||||
$params = $params->mysql;
|
||||
$params->type = "mysql";
|
||||
|
||||
|
@ -23,9 +23,9 @@ class MySQLTest extends DBTest {
|
||||
public function setUp()
|
||||
{
|
||||
// Attempt to connect, if there is a test config file
|
||||
if (is_file(BASE_DIR . "test_config.json"))
|
||||
if (is_file(QBASE_DIR . "test_config.json"))
|
||||
{
|
||||
$params = json_decode(file_get_contents(BASE_DIR . "test_config.json"));
|
||||
$params = json_decode(file_get_contents(QBASE_DIR . "test_config.json"));
|
||||
$params = $params->mysql;
|
||||
|
||||
$this->db = new MySQL("host={$params->host};port={$params->port};dbname={$params->database}", $params->user, $params->pass);
|
||||
|
@ -19,9 +19,9 @@ class PgSQLQBTest extends QBTest {
|
||||
parent::__construct();
|
||||
|
||||
// Attempt to connect, if there is a test config file
|
||||
if (is_file(BASE_DIR . "test_config.json"))
|
||||
if (is_file(QBASE_DIR . "test_config.json"))
|
||||
{
|
||||
$params = json_decode(file_get_contents(BASE_DIR . "test_config.json"));
|
||||
$params = json_decode(file_get_contents(QBASE_DIR . "test_config.json"));
|
||||
$params = $params->pgsql;
|
||||
$params->type = "pgsql";
|
||||
|
||||
|
@ -29,9 +29,9 @@ class PgTest extends DBTest {
|
||||
public function setUp()
|
||||
{
|
||||
// Attempt to connect, if there is a test config file
|
||||
if (is_file(BASE_DIR . "test_config.json"))
|
||||
if (is_file(QBASE_DIR . "test_config.json"))
|
||||
{
|
||||
$params = json_decode(file_get_contents(BASE_DIR . "test_config.json"));
|
||||
$params = json_decode(file_get_contents(QBASE_DIR . "test_config.json"));
|
||||
$params = $params->pgsql;
|
||||
|
||||
$this->db = new PgSQL("host={$params->host};port={$params->port};dbname={$params->database}", $params->user, $params->pass);
|
||||
|
@ -21,7 +21,7 @@
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$path = TEST_DIR.DS.'db_files'.DS.'test_sqlite.db';
|
||||
$path = QTEST_DIR.QDS.'db_files'.QDS.'test_sqlite.db';
|
||||
$params = new Stdclass();
|
||||
$params->type = 'sqlite';
|
||||
$params->file = $path;
|
||||
|
@ -28,7 +28,7 @@ class SQLiteTest extends UnitTestCase {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$path = TEST_DIR.DS.'db_files'.DS.'test_sqlite.db';
|
||||
$path = QTEST_DIR.QDS.'db_files'.QDS.'test_sqlite.db';
|
||||
$this->db = new SQLite($path);
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -16,27 +16,27 @@
|
||||
/**
|
||||
* Unit test bootstrap - Using php simpletest
|
||||
*/
|
||||
define('TEST_DIR', dirname(__FILE__));
|
||||
define('BASE_DIR', str_replace(basename(TEST_DIR), '', TEST_DIR));
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
define('QTEST_DIR', dirname(__FILE__));
|
||||
define('QBASE_DIR', str_replace(basename(QTEST_DIR), '', QTEST_DIR));
|
||||
define('QDS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// Include simpletest
|
||||
// it has to be set in your php path, or put in the tests folder
|
||||
require_once('simpletest/autorun.php');
|
||||
|
||||
// Include db classes
|
||||
require_once(BASE_DIR . 'autoload.php');
|
||||
require_once(QBASE_DIR . 'autoload.php');
|
||||
|
||||
// Require base testing classes
|
||||
require_once(TEST_DIR . '/core/core.php');
|
||||
require_once(TEST_DIR . '/core/settings.php');
|
||||
require_once(TEST_DIR . '/core/db_test.php');
|
||||
require_once(TEST_DIR . '/core/db_qb_test.php');
|
||||
require_once(QTEST_DIR . '/core/core.php');
|
||||
require_once(QTEST_DIR . '/core/settings.php');
|
||||
require_once(QTEST_DIR . '/core/db_test.php');
|
||||
require_once(QTEST_DIR . '/core/db_qb_test.php');
|
||||
|
||||
// Include db tests
|
||||
// Load db classes based on capability
|
||||
$src_path = BASE_DIR.'drivers/';
|
||||
$test_path = TEST_DIR.'/databases/';
|
||||
$src_path = QBASE_DIR.'drivers/';
|
||||
$test_path = QTEST_DIR.'/databases/';
|
||||
|
||||
foreach(pdo_drivers() as $d)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user