pike.git / lib / modules / Sql.pmod / sql_util.pmod

version» Context lines:

pike.git/lib/modules/Sql.pmod/sql_util.pmod:1:   /* -  * $Id: sql_util.pmod,v 1.6 2000/09/28 03:39:10 hubbe Exp $ +  * $Id: sql_util.pmod,v 1.7 2001/01/09 21:18:30 marcus Exp $    *    * Some SQL utility functions.    * They are kept here to avoid circular references.    *    * Henrik Grubbström 1999-07-01    */      #pike __REAL_VERSION__      //.   //. File: sql_util.pmod - //. RCSID: $Id: sql_util.pmod,v 1.6 2000/09/28 03:39:10 hubbe Exp $ + //. RCSID: $Id: sql_util.pmod,v 1.7 2001/01/09 21:18:30 marcus Exp $   //. Author: Henrik Grubbström (grubba@idonex.se)   //.   //. Synopsis: Some SQL utility functions   //.   //. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   //.   //. These functions are kept here mainly to avoid circular references.   //.      //. - quote
pike.git/lib/modules/Sql.pmod/sql_util.pmod:49:   //. no confusion is possible in the query. If necessary, change the   //. variables' names   string emulate_bindings(string query, mapping(string|int:mixed)|void bindings,    void|object driver)   {    array(string)k, v;    function my_quote=(driver&&driver->quote?driver->quote:quote);    if (!bindings)    return query;    v=Array.map(values(bindings), -  lambda(mixed m) {return -  my_quote(stringp(m)?m:(string)m);}); -  k=Array.map(indices(bindings),lambda(string s){return ":"+s;}); +  lambda(mixed m) { +  if(multisetp(m)) m = indices(m)[0]; +  return (stringp(m)? "'"+my_quote(m)+"'" : (string)m); +  }); +  k=Array.map(indices(bindings),lambda(string s){ +  return (stringp(s)? s : ":"+s); +  });    return replace(query,k,v);   }