Roxen.git / server / modules / tags / sqltag.pike

version» Context lines:

Roxen.git/server/modules/tags/sqltag.pike:1:   /* -  * $Id: sqltag.pike,v 1.34 1999/05/14 08:03:19 neotron Exp $ +  * $Id: sqltag.pike,v 1.35 1999/06/11 13:50:45 mast Exp $    *    * A module for Roxen Challenger, which gives the tags    * <SQLQUERY> and <SQLOUTPUT>.    *    * Henrik Grubbström 1997-01-12    */    - constant cvs_version="$Id: sqltag.pike,v 1.34 1999/05/14 08:03:19 neotron Exp $"; + constant cvs_version="$Id: sqltag.pike,v 1.35 1999/06/11 13:50:45 mast Exp $";   constant thread_safe=1;   #include <module.h>      /* Compatibility with old versions of the sqltag module. */   // #define SQL_TAG_COMPAT      inherit "module";   inherit "roxenlib";      import Array;
Roxen.git/server/modules/tags/sqltag.pike:84:    "<b>SEE ALSO</b>: The &lt;FORMOUTPUT&gt; tag can be "    "useful to generate the queries.<br>\n",    0,    1 }) );   }      /*    * Tag handlers    */    - string sqloutput_tag(string tag_name, mapping args, string contents, + mixed sqloutput_tag(string tag_name, mapping args, string contents,    object request_id, object f,    mapping defines, object fd)   {    if(args->help) return register_module()[2]; // FIXME       request_id->misc->cacheable=0; -  +  mixed res;       if (args->query) {       if (args->parse) {    args->query = parse_rxml(args->query, request_id, f, defines);    }       string host = query("hostname");   #ifdef SQL_TAG_COMPAT    string database = query("database");
Roxen.git/server/modules/tags/sqltag.pike:142:    } else {    host = (lower_case(host) == "localhost")?"":host;    error = catch(con = sql(host, database, user, password));    }    if (error) {    if (!args->quiet) {    if (args->log_error && QUERY(log_error)) {    report_error(sprintf("SQLTAG: Couldn't connect to SQL-server:\n"    "%s\n", describe_backtrace(error)));    } -  contents = ("<h3>Couldn't connect to SQL-server</h1><br>\n" + +  res = ("<h3>Couldn't connect to SQL-server</h1><br>\n" +    html_encode_string(error[0]) + "<false>");    } else { -  contents = "<false>"; +  res = "<false>";    }    } else if (error = catch(result = con->query(args->query))) {    if (!args->quiet) {    if (args->log_error && QUERY(log_error)) {    report_error(sprintf("SQLTAG: Query %O failed:\n"    "%s\n",    args->query, describe_backtrace(error)));    } -  contents = ("<h3>Query \"" + html_encode_string(args->query) +  res = ("<h3>Query \"" + html_encode_string(args->query)    + "\" failed: " + html_encode_string(con->error())    + "</h1>\n<false>");    } else { -  contents = "<false>"; +  res = "<false>";    }    } else if (result && sizeof(result))    { -  contents = do_output_tag( args, result, contents, request_id ) -  + "<true>"; +  res = ({do_output_tag( args, result, contents, request_id )}); +  id->misc->defines[" _ok"] = 1; // The effect of <true>, since res isn't parsed.       if( args["rowinfo"] )    request_id->variables[args->rowinfo]=sizeof(result);       } else { -  contents = "<false>"; +  res = "<false>";    }    } else { -  contents = "<!-- No query! --><false>"; +  res = "<!-- No query! --><false>";    } -  return(contents); +  return(res);   }      string sqlquery_tag(string tag_name, mapping args,    object request_id, object f,    mapping defines, object fd)   {    if(args->help) return register_module()[2]; // FIXME       request_id->misc->cacheable=0;