Branch: Tag:

1997-09-30

1997-09-30 14:33:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Restored sqlelse tag. Fixed a minor bug.

Rev: server/modules/tags/sqltag.pike:1.11

1:   /* -  * $Id: sqltag.pike,v 1.10 1997/09/28 17:27:20 grubba Exp $ +  * $Id: sqltag.pike,v 1.11 1997/09/30 14:33:21 grubba Exp $    *    * A module for Roxen Challenger, which gives the tags    * <SQLQUERY> and <SQLOUTPUT>.
7:    * Henrik Grubbström 1997-01-12    */    - constant cvs_version="$Id: sqltag.pike,v 1.10 1997/09/28 17:27:20 grubba Exp $"; + constant cvs_version="$Id: sqltag.pike,v 1.11 1997/09/30 14:33:21 grubba Exp $";   constant thread_safe=1;   #include <module.h>   
26:    return( ({ MODULE_PARSER,    "SQL-module",    "This module gives the three tags &lt;SQLQUERY&gt;, " -  "&lt;SQLOUTPUT&gt;, &lt;SQLELSE&gt; and &lt;SQLTABLE&gt;.<br>\n" +  "&lt;SQLOUTPUT&gt;, and &lt;SQLTABLE&gt;.<br>\n"    "Usage:<ul>\n"    "<table border=0>\n"    "<tr><td valign=top><b>&lt;sqloutput&gt;</b></td>"
113:    contents = "<h1>Query \"" + args->query + "\" failed: " +    con->error() + "</h1>\n" +    ((master()->describe_backtrace(error)/"\n")*"<br>\n"); -  } else if (result) { +  } else if (result && sizeof(result)) {    string nullvalue="";    array(string) content_array = contents/"#";    array(string) res_array=allocate(sizeof(content_array)*sizeof(result));
142:    }    }    } -  contents = res_array * ""; -  request_id->misc->sqlelse = 0; +  contents = (res_array * "") + "<true>";    } else { -  request_id->misc->sqlelse = 1; +  contents = "<false>";    }    } else { -  contents = "<!-- No query! -->" + contents; +  contents = "<!-- No query! --><false>";    }    return(contents);   }
192:    con->error() + "</h1>\n" +    ((master()->describe_backtrace(error)/"\n")*"<br>\n"));    } -  request_id->misc->sqlelse = !res; +  return(res?"<true>":"<false>");    } else { -  return("<!-- No query! -->"); +  return("<!-- No query! --><false>");    } -  return(""); +    }      string sqltable_tag(string tag_name, mapping args,
275:    }    res += "</tr>\n";    } -  res += "</table>"; +  res += "</table><true>";    -  request_id->misc->sqlelse = 0; +     return(res);    } else { -  request_id->misc->sqlelse = 1; -  return("<!-- No result from query -->"); +  return("<!-- No result from query --><false>");    }    } else { -  return("<!-- No query! -->"); +  return("<!-- No query! --><false>");    }   }      string sqlelse_tag(string tag_name, mapping args, string contents,    object request_id, mapping defines)   { -  if (request_id->misc->sqlelse) { -  request_id->misc->sqlelse = 0; -  return(contents); +  return(make_container("else", args, contents));   } -  return(""); - } +       string dumpid_tag(string tag_name, mapping args,    object request_id, mapping defines)