Branch: Tag:

2009-01-24

2009-01-24 16:50:33 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Explicitly cast empty strings to NULL for non-string types
before converting them into bound arguments.

Rev: lib/modules/Sql.pmod/pgsql.pike:1.48

1615:    foreach(paramValues;int i;mixed value) {    if(zero_type(value))    plugbuf+=({_c.plugint32(-1)}); // NULL +  else if(stringp(value) && !sizeof(value)) { +  int k=0; +  switch(dtoid[i]) { +  default: +  k=-1; // cast empty strings to NULL for non-string types +  case BYTEAOID: +  case TEXTOID: +  case XMLOID: +  case BPCHAROID: +  case VARCHAROID:; +  } +  plugbuf+=({_c.plugint32(k)}); +  }    else    switch(dtoid[i]) {    default: