[phplib-dev] cvs commit From: ssilk (phplib-dev <email protected>)
Date: 05/07/00

From: ssilk
Date: Mon May 8 03:52:08 2000
Modified files:
      php-lib/php/query_sql.inc

Log message:
Many, many changes. Some untested... most things will word. I call this beta.

Index: php-lib/php/query_sql.inc
diff -u php-lib/php/query_sql.inc:1.16 php-lib/php/query_sql.inc:1.17
--- php-lib/php/query_sql.inc:1.16 Mon Apr 3 01:47:00 2000
+++ php-lib/php/query_sql.inc Mon May 8 03:51:37 2000
@@ -18,7 +18,7 @@
  * is based in November 1997,
  * it was a collection of functions for PHP/FI and mSQL.
  *
- * $Id: query_sql.inc,v 1.16 2000/04/02 23:47:00 ssilk Exp $
+ * $Id: query_sql.inc,v 1.17 2000/05/08 01:51:37 ssilk Exp $
  *
  */
 
@@ -26,79 +26,7 @@
 ## Query-class is ALWAYS an extension to the DB_Sql-class!
 ## See PHPLib-documention to use it!
 
-/*
-Some general information about this class:
 
-1.
-Currently we cannot guarantee, that the result of a former
-query()-call is not overwritten. That means, that this for example
-dosn't work:
- $db->query("select * from bla");
- while ($db->next_record()) {
- $iu=$db->iu_clause("blubb",$db->Record);
- }
-This is cause iu_clause uses query() for itself, because currently
-Query-class cannot instanciate itself. In practice this is no problem
-at all, cause by normal you need for the above constructs always
-2 instantiations of the class.
-
-2.
-Some function do have those 3 params:
- function some_clause ($table,$fields,$special,.....)
-$table is the name of the table in your DB you want to create a clause for.
-$fields is an associative array like
- $fields=ARRAY (
- first_name=>'Alexander',
- last_name =>'Aulbach',
- email =>'ssilk <email protected>',
- bla =>'NULL')
-Every unset value is handled by normal as NULL or "Don't Change"
-(except the _plain_-functions or bugs :) !.
-
-But there are some other exceptions: if the field "bla" is defined
-as an integer it is the same as unseting "bla". But if it is a string
-the string "NULL" is taken (because otherwise you cannot insert this value
-to any of your tables).
-
-The $special array was invented cause of having more control about this.
-Seting
- $special=ARRAY(bla => 'NULL')
-will force bla the value NULL, not the string "NULL". This depends also
-the update-clauses, setting $special to 'NULL' will force an update for
-this field to the value NULL, instead of leaving it untouched if you don't
-set the field.
-
-[thinking about a value 'NOTOUCH' for update-clauses]
-
-You can also force a value to be taken unchanged, no matter if it is
-a string or integer or whatever. For example:
- $fields=ARRAY(bla=>'SYSDATE()',blubb=>'hugobla');
- $special=ARRAY(bla=>'func');
- echo $db->insert_plain_clause("test",$fields,$special);
-outputs
- INSERT INTO test (bla,blubb) VALUES (SYSDATE(),'hugobla')
-Any other value than "NULL" or "function" must be a data-type. Query
-knows currently 3 types, namely: "string", "int" and "double". Setting
-the special-array to those values means to force the conversion to
-this data-type.
-
-3.
-The $where parameter for EVERY function call needs not to have an
-including "WHERE", you can just begin with "a=1 and b='x' ...".
-
-4.
-The $params-parameter was for most function formerly the $check-parameter.
-To be upward compatible and for more comfort we made this agreement:
-If $params is a string, this means, that it is the $check-value, if it is an
-array you need to make it associative, e.g.:
- $params=ARRAY(check=>'weak',forceinsert=>true)
-
-5.
-We will NOT EXPLAIN this any more in the rest of the program. :)
-
-*/
-
-
 class Query extends DB_Sql {
 
         ## DONT FORGET to set the variables from DB_Sql! See there!
@@ -154,11 +82,12 @@
         var $fireball_replace_char = "_";
 
 
- ## PRIVATE FUNCTIONS ##
+ ## (MORE OR LESS) PRIVATE FUNCTIONS ##
 
 
         ###########################
         ## _QDebug
+ ## ( string $str )
         function _QDebug ($str) {
                 if ($this->Q_Debug) {
                         printf($this->Q_Debug_print,$str);
@@ -168,14 +97,15 @@
         ###########################
         ## Set DB-Classname
         ## This is only a 3rd posibility for setting the classname
- ##
+ ## ( string $db_class )
         function set_db_class ($db_class) {
                 $this->Database=$db_class;
         }
 
 
         ###########################
- ##
+ ## (array $meta)
+ ## : array( php_type , php_subtype )
         function sql2phptype ($meta) {
                 if (!$meta[php_type])
                         $this->halt("sql2phptype(): php_type is empty!");
@@ -186,25 +116,15 @@
         #######################################
         ## This function returns a PHP-variable depending
         ## on type. E.g. a string is returned as 'string'
- ##
- ## The parameters mean
+ ## (
         ## $val - the value
- ## There is a special case: If value is "NULL" and
- ## the type is not "string" or subtype is empty, then
- ## a value "NULL" is inserted. This let you just spare
- ## a little bit work with $special
- ##
- ## $meta - the meta information for this field (that's what
+ ## array $meta - the meta information for this field (that's what
         ## is returned by metadata() from DB_sql-class, but just one
         ## single row, e.g. $meta[2], not hole $meta).
- ##
- ## $special - Overwrites the type of the var if set. Some special
- ## meanings:
- ## "NULL" means, that this value must be set to "NULL"
- ## "func" means, that $val should be untouched -
- ## e.g. to insert the value of a SQL-function
- ## [ INSERT INTO bla VALUES ( time=NOW() ) ]
- ##
+ ## enum $special - Overwrites the type of the var if set.
+ ## NULL | func | string | int | double
+ ## )
+ ## : array( converted SQL-value , fieldname )
 
         function convert ($val,$meta,$special="") {
                 list($type,$subtype)=$this->sql2phptype($meta);
@@ -279,7 +199,8 @@
         ##
         ## Check params
         ## internal function, which returns an array of splitted parameters
- ##
+ ## ( array or string $params )
+ ## : array ( array ($params) , string $check )
         function chkprms ($params) {
                 if (!is_Array($params)) {
                         $check=strtolower($params);
@@ -297,10 +218,9 @@
         ##
         ## This functions checks out the situation, that $p1 or $p2 is
         ## the special-array and $p2 or $p1 is a where-Parameter
- ## in every possible sitation ($p1 not set, $p2 not set etc)
- ## and it returns an array ($special,$where)
         ## perhaps this could be done better, but I made this in 2 minutes.
- ##
+ ## ( array or string $p1, array or string $p2 )
+ ## : array ( array ( $special) , string $where )
         function special_or_where ($p1,$p2='') {
                 $special=ARRAY();
                 $where='';
@@ -319,10 +239,10 @@
                 } elseif (empty($p1) && empty($p2)) {
                         # do nothing
                 } else {
- if (is_Array($p1) && (strlen($p1) > 2)) {
+ if (is_Array($p1) && (strlen($p2) > 2)) {
                                 $special=$p1;
                                 $where=$p2;
- } elseif (is_Array($p2) && (strlen($p2) > 2)) {
+ } elseif (is_Array($p2) && (strlen($p1) > 2)) {
                                 $special=$p2;
                                 $where=$p1;
                         } else {
@@ -336,7 +256,8 @@
         ## uniform where-clause
         ## brings the where clause form
         ## " WHERE blablablabla"; which is used everywhere in Query
- ##
+ ## ( string $where )
+ ## : string $where
         function uniform_where ($where) {
                 if (!empty($where)) {
                         $where=trim($where);
@@ -353,7 +274,8 @@
         ## uniforms $fields with $special
         ## returns an array of values and (converted) names
         ## Perhaps we can use $special for renaming those names?
- ##
+ ## ( array $meta , array $fields , array $special )
+ ## : array (array ($vals) , array($names) )
         function uniform_vars (&$meta,&$fields,&$special) {
                 for (reset($fields); list($key,$val)=each($fields); ) {
                         if ( isset($meta[meta][$key]) ) {
@@ -362,6 +284,8 @@
                                      $this->convert($val,$meta[$j],$special[$key]);
                         }
                 }
+ # add information for $special-fields which are not used
+ # in the above loop
                 for (reset($special); list($key,$val)=each($special); ) {
                         if ( isset($meta[meta][$key]) && empty($fields[$key]) ) {
                                 $j=$meta[meta][$key];
@@ -373,16 +297,10 @@
         }
 
         ##
- ## metadata_buffered (internal)
- ##
- ## This function calls metadata() if it won't find the buffer,
- ## this speeds the Query-class strongly up, cause it is needed in
- ## many functions
- ##
- ## $table the name of the table
- ##
- ## Returns the metadata-field
- ##
+ ## metadata_buffered
+ ## This function calls metadata() if it won't find the buffer
+ ## (string $table)
+ ## : array ($meta)
         function metadata_buffered($table) {
                 if ( !is_Array($this->meta_buf[$table]) || $this->meta_cache_off) {
                         return ($this->meta_buf[$table]=$this->metadata($table,true));
@@ -399,17 +317,15 @@
 
         ##
         ## Function to generate an INSERT-Clause
- ##
- ## $fields is an assoc. Array consisting out of
- ## table_name => value-pairs
- ## $special is an assoc. field which will commit special
- ## handling to convert() (See there)
- ## $params
- ## currently not used.
- ##
- ## returns the insert clause. It's on you to modify it
- ## and send it to your DB
- ##
+ ## (
+ ## string $table tablename
+ ## array $fields is an assoc. Array consisting out of
+ ## table_name => value-pairs
+ ## array $special is an assoc. field which will commit special
+ ## handling to convert() (See there)
+ ## array or string $params currently not used.
+ ## )
+ ## : string insert-clause
         function insert_Clause ($table,$fields,$special='',$params="soft") {
                 if (empty($special)) $special=ARRAY();
                 list($params,$check)=$this->chkprms($params);
@@ -428,30 +344,17 @@
         ##
         ## Function to generate a plain INSERT-Clause
         ## ("plain" means, that every field in the table will
- ## be set to a value, default is '' or 0 if nothing said
- ## in $special)
- ##
- ## Works like insert_clause() with the difference, that
- ## it will set ALL values of a row.
+ ## be set to a value, default is '' or 0)
         ##
- ## $fields is an assoc. Array consisting out of
- ## table_name => value-pairs
- ## $special is an assoc. field which will commit special
- ## handling to convert() (See there)
- ## $params Assoc Array
+ ## (
+ ## string $table
+ ## array $fields
+ ## array $special
+ ## array or string $params known values for array:
         ## check => "strong" | "soft"
- ## "strong" tells you if there were to less
- ## or too much fields (good for debuging)
         ## nullisnull => true
- ## instead of inserting '' or 0 if the field is not set
- ## it will write NULL
- ## if you don't want either this or the other use insert_Clause()
- ##
- ## if $params is a string it is taken as $check (see default).
- ##
- ## returns an insert clause. It's on you to modify it
- ## and send it to your DB
- ##
+ ## )
+ ## : string insert-clause
         function insert_plain_Clause ($table,$fields,$special='',$params="soft") {
                 if (empty($special)) $special=ARRAY();
                 list($params,$check)=$this->chkprms($params);
@@ -477,14 +380,20 @@
         }
 
         ##
- ## This function is nearly the same, as insert_Clause, but some
- ## differences:
- ## $special: If $special is a string and $where is empty,
- ## it takes it as $where-Parameter
- ## The where parameter should be generated by yourself
- ## The check parameter knows 3 values: strong, soft and weak
- ## weak enables you to sent a query without $where (enables you
- ## to update the hole table)
+ ## update_clause()
+ ## The where parameter should be generated by yourself or will
+ ## be generated via unique_where_Clause() out of $fields, if not given
+ ## (
+ ## array $table, array $fields,
+ ## array or string $special_or_where,
+ ## array or string $where_or_special,
+ ## array or string $params - known values
+ ## check => "strong" | "soft" | "weak"
+ ## weak enables you to sent a query without $where (enables you
+ ## to update the hole table)
+ ## soft (default) takes the $fields-parameter to generate a WHERE-clause
+ ## )
+ ## : string update-clause
         ##
         function update_Clause ($table,$fields,
                                 $special_or_where='',$where_or_special='',$params="soft") {
@@ -493,11 +402,14 @@
 
                 $meta=$this->metadata_buffered($table);
 
- if (!$where && $check!="weak") {
+ if (empty($where) && $check=="soft") {
+ $where=$this->unique_where_Clause($table,$fields);
+ $check='strong';
+ }
+ if (empty($where) && $check=='strong') {
                         echo "ERROR: update_Clause(): Parameter \$where is empty!<BR>";
                         return(false);
                 }
-
                 list($vals,$names)=$this->uniform_vars($meta,$fields,$special);
 
                 for ($i=0 ; $i < Count ($names); $i++ ) {
@@ -512,21 +424,21 @@
         }
 
         ##
- ## This function is nearly the same, as insert_plain_Clause. Some
- ## difference:
- ## $special_or_where: If $special is a string and $where is empty,
- ## it takes it as $where-Parameter
- ## $where: should be generated by yourself, should be in the form
- ## "WHERE ...." or "...."
- ## $params: Assoc Array
- ## check => "strong" || "soft" || "weak"
- ## "weak" enables you to send a query without $where-parameter
+ ## This function is nearly the same, as update_Clause()
+ ## (
+ ## array $table, array $fields,
+ ## array or string $special_or_where,
+ ## array or string $where_or_special,
+ ## array or string $params - known values:
+ ## check => "strong" | "soft" | "weak"
+ ## weak enables you to sent a query without $where (enables you
+ ## to update the hole table)
+ ## soft (default) takes the $fields-parameter to generate a WHERE-clause
         ## nullisnull => true
         ## instead of updateing '' or 0 if the field is not set
         ## it will write NULL
- ## if you don't want either this or the other use update_Clause()
- ##
- ## if $params is a string it is taken as $check (see default).
+ ## )
+ ## : string update-clause
         ##
         function update_plain_Clause ($table,$fields,
                  $special_or_where='',$where_or_special='',$params="soft") {
@@ -556,8 +468,10 @@
         ##
         ## DELETE
         ## deletes fields from the selected Table
- ## $table: The table
- ## $where_or_wfields: Either a where-clause-string or an assoc array
+ ## (
+ ## array $table: The table
+ ## array $where_or_wfields
+ ## Either a where-clause-string or an assoc array
         ## of fields. In this case the function tries to find an
         ## unique-identifier of those fields and creates only
         ## an where-clause for those unique-fields, otherwise
@@ -568,7 +482,8 @@
         ## (so $where_or_wfields can be empty)
         ## "strong" checks if $where_or_wfields describes minimum
         ## one unique-identifier
- ## if $params is a string it is taken as $check (see default).
+ ## )
+ ## : string delete-clause
         ##
         function delete_Clause ($table,$where_or_wfields='',$params="soft") {
                 list($fields,$where)=$this->special_or_where($where_or_wfields);
@@ -605,6 +520,7 @@
         }
 
 
+
         ##
         ## WHERE-CLAUSE
         ##
@@ -615,10 +531,10 @@
         ## operator is '='. In this case the operator is changed into "IS"
         ## in any other case it is changed into "IS NOT". (won't match
         ## 'like' etc. but this function is not thought for such operations!)
- ##
- ## $tables table
- ## $fields Assoc name=>value-fields
- ## $op Assoc name=>operator. If empty, '=' is taken. it is printed
+ ## (
+ ## string $table
+ ## array $fields Assoc name=>value-fields
+ ## array $op Assoc name=>operator. If empty, '=' is taken. it is printed
         ## *between* the name/value pairs.
         ## if $op is 'func' the name is taken as function name,
         ## inside the brakets is the value.
@@ -634,15 +550,15 @@
         ## Returns a where-clause beginning with " WHERE "
         ##
         function where_Clause ($table,$fields,$op='',$special='',
- $andor='AND',$where='',$check="soft") {
- $meta=$this->metadata_buffered($table);
- $q='';
-
+ $andor='AND',$where='',$params="soft") {
+ list($params,$check)=$this->chkprms($params);
                 if (!is_Array($op)) $op=ARRAY();
                 if (!is_Array($special)) $special=ARRAY();
                 if (!$andor) $andor='AND';
                 if (!is_Array($fields)) $fields=ARRAY();
 
+ $q='';
+ $meta=$this->metadata_buffered($table);
                 list($vals,$names)=$this->uniform_vars($meta,$fields,$special);
 
                 for ($i=0; $i < Count($names) ; $i++) {
@@ -666,6 +582,58 @@
         }
 
         ##
+ ## UNIQE-WHERE-CLAUSE
+ ## Result is identical to where_Clause(), but it checks and uses
+ ## only unique-identificators and if your table has
+ ## none it returns an error.
+ ## $special:
+ ## removenull => true
+ ## Removes parts that will lead to "bla IS NULL" or "bla IS NOT NULL"
+ ## cause primary or unique keys cannot be defined as NULL
+ ##
+ function unique_where_Clause ($table,$fields,$op='',$special='',
+ $andor='AND',$where='',$params="soft") {
+ list($params,$check)=$this->chkprms($params);
+ if (!is_Array($special)) $special=ARRAY();
+ if (!$andor) $andor='AND';
+ if (!is_Array($fields)) $fields=ARRAY();
+
+ $meta=$this->metadata_buffered($table);
+ if ( empty($meta[unique]) ) {
+ echo "ERROR: unique_where_Clause(): Table '$table' has no unique".
+ " identifier or primary key!<br>";
+ return(false);
+ }
+ $uniq=split(" ",$meta[unique]);
+ $where=ARRAY();
+ for ( reset($uniq) ; list(,$name)=each($uniq) ; ) {
+ if (isset($meta[meta][$name])) {
+ $tmp= $this->convert($fields[$name],
+ $meta[$meta[meta][$name]],
+ $special[$name]);
+ if ( (string)$tmp[0] !='NULL' &&
+ empty($special[removenull]) ) {
+ $where[$name]=$fields[$name];
+ }
+ } else {
+ echo "ERROR: unique_where_Clause(): This unique index dosn't exist: '$name'<br>";
+ return(false);
+ }
+ }
+ $whereclause=$this->where_Clause($table,$where,$op,$special,
+ $andor,$where,$special);
+ if (!$whereclause) {
+ echo "ERROR: unique_where_Clause(): The result of generating a where-clause to this uniqe identifers is empty:<br>";
+ for ( reset($uniq); list(,$name)=each($uniq) ; ) {
+ echo "[$name]=>'$fields[$name]'<br>";
+ }
+ echo "<br>";
+ return(false);
+ }
+ return($whereclause);
+ }
+
+ ##
         ## SIMP(LE) WHERE-CLAUSE
         ## Formerly known as where_plain_Clause()
         ## Let you generate a WHERE-Clause with a Loop.
@@ -714,8 +682,6 @@
         ## class in the Query class ($classname is not set)
         ## we must overwrite this class!
         ## The result before calling this function is not saved!
- ## Depending on $params, the result is executed or printed out.
- ## It returns either "U" or "I" or false if an error occours.
         ## $table: The table
         ## $fields: Assoc array of values to insert or update
         ## $special: Assoc array for special handling of $fields
@@ -727,37 +693,11 @@
                 if (empty($special)) $special=ARRAY();
                 list($params,$check)=$this->chkprms($params);
 
- $meta=$this->metadata_buffered($table);
-
- if ( empty($meta[unique]) ) {
- echo "ERROR: IU_Clause(): Table '$table' has no unique".
- " identifier or primary key!<br>";
- return(false);
- }
- $uniq=split(" ",$meta[unique]);
- $where=ARRAY();
- for ( reset($uniq) ; list(,$name)=each($uniq) ; ) {
- if (isset($meta[meta][$name])) {
- $tmp= $this->convert($fields[$name],
- $meta[$meta[meta][$name]],
- $special[$name]);
- if ( (string)$tmp[0] !="NULL" ) {
- $where[$name]=$fields[$name];
- }
- } else {
- echo "ERROR: IU_Clause(): This unique index dosn't exist: '$name'<br>";
- return(false);
- }
+ if (!$whereclause=
+ $this->unique_where_Clause($table,$fields,$special,$params) ) {
+ echo "ERROR: IU_Clause(): Where-Clause could't generated";
+ return(0);
                 }
- $whereclause=$this->where_Clause($table,$where,'',$special);
- if (!$whereclause) {
- echo "ERROR: IU_Clause(): The result of generating a where-clause to this uniqe identifers is empty:<br>";
- for ( reset($uniq); list(,$name)=each($uniq) ; ) {
- echo "[$name]=>'$fields[$name]'<br>";
- }
- echo "<br>";
- return(false);
- }
 
                   $this->query("select count(*) from $table $whereclause");
                 $this->next_record();
@@ -766,7 +706,7 @@
                         ## goes wrong with generating the where-clause?
                         echo "ERROR: IU_Clause(): This index isn't unique: '$whereclause'<BR>";
                         return(false);
- } elseif (!$params[forceinsert] && $this->Record[0] == 1) {
+ } elseif (empty($params[forceinsert]) && $this->Record[0] == 1) {
                         return(
                          $this->update_Clause($table,$fields,$special,$whereclause,$check) );
                 } else {
@@ -856,9 +796,6 @@
         ## name=>value-pairs needed by all the other functions. It reads
         ## the name of the vars from the fields in $table and the values
         ## from the $GLOBALS-var-field.
- ## This has the sense, that you can name the variables in your
- ## Input-Form exactly like the names in your table. This again
- ## let make you less errors and less side effects.
         ##
         ## $table The name of the table
         ##
@@ -886,6 +823,10 @@
         //--------------------------------------------------------------
         function dispose_vars($params='') {
                 if (!is_array($params)) $params=ARRAY();
+ if ( !is_Array($this->Record)) {
+ $this->_QDebug("No record available!");
+ return(0);
+ }
                 for ( reset($this->Record); list($key,$val)=each($this->Record); ) :
                         if (ereg("[A-Za-z_][A-Za-z0-9_]*", $key)) {
                                 if ($params[to_upper]) {
@@ -950,11 +891,7 @@
         ##
         ## This function returns an assoc. Array consisting out of
         ## name=>value-pairs which have a different value from the value
- ## currently existing in your table. This is needed by
- ## update_Clause(), cause with this, the update-query can be shortened
- ## to the maximum needed changes. Can also be used for much other things,
- ## e.g. checking if something in your form has been changed (in this
- ## case it returns an empty array)
+ ## currently existing in your table.
         ##
         ## BUGS: Cannot handle NULL values correctly
         ##
@@ -989,13 +926,11 @@
                 return($r);
         }
 
- // The following part is included from db_usql
- // This is the better place...
-
-
 
-
         //--------------------------------------------------------------
+ //
+ // !!!!!!!!!!!!!!!THIS FUNCTION DOSN'T WORK CORRECT!!!!!!!!!!!!!
+ //
         // This function can be used to "copy" all the records of
         // a former query to another table
         // you can hand over a translation-table, which is an assoc-array:
@@ -1024,57 +959,6 @@
         }
 
 
- //------------------------------------------------------------
- // This is great: A function which generates a search query
- // from a single input-field like Fireball does.
- // (of course there are many other searching engines, which use
- // this format, but I like the name :-)
- // Documentation:
- // $string: Is the searching string, it knows the following rules:
- // 1. 'word1 word2' Result includes word1 OR word2
- // 2. '+word1 +word2' Result includes word1 AND word2
- // 3. '-word' Result dosn't include this word
- // 4. '"fasel bla"'
- // 'fasel-bla' Word is taken as a single word the
- // punctuation is replaced with '_'
- // (configurable!)
- // ANY of the combinations of rule 1-4 and any number of words
- // (see $maxwords) are VALID!
- //
- // $query: This is a part of a WHERE-Clause, that should be generated.
- // It should look like the following:
- // "( first_name like '%{s}%' or name like '%{s}%' or".
- // " street like '%{s}%' or zipcode like '{s}%' or".
- // " town like '%{s}%')"
- // {s} is replaced by the current searching-word.
- // The query has to be placed into brackets, cause otherwise
- // the like operators will match false.
- //
- // $maxwords: Maximum number of searching words. Zero (default)
- // will not check. Too much words returns ARRAY(false,1);
- //
- // RETURN-VALUES:
- // We will currently return an array with two values:
- // list($wherepart,$what) = fireball($x,$y);
- // $wherepart: is the part of the query which could be included to
- // the WHERE-Part of your Query.
- // We advise you, that a user can easily create
- // queries which are bigger than the maximum
- // buffer-size of the underlaying database;
- // this has to be checked by yourself!
- // This result could be directly used as parameter $where
- // within the function where_Clause() or related functions
- // $what: Is a simplified form of the $part, which could be
- // used for other things, like informing the user
- // about what he is currently searching.
- // It's on you to translate this into a more understandable form
- // Example:
- // list($wherepart,$what)=
- // fireball_clause("hugo +bla -hugobla","(name='{s}')");
- // echo "$wherepart<br>$what";
- // Output:
- // ( (name='hugo') OR (name='bla') ) AND (name='bla') AND NOT (name='hugobla')
- // ( 'hugo' OR 'bla' ) AND 'bla' AND NOT 'hugobla'
         //-------------------------------------------------------------
         function fireball_Clause ($string,$query,$maxwords=0) {
 

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>