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.19 2007/05/03 13:57:35 mast Exp $ +  * $Id: sql_util.pmod,v 1.20 2008/06/25 11:53:31 srb Exp $    *    * Some SQL utility functions.    * They are kept here to avoid circular references.    *    * Henrik Grubbström 1999-07-01    */      #pike __REAL_VERSION__      //! Some SQL utility functions
pike.git/lib/modules/Sql.pmod/sql_util.pmod:43:   string emulate_bindings(string query, mapping(string|int:mixed)|void bindings,    void|object driver)   {    array(string)k, v;    if (!bindings)    return query;    function my_quote=(driver&&driver->quote?driver->quote:quote);    v=map(values(bindings),    lambda(mixed m) {    if(multisetp(m)) m = indices(m)[0]; -  return (stringp(m)? "'"+my_quote(m)+"'" : (string)m); +  return (stringp(m)? "'"+my_quote(m)+"'" : +  zero_type(m)?"NULL":(string)m);    });    // Throws if mapping key is empty string.    k=map(indices(bindings),lambda(string s){    return ( (stringp(s)&&s[0]==':') ?    s : ":"+s);    });    return replace(query,k,v);   }      //! Result object wrapper performing utf8 decoding of all fields.