pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql_util.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:171:
} private int readoidformat(int oid) { switch (oid) { case BOOLOID: case BYTEAOID: case CHAROID: case INT8OID: case INT2OID: case INT4OID:
+
case FLOAT4OID:
+
#if !constant(__builtin.__SINGLE_PRECISION_FLOAT__)
+
case FLOAT8OID:
+
#endif
case TEXTOID: case OIDOID: case XMLOID: case DATEOID: case TIMEOID: case TIMETZOID: case TIMESTAMPOID: case TIMESTAMPTZOID: case INTERVALOID: case INT4RANGEOID:
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:229:
case TIMEOID: case TIMETZOID: case TIMESTAMPOID: case TIMESTAMPTZOID: case INTERVALOID: case INT4RANGEOID: case INT8RANGEOID: case DATERANGEOID: case TSRANGEOID: case TSTZRANGEOID:
+
case FLOAT4OID:
+
#if !constant(__builtin.__SINGLE_PRECISION_FLOAT__)
+
case FLOAT8OID:
+
#endif
if (!stringp(value)) return 1; } return 0; // text } private array timestamptotype = ({__builtin.Timestamp, 8, "usecs", 8}); private array datetotype = ({__builtin.Date, 4, "days", 4}); private mapping(int:array) oidtotype = ([
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:890:
#endif foreach (datarowtypes; int i; int typ) { int collen = cr->read_sint(4); if (collen > 0) { #ifdef PG_DEBUG msglen -= collen; #endif mixed value; switch (typ) { case FLOAT4OID:
-
#if
SIZEOF
_FLOAT
>=8
+
#if
!constant(
_
_builtin.__SINGLE_PRECISION_
FLOAT
__)
case FLOAT8OID: #endif
-
+
if (_forcetext) {
if (!alltext) { value = (float)cr->read(collen); break; }
-
+
} else {
+
[ value ] = cr->sscanf(collen == 4 ? "%4F" : "%8F");
+
if (alltext)
+
value = (string)value;
+
break;
+
}
default:value = cr->read(collen); break; case CHAROID: value = alltext ? cr->read(1) : cr->read_int8(); break; case BOOLOID:value = cr->read_int8(); switch (value) { case 'f':value = 0; break; case 't':value = 1;
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:951:
value[totype[2]] = from; from = value; } if (intp(till)) { value = totype[0](); value[totype[2]] = till; till = value; } } value = __builtin.Range(from, till);
+
if (alltext)
+
value = (string)value;
} break; case CIDROID: case INETOID: if (_forcetext) value = cr->read(collen); else { value = __builtin.Inet(); int iptype = cr->read_int8(); // 2 == IPv4, 3 == IPv6 value->masklen = cr->read_int8() + (iptype == 2 && 12*8); cr->read_int8(); // 0 == INET, 1 == CIDR value->address = cr->read_hint(1);
-
+
if (alltext)
+
value = (string)value;
} break; case TIMESTAMPOID: case TIMESTAMPTZOID: case INTERVALOID: case TIMETZOID: case TIMEOID: case DATEOID: if (_forcetext) value = cr->read(collen);
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1228:
array totype = oidtotype[dtoid[i]]; if (!objectp(value)) value = totype[0](value); plugbuffer->add_int32(totype[1]); int i = 2; do plugbuffer->add_int(value[totype[i]], totype[i+1]); while ((i += 2) < sizeof(totype)); } break;
+
case FLOAT4OID:
+
#if !constant(__builtin.__SINGLE_PRECISION_FLOAT__)
+
case FLOAT8OID:
+
#endif
+
if (stringp(value))
+
plugbuffer->add_hstring(value, 4);
+
else {
+
int w = dtoid[i] == FLOAT4OID ? 4 : 8;
+
plugbuffer->add_int32(w)
+
->sprintf(w == 4 ? "%4F" : "%8F", value);
+
}
+
break;
case INT8OID: plugbuffer->add_int32(8)->add_int((int)value, 8); break; case OIDOID: case INT4OID: plugbuffer->add_int32(4)->add_int32((int)value); break; case INT2OID: plugbuffer->add_int32(2)->add_int16((int)value); break;