Skip to content

Commit

Permalink
Fix on SQLite fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
andrevanzuydam committed Dec 19, 2019
1 parent b3d8cbc commit ee6cccb
Show file tree
Hide file tree
Showing 91 changed files with 3,724 additions and 2,244 deletions.
3 changes: 1 addition & 2 deletions Tina4/DataSQLite3.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public function native_fetch($sql="", $noOfRecords=10, $offSet=0) {

$recordCursor = $this->dbh->query($sql);
$records = [];
for ($i = 0; $i < $noOfRecords; $i++ ) {
$recordArray = $recordCursor->fetchArray(SQLITE3_ASSOC);
while ($recordArray = $recordCursor->fetchArray(SQLITE3_ASSOC)) {
if (!empty($recordArray)) {
$records[] = (new DataRecord($recordArray));
}
Expand Down
16 changes: 14 additions & 2 deletions Tina4Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,21 @@ function __construct($config = null)
if (!defined("TINA4_PUT")) define("TINA4_PUT", "PUT");
if (!defined("TINA4_PATCH")) define("TINA4_PATCH", "PATCH");
if (!defined("TINA4_DELETE")) define("TINA4_DELETE", "DELETE");
if (!defined("TINA4_DOCUMENT_ROOT")) define ("TINA4_DOCUMENT_ROOT", null);

$debugBackTrace = debug_backtrace();
$callerFile = $debugBackTrace[0]["file"]; //calling file /.../.../index.php
$callerDir = str_replace("index.php", "", $callerFile);



//root of the website
$this->documentRoot = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR);
if (defined ("TINA4_DOCUMENT_ROOT") && empty(TINA4_DOCUMENT_ROOT)) {
$this->documentRoot = $callerDir;
//$this->documentRoot = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR);
} else {
$this->documentRoot = TINA4_DOCUMENT_ROOT;
}

if (file_exists("Tina4Php.php")) {
$this->documentRoot = realpath(dirname(__FILE__));
Expand All @@ -65,7 +77,7 @@ function __construct($config = null)
//root of tina4
$this->webRoot = realpath(dirname(__FILE__));

error_log("TINA4: web root " . $this->webRoot);
error_log("TINA4: web path " . $this->webRoot);

//check for composer defines
if (file_exists($this->webRoot . "/vendor/autoload.php")) {
Expand Down
38 changes: 20 additions & 18 deletions documentation/classes/Tina4.Any.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@
<ul class="dropdown-menu">
<li>
<a href="../reports/errors.html">
<i class="icon-list-alt"></i>&#160;Errors <span class="label label-info pull-right">184</span>
<i class="icon-list-alt"></i>&#160;Errors <span class="label label-info pull-right">77</span>
</a>
</li>
<li>
<a href="../reports/markers.html">
<i class="icon-list-alt"></i>&#160;Markers <span class="label label-info pull-right">2</span>
<i class="icon-list-alt"></i>&#160;Markers <span class="label label-info pull-right">2</span>
</a>
</li>
<li>
Expand All @@ -144,19 +144,19 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1126527988"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-923028282"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1126527988" class="accordion-body collapse in">
<div id="namespace-923028282" class="accordion-body collapse in">
<div class="accordion-inner">

<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-338352901"></a>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#namespace-333544713"></a>
<a href="../namespaces/Tina4.html" style="margin-left: 30px; padding-left: 0">Tina4</a>
</div>
<div id="namespace-338352901" class="accordion-body collapse ">
<div id="namespace-333544713" class="accordion-body collapse ">
<div class="accordion-inner">


Expand All @@ -179,6 +179,8 @@
<li class="class"><a href="../classes/Tina4.Patch.html">Patch</a></li>
<li class="class"><a href="../classes/Tina4.Post.html">Post</a></li>
<li class="class"><a href="../classes/Tina4.Put.html">Put</a></li>
<li class="class"><a href="../classes/Tina4.Request.html">Request</a></li>
<li class="class"><a href="../classes/Tina4.Response.html">Response</a></li>
<li class="class"><a href="../classes/Tina4.Route.html">Route</a></li>
<li class="class"><a href="../classes/Tina4.Routing.html">Routing</a></li>
</ul>
Expand Down Expand Up @@ -207,7 +209,8 @@
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a>

<h1><small>\Tina4</small>Any</h1>
<p><em>The Any route intercepts any type of call that can be made to the web server</em></p>
<p><em>Class Any Sets the $method variable in Class Route to ANY using the definition in Class Tina4Php
The Any route intercepts any type of call that can be made to the web server e.g. Any::add()</em></p>



Expand Down Expand Up @@ -300,13 +303,13 @@ <h2>Properties</h2>
<a id="property_method" name="property_method" class="anchor"></a>
<article class="property">
<h3 class="public ">$method</h3>
<pre class="signature">$method : </pre>
<pre class="signature">$method : string</pre>
<p><em></em></p>


<h4>Type</h4>

</article>
string
&mdash; Sets $method to ANY </article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
Expand All @@ -332,19 +335,19 @@ <h2>Tags</h2>
<article class="method">
<h3 class="public ">add()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">add( <span class="argument">$routePath</span>, <span class="argument">$function</span>) </pre>
<pre class="signature" style="margin-right: 54px;">add(string <span class="argument">$routePath</span>, resource <span class="argument">$function</span>) </pre>
<p><em>Add a route to be called on the web server</em></p>
<p>The routePath can contain variables or in-line parameters encapsulated with {} e.g. &quot;/test/{number}&quot;</p>

<h4>Parameters</h4>
<table class="table table-condensed table-hover">
<tr>
<td></td>
<td>string</td>
<td>$routePath </td>
<td><p>A valid html route</p></td>
</tr>
<tr>
<td></td>
<td>resource</td>
<td>$function </td>
<td><p>An anonymous function to handle the route called, has params based on inline params and $response, $request params by default</p></td>
</tr>
Expand Down Expand Up @@ -374,7 +377,7 @@ <h5></h5>
* @tags Hello World
* @summary Get a hello world test
*/
Get::add(&quot;/tests/routing&quot;, function($response){
Get::add(&quot;/cest/routing&quot;, function($response){

ob_start();
passthru(&quot;./codecept run&quot;);
Expand All @@ -383,12 +386,11 @@ <h5></h5>


return $response ($variable, 200, &quot;text/html&quot;);

});

Any::add(&quot;/tests/routing/any&quot;, function ($response){
Any::add(&quot;/cest/routing/any&quot;, function ($response, $request){

return $response (&quot;OK&quot;, 200);
return $response (&quot;OK&quot;. $request, 200);
});

</pre>
Expand Down Expand Up @@ -458,7 +460,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on August 31st, 2019 at 17:04.
on December 2nd, 2019 at 16:51.
</section>
</section>
</section>
Expand Down
Loading

0 comments on commit ee6cccb

Please sign in to comment.