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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:26:   private int clientsregistered;      constant emptyarray = ({});   constant describenodata    = (["datarowdesc":emptyarray, "datarowtypes":emptyarray,    "datatypeoid":emptyarray]);   final multiset censoroptions=(<"use_ssl","force_ssl",    "cache_autoprepared_statements","reconnect","text_query","is_superuser",    "server_encoding","server_version","integer_datetimes",    "session_authorization">); + constant stdiobuftype = typeof(Stdio.Buffer());       /* Statements matching createprefix cause the prepared statement cache    * to be flushed to prevent stale references to (temporary) tables    */   final Regexp createprefix=iregexp("^\a*(CREATE|DROP)\a");       /* Statements matching dontcacheprefix never enter the cache    */   private Regexp dontcacheprefix=iregexp("^\a*(FETCH|COPY)\a");   
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:875:    }    }    plugbuffer->add_hstring(value,4);    break;    }    default: {    if(!value) {    plugbuffer->add_int32(-1);    break;    } -  value=(string)value; -  if(String.width(value)>8) -  if(dtoid[i]==BYTEAOID) -  value=string_to_utf8(value); +  if (!objectp(value) || typeof(value) != stdiobuftype) +  /* +  * Like Oracle and SQLite, we accept literal binary values +  * from single-valued multisets. +  */ +  if (multisetp(value) && sizeof(value) == 1) +  value = indices(value)[0];    else { -  SUSERERROR("Wide string %O not supported for type OID %d\n", +  value = (string)value; +  if (String.width(value) > 8) +  if (dtoid[i] == BYTEAOID) +  /* +  * FIXME We should throw an error here, it would +  * have been correct, but for historical reasons and +  * as a DWIM convenience we autoconvert to UTF8 here. +  */ +  value = string_to_utf8(value); +  else { +  SUSERERROR( +  "Wide string %O not supported for type OID %d\n",    value,dtoid[i]);    value="";    } -  +  }    plugbuffer->add_hstring(value,4);    break;    }    case BOOLOID:    do {    int tval;    if(stringp(value))    tval=value[0];    else if(!intp(value)) {    value=!!value; // cast to boolean