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

version» Context lines:

Roxen.git/server/modules/tags/sqltag.pike:1:   /* -  * $Id: sqltag.pike,v 1.21 1998/02/02 01:00:21 wing Exp $ +  * $Id: sqltag.pike,v 1.22 1998/02/10 19:35:15 grubba 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.21 1998/02/02 01:00:21 wing Exp $"; + constant cvs_version="$Id: sqltag.pike,v 1.22 1998/02/10 19:35:15 grubba 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:60:    "sql-servers your pike has support for, but the following "    "might exist: msql, mysql, odbc, oracle, postgres.</td></tr>\n"    "<tr><td valign=top><b>database</b></td>"    "<td>The name of the database to use.</td></tr>\n"    "<tr><td valign=top><b>user</b></td>"    "<td>The name of the user to access the database with.</td></tr>\n"    "<tr><td valign=top><b>password</b></td>"    "<td>The password to access the database.</td></tr>\n"    "<tr><td valign=top><b>parse</b></td>"    "<td>If specified, the query will be parsed by the " -  "RXML-parser</td></tr>" +  "RXML-parser</td></tr>\n" +  "<tr><td valign=top><b>quiet</b></td>" +  "<td>If specified, SQL-errors will be kept quiet.</td></tr>\n"    "</table></ul><p>\n"    "The &lt;sqltable&gt; tag has an additional attribute "    "<b>ascii</b>, which generates a tab-separated table (usefull "    "with eg the &lt;diagram&gt; tag).<p>\n"    "\n"    "<b>NOTE</b>: Specifying passwords in the documents may prove "    "to be a security hole if the module is not loaded for some "    "reason.<br>\n"    "<b>SEE ALSO</b>: The &lt;FORMOUTPUT&gt; tag can be "    "usefull to generate the queries.<br>\n",
Roxen.git/server/modules/tags/sqltag.pike:128:    password = args->password;    sql_connect = 0;    }    if (sql_connect) {    error = catch(con = sql_connect(host));    } else {    host = (lower_case(host) == "localhost")?"":host;    error = catch(con = sql(host, database, user, password));    }    if (error) { +  if (!args->quiet) {    contents = "<h1>Couldn't connect to SQL-server</h1><br>\n" + -  ((master()->describe_backtrace(error)/"\n")*"<br>\n"); +  ((master()->describe_backtrace(error)/"\n")*"<br>\n" + "<false>"); +  } else { +  contents = "<false>"; +  }    } else if (error = catch(result = con->query(args->query))) { -  +  if (!args->quiet) {    contents = "<h1>Query \"" + args->query + "\" failed: " +    con->error() + "</h1>\n" + -  ((master()->describe_backtrace(error)/"\n")*"<br>\n"); +  ((master()->describe_backtrace(error)/"\n")*"<br>\n" + "<false>"); +  } else { +  contents = "<false>"; +  }    } else if (result && sizeof(result))    {    contents = do_output_tag( args, result, contents, request_id )    + "<true>";    } else {    contents = "<false>";    }    } else {    contents = "<!-- No query! --><false>";    }
Roxen.git/server/modules/tags/sqltag.pike:196:    password = args->password;    sql_connect = 0;    }    if (sql_connect) {    error = catch(con = sql_connect(host));    } else {    host = (lower_case(host) == "localhost")?"":host;    error = catch(con = sql(host, database, user, password));    }    if (error) { +  if (!args->quiet) {    return("<h1>Couldn't connect to SQL-server</h1><br>\n" + -  ((master()->describe_backtrace(error)/"\n")*"<br>\n")); +  ((master()->describe_backtrace(error)/"\n")*"<br>\n" + +  "<false>")); +  } else { +  return("<false>"); +  }    } else if (error = catch(res = con->query(args->query))) { -  +  if (!args->quiet) {    return("<h1>Query \"" + args->query + "\" failed: " +    con->error() + "</h1>\n" + -  ((master()->describe_backtrace(error)/"\n")*"<br>\n")); +  ((master()->describe_backtrace(error)/"\n")*"<br>\n" + +  "<false>")); +  } else { +  return("<false>");    } -  +  }    return(res?"<true>":"<false>");    } else {    return("<!-- No query! --><false>");    }   }      string sqltable_tag(string tag_name, mapping args,    object request_id, object f,    mapping defines, object fd)   {
Roxen.git/server/modules/tags/sqltag.pike:266:    password = args->password;    sql_connect = 0;    }    if (sql_connect) {    error = catch(con = sql_connect(host));    } else {    host = (lower_case(host) == "localhost")?"":host;    error = catch(con = sql(host, database, user, password));    }    if (error) { +  if (!args->quiet) {    return("<h1>Couldn't connect to SQL-server</h1><br>\n" + -  ((master()->describe_backtrace(error)/"\n")*"<br>\n")); +  ((master()->describe_backtrace(error)/"\n")*"<br>\n" + +  "<false>")); +  } else { +  return("<false>"); +  }    } else if (error = catch(result = con->big_query(args->query))) { -  +  if (!args->quiet) {    return("<h1>Query \"" + args->query + "\" failed: " +    con->error() + "</h1>\n" + -  ((master()->describe_backtrace(error)/"\n")*"<br>\n")); +  ((master()->describe_backtrace(error)/"\n")*"<br>\n" + +  "<false>")); +  } else { +  return("<false>");    } -  +  }       if (result) {    string nullvalue="";    array(mixed) row;       if (args->nullvalue) {    nullvalue=(string)args->nullvalue;    }       if (ascii) {