Skip to content

Commit b2ff958

Browse files
committed
remove the code of C function
1 parent 541a290 commit b2ff958

1 file changed

Lines changed: 0 additions & 52 deletions

File tree

  • CN/modules/ROOT/pages/master/oracle_builtin_functions

CN/modules/ROOT/pages/master/oracle_builtin_functions/vsize.adoc

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -59,58 +59,6 @@ IMMUTABLE;
5959
/* End - VSIZE */
6060
```
6161

62-
C 函数实现(`misc_functions.c`):
63-
```c
64-
Datum
65-
ora_vsize(PG_FUNCTION_ARGS)
66-
{
67-
Datum value = PG_GETARG_DATUM(0);
68-
int32 result;
69-
int typlen;
70-
71-
/* On first call, get the input type's typlen, and save at *fn_extra */
72-
if (fcinfo->flinfo->fn_extra == NULL)
73-
{
74-
/* Lookup the datatype of the supplied argument */
75-
Oid argtypeid = get_fn_expr_argtype(fcinfo->flinfo, 0);
76-
77-
typlen = get_typlen(argtypeid);
78-
if (typlen == 0) /* should not happen */
79-
elog(ERROR, "cache lookup failed for type %u", argtypeid);
80-
81-
fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
82-
sizeof(int));
83-
*((int *) fcinfo->flinfo->fn_extra) = typlen;
84-
}
85-
else
86-
typlen = *((int *) fcinfo->flinfo->fn_extra);
87-
88-
if (typlen == -1)
89-
{
90-
/*
91-
* varlena type. toast_raw_datum_size() normalizes 1-byte/4-byte
92-
* headers, compression and external (toasted) storage to the
93-
* logical (decompressed) size using the 4-byte header convention,
94-
* so subtracting VARHDRSZ yields the payload byte count in every
95-
* case -- the same pattern octet_length() uses.
96-
*/
97-
result = toast_raw_datum_size(value) - VARHDRSZ;
98-
}
99-
else if (typlen == -2)
100-
{
101-
/* cstring */
102-
result = strlen(DatumGetCString(value)) + 1;
103-
}
104-
else
105-
{
106-
/* ordinary fixed-width type */
107-
result = typlen;
108-
}
109-
110-
PG_RETURN_INT32(result);
111-
}
112-
```
113-
11462
== VSIZE 典型用例
11563
[cols="8,2"]
11664
|====

0 commit comments

Comments
 (0)