PHP Classes

File: docs/syntax.php

Recommend this page to a friend!
  Classes of Temperini Mirko   APIQL   docs/syntax.php   Download  
File: docs/syntax.php
Role: Example script
Content type: text/plain
Description: The syntax to declare queries
Class: APIQL
Define and run commands of a data query language
Author: By
Last change:
Date: 12 years ago
Size: 3,420 bytes
 

Contents

Class file image Download
<?php
include 'functions.php';

html_header('Syntax');
function
dump_args($sql){showresults($sql);}
?>
Few rules to remember:

<ul>
    <li>
        Each block of query is separated from others with a / (as a path)...
        <br />
        <?php
        showcode
("apiql::register('!this/!is/!my/!test','myfunction');");
       
apiql::register('!this/!is/!my/!test','myfunction');
       
?>
<br /></li>

    <li>Each block of query can contains a-z(letters in upper and lower case), 0-9 (numbers), - , _ , and spaces (no tabs or return carriage and new linews)
        <?php
        showcode
("apiql::register('!this/!is/!a/!test','myfunction');");
       
apiql::register('!this/!is a/!test','myfunction');
       
showcode("apiql::register('!this is/!a/!test','myfunction');");
       
apiql::register('!this is/!a/!test','myfunction');
       
showcode("apiql::register('!this is a test','myfunction');");
       
apiql::register('!this is a test','myfunction');
       
showcode("apiql::register('!this-8 a test','myfunction');");
       
apiql::register('!this-8 a test','myfunction');
       
?>
<br /></li>
    <li>
    Each block of query must be ever preceduto by a `!` or a `?` indicating if is required or optional
    <?php
    showcode
("apiql::register('!tell me/?my name/?your name','print_r');");
   
apiql::register('!tell me/?my name/?your name','print_r');
    echo
"<br />";
   
showcode("apiql::query('tell me my name')");
   
apiql::query('tell me my name');
    echo
"<br /><br />";
   
showcode("apiql::query('tell me your name')");
   
apiql::query('tell me your name');
    echo
"<br /><br />";
   
showcode("apiql::query('tell me my name your name')");
   
apiql::query('tell me my name your name');
   
?>
<br /><br /></li>
    <li>Each block can accept an argument that can be an array,JSON,boolean,string,and php code.<br />
        you can accept any of them, specifing it in [] parenthesis,and separated by comma
        <?php
        apiql
::set('display_errors',true);
       
showcode("
function dump_args(\$sql){return \$sql;}

apiql::register('!dump/!argument[null,boolean,string,array,json,php]','dump_args');"
);
       
apiql::register('!dump/!argument[null,boolean,string,array,json,php]','dump_args');
       
       
showcode("apiql::query(\"dump argument null\")");
       
apiql::query("dump argument null");

       
showcode("apiql::query(\"dump argument true\")");
       
apiql::query("dump argument true");

       
showcode("apiql::query(\"dump argument 'my string'\")");
       
apiql::query("dump argument 'my string'");

       
showcode("apiql::query(\"dump argument '39'\")");
       
apiql::query("dump argument '39'");

       
showcode("apiql::query(\"dump argument [0,\\\"bar\\\",\\\"foo\\\",false,null]\")");
       
apiql::query("dump argument [0,\"bar\",\"foo\",false,null]");

       
showcode("apiql::query(\"dump argument {foo:bar,'name':'bill',age: 25,married:false}\")");
       
apiql::query("dump argument {foo:bar,'name':'bill',age: 25,married:false}");

       
showcode("apiql::query(\"dump argument ( 1==1 and \\\$foo == \\\$bar && is_object(\\\$obj) )\")");
       
apiql::query("dump argument (1==1 and \$foo == \$bar && is_object(\$obj))");

       
?>
</li>
<?php
html_footer
();
?>