Roxen.git / server / etc / modules / Roxen.pmod

version» Context lines:

Roxen.git/server/etc/modules/Roxen.pmod:1:   // This is a roxen pike module. Copyright © 1999 - 2009, Roxen IS.   // - // $Id: Roxen.pmod,v 1.325 2011/11/14 00:13:57 mast Exp $ + // $Id$      #include <roxen.h>   #include <config.h>   #include <version.h>   #include <module.h>   #include <stat.h>   #define roxen roxenp()      #ifdef HTTP_DEBUG   # define HTTP_WERR(X) report_debug("HTTP: "+X+"\n");
Roxen.git/server/etc/modules/Roxen.pmod:5453:    if (type->string_type)    // A bit inconsistent with the true/false values, but compatible    // with the old sql_null value and how sql NULLs behaved prior    // to it when they produced UNDEFINED.    return "";    if (type->subtype_of (RXML.t_num))    return type->encode (0);    return type->encode (this);    }    +  protected mixed cast(string to) +  { +  switch(to) { +  case "string": return ""; +  case "int": return 0; +  case "float": return 0.0; +  default: error("Cannot cast %O to %s.\n", this, to); +  } +  } +     protected string _sprintf (int flag) {return flag == 'O' && "Roxen.null";}   }      Null null = Null();   //! Roxen replacement for @[Val.null] that adds rxml type conversions:   //! It's false in boolean tests, yields "" in a string context and 0   //! or 0.0, as appropriate, in a numeric context.      constant SqlNull = Null;   Val.Null sql_null;