#include <string>
|
|
#include "dbms/htp.h"
|
#include <libxml/HTMLparser.h>
|
#include <libxml/HTMLtree.h>
|
#include "dbms/owa.h"
|
|
extern "C"
|
{
|
#include "utils/builtins.h"
|
#include "utils/elog.h"
|
#include "mb/pg_wchar.h"
|
#include "lib/stringinfo.h"
|
}
|
|
static std::string html_buffer{};
|
bool test_mode = false;
|
bool add_hdr_mode = false;
|
|
namespace htp{
|
typedef enum StringEscapeFormat{
|
StringEscapeLtGtChars, // escape only <> symbols (write HTML special codes instead; used for tag attributes)
|
StringEscapeFormatSpecialChars, // xmlEncodeSpecialChars из libxml2
|
StringEscapeFormatOracle, // oracle-style from htp
|
StringEscapeFormatOracleFull, // oracle-style + for symbol "<>& - ", &qt; ... etc.
|
StringAsIs, // string comes as it is
|
StringEscapeFormatTextU, // \uxxxx format
|
StringEscapeFormatCss // CSS escaping
|
} StringEscapeFormat;
|
void html_buffer_add(const char *str){
|
html_buffer.append(str);
|
html_buffer.push_back('\n');
|
}
|
|
// Вспомогательная функция для одиночного указателя
|
template<typename T>
|
static inline void pfree_if_not_null(T*& ptr) {
|
if (ptr != NULL) {
|
pfree(ptr);
|
ptr = NULL; // предотвращает случайное повторное освобождение
|
}
|
}
|
|
// Вариативный шаблон для произвольного числа аргументов (по ссылке)
|
template<typename... Args>
|
static void pfree_all(Args&... args) {
|
(pfree_if_not_null(args), ...);
|
}
|
|
// латинские буквы, _,-, цифры - оставляем как есть, остальное экранируем
|
// full - смешанный стиль (дополняется тем, что для односимвольного текста стандартное xml экранирование)
|
char *
|
escape_to_numeric_entity(text *input, bool full = false)
|
{
|
const char *data = VARDATA_ANY(input);
|
int len = VARSIZE_ANY_EXHDR(input);
|
StringInfoData result;
|
|
/* Инициализация буфера для результата */
|
initStringInfo(&result);
|
if (len == 0)
|
return result.data;
|
|
int encoding = GetDatabaseEncoding();
|
int byte_pos = 0;
|
|
while (byte_pos < len)
|
{
|
int char_len = pg_encoding_mblen(encoding, data + byte_pos);
|
if (char_len <= 0 || byte_pos + char_len > len)
|
break;
|
|
if (char_len == 1)
|
{
|
unsigned char c = data[byte_pos];
|
if(full) {
|
if(c == '"'){
|
appendStringInfo(&result, """);
|
byte_pos += char_len;
|
continue;
|
}
|
if(c == '<'){
|
appendStringInfo(&result, "<");
|
byte_pos += char_len;
|
continue;
|
}
|
if(c == '>'){
|
appendStringInfo(&result, ">");
|
byte_pos += char_len;
|
continue;
|
}
|
if(c == '&'){
|
appendStringInfo(&result, "&");
|
byte_pos += char_len;
|
continue;
|
}
|
if(c<='~'){
|
appendStringInfoChar(&result, c);
|
byte_pos += char_len;
|
continue;
|
}
|
}
|
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
|
(c >= '0' && c <= '9') || c == '_' || c == '-' || c == '.' ||
|
c == ',')
|
{
|
appendStringInfoChar(&result, c);
|
byte_pos += char_len;
|
continue;
|
}
|
}
|
|
/* Для однобайтовых небезопасных и многобайтовых — декодируем */
|
pg_wchar wc_buf[2];
|
int conv = pg_mb2wchar_with_len(data + byte_pos, wc_buf, char_len);
|
if (conv > 0){
|
int digits = 1;
|
unsigned int temp = wc_buf[0];
|
while (temp > 15) {
|
temp >>= 4;
|
digits++;
|
}
|
// Если цифр нечётное - увеличиваем на 1 (добавим один ведущий ноль)
|
if (digits % 2 != 0) {
|
digits++;
|
}
|
appendStringInfo(&result, "&#x%0*X;", digits, (unsigned int) wc_buf[0]);
|
}
|
else
|
appendStringInfoChar(&result, '?');
|
|
byte_pos += char_len;
|
}
|
|
return result.data;
|
}
|
char *escape_special_chars(text *input){
|
if(input == NULL)
|
return NULL;
|
char *str = text_to_cstring(input);
|
xmlBufferPtr buf = xmlBufferCreate();
|
if (!buf) return NULL;
|
xmlOutputBufferPtr out = xmlOutputBufferCreateBuffer(buf, NULL);
|
if (!out) {
|
xmlBufferFree(buf);
|
return NULL;
|
}
|
|
xmlChar *escaped_code = xmlEncodeSpecialChars(NULL, (xmlChar*)str);
|
xmlOutputBufferWriteString(out, (char*)escaped_code);
|
xmlFree(escaped_code);
|
pfree(str);
|
|
|
xmlOutputBufferFlush(out);
|
const xmlChar *content = xmlBufferContent(buf);
|
size_t len = xmlBufferLength(buf);
|
|
char *result = (char*)palloc(len + 1);
|
if (result) {
|
memcpy(result, content, len);
|
result[len] = '\0';
|
}
|
|
xmlOutputBufferClose(out); // также освобождает buf
|
return result; // освобождать через pfree()
|
}
|
char *escape_ltgt_chars(text *input){
|
if (input == nullptr)
|
{
|
return nullptr;
|
}
|
const char *data = VARDATA_ANY(input);
|
int len = VARSIZE_ANY_EXHDR(input);
|
int byte_pos = 0;
|
StringInfoData result;
|
|
initStringInfo(&result);
|
if (len == 0)
|
{
|
return result.data;
|
}
|
|
// processing as ASCII as it is considered to be ASCII (observation from tests)
|
while (byte_pos < len)
|
{
|
if (data[byte_pos] == '<')
|
{
|
appendStringInfo(&result, "<");
|
}
|
else if (data[byte_pos] == '>')
|
{
|
appendStringInfo(&result, ">");
|
}
|
else
|
{
|
appendStringInfoChar(&result, data[byte_pos]);
|
}
|
byte_pos++;
|
}
|
|
return result.data;
|
}
|
char *
|
escape_to_textU(text *input)
|
{
|
const char *data = VARDATA_ANY(input);
|
int len = VARSIZE_ANY_EXHDR(input);
|
StringInfoData result;
|
|
/* result buffer init */
|
initStringInfo(&result);
|
if (len == 0)
|
return result.data;
|
|
int encoding = GetDatabaseEncoding();
|
int byte_pos = 0;
|
|
while (byte_pos < len)
|
{
|
int char_len = pg_encoding_mblen(encoding, data + byte_pos);
|
if (char_len <= 0 || byte_pos + char_len > len)
|
break;
|
|
if (char_len == 1)
|
{
|
unsigned char c = data[byte_pos];
|
/* let's escape unsafe symbols: ", %, &, ', /, <, >, \, ` and all control ones */
|
if (c == '"' || c == '%' || c == '&' || c == '\'' || c == '/' ||
|
c == '<' || c == '>' || c == '\\' || c == '`' ||
|
c <= 0x1B ) {
|
appendStringInfo(&result, "\\u%04X", c);
|
byte_pos += char_len;
|
continue;
|
}
|
/* 1-byte symbols are left as-is */
|
appendStringInfoChar(&result, c);
|
byte_pos += char_len;
|
continue;
|
}
|
|
/* multibyte symbols are escaped like \uXXXX */
|
pg_wchar wc_buf[2];
|
int conv = pg_mb2wchar_with_len(data + byte_pos, wc_buf, char_len);
|
if (conv > 0){
|
unsigned int wc = wc_buf[0];
|
/* format like \uXXXX with up to 4 leading zeroes */
|
appendStringInfo(&result, "\\u%04X", wc);
|
}
|
else
|
appendStringInfoChar(&result, '?');
|
|
byte_pos += char_len;
|
}
|
|
return result.data;
|
}
|
char *
|
escape_to_css(text *input)
|
{
|
const char *data = VARDATA_ANY(input);
|
int len = VARSIZE_ANY_EXHDR(input);
|
StringInfoData result;
|
|
/* result buffer init */
|
initStringInfo(&result);
|
if (len == 0)
|
return result.data;
|
|
int encoding = GetDatabaseEncoding();
|
int byte_pos = 0;
|
|
while (byte_pos < len)
|
{
|
int char_len = pg_encoding_mblen(encoding, data + byte_pos);
|
if (char_len <= 0 || byte_pos + char_len > len)
|
break;
|
|
if (char_len == 1)
|
{
|
unsigned char c = data[byte_pos];
|
/* escape ' and \ */
|
if (c == '\'') {
|
appendStringInfo(&result, "\\'");
|
byte_pos += char_len;
|
continue;
|
}
|
if (c == '\\') {
|
appendStringInfo(&result, "\\\\");
|
byte_pos += char_len;
|
continue;
|
}
|
|
if (c > 0 && c <= 0x1B)
|
{
|
appendStringInfo(&result, "\\%X", c);
|
byte_pos += char_len;
|
continue;
|
}
|
|
appendStringInfoChar(&result, c);
|
byte_pos += char_len;
|
continue;
|
}
|
|
pg_wchar wc_buf[2];
|
int conv = pg_mb2wchar_with_len(data + byte_pos, wc_buf, char_len);
|
if (conv > 0){
|
unsigned int wc = wc_buf[0];
|
appendStringInfo(&result, "\\%X", wc);
|
}
|
else
|
appendStringInfoChar(&result, '?');
|
|
byte_pos += char_len;
|
}
|
|
return result.data;
|
}
|
char *
|
get_string_argument(FunctionCallInfo fcinfo, int argnum, StringEscapeFormat type = StringEscapeLtGtChars)
|
{
|
if (PG_ARGISNULL(argnum))
|
return NULL;
|
text *arg_txt = PG_GETARG_TEXT_PP(argnum);
|
char *result = NULL;
|
if (VARSIZE_ANY_EXHDR(arg_txt) == 0)
|
return NULL;
|
switch(type){
|
case StringEscapeFormatSpecialChars:
|
result = escape_special_chars(arg_txt);
|
break;
|
case StringEscapeFormatOracle:
|
result = escape_to_numeric_entity(arg_txt);
|
break;
|
case StringEscapeFormatOracleFull:
|
result = escape_to_numeric_entity(arg_txt, true);
|
break;
|
case StringAsIs:
|
result = text_to_cstring(arg_txt);
|
break;
|
case StringEscapeFormatTextU:
|
result = escape_to_textU(arg_txt);
|
break;
|
case StringEscapeFormatCss:
|
result = escape_to_css(arg_txt);
|
break;
|
case StringEscapeLtGtChars:
|
default:
|
result = escape_ltgt_chars(arg_txt);
|
break;
|
}
|
return result;
|
}
|
static char *
|
get_numeric_argument_as_string(FunctionCallInfo fcinfo, int argnum)
|
{
|
/* Проверяем, не NULL ли аргумент */
|
if (PG_ARGISNULL(argnum))
|
return NULL;
|
|
/* Получаем Datum с аргументом типа NUMERIC */
|
Datum numeric_datum = PG_GETARG_DATUM(argnum);
|
|
/* Преобразуем NUMERIC в C-строку через выходную функцию типа */
|
Datum str_datum = DirectFunctionCall1(numeric_out, numeric_datum);
|
|
/* Возвращаем строку (char* уже в памяти palloc) */
|
return DatumGetCString(str_datum);
|
}
|
char* generate_applet_tag(const char *code, int width, bool width_is_set, int height, bool height_is_set, const char *other_attrs) {
|
xmlBufferPtr buf = xmlBufferCreate();
|
if (!buf) return NULL;
|
|
xmlOutputBufferPtr out = xmlOutputBufferCreateBuffer(buf, NULL);
|
if (!out) {
|
xmlBufferFree(buf);
|
return NULL;
|
}
|
|
// <applet code=...>
|
xmlOutputBufferWriteString(out, "<applet code=");
|
if(code){
|
xmlOutputBufferWriteString(out, code);
|
}
|
|
// width без кавычек
|
xmlOutputBufferWriteString(out, " width=");
|
if(width_is_set){
|
char wbuf[32];
|
snprintf(wbuf, sizeof(wbuf), "%d", width);
|
xmlOutputBufferWriteString(out, wbuf);
|
}
|
|
// height без кавычек
|
xmlOutputBufferWriteString(out, " height=");
|
if(height_is_set){
|
char hbuf[32];
|
snprintf(hbuf, sizeof(hbuf), "%d", height);
|
xmlOutputBufferWriteString(out, hbuf);
|
}
|
|
|
// other_attrs
|
if(other_attrs){
|
// если атрибуты заданы - добавляем без анализа
|
xmlOutputBufferWriteString(out, " "); // разделитель
|
xmlOutputBufferWriteString(out, other_attrs);
|
}
|
|
// Закрываем тег (не самозакрывающийся)
|
xmlOutputBufferWriteString(out, ">");
|
|
xmlOutputBufferFlush(out);
|
|
const xmlChar *content = xmlBufferContent(buf);
|
size_t len = xmlBufferLength(buf);
|
|
char *result = (char*)palloc(len + 1);
|
if (result) {
|
memcpy(result, content, len);
|
result[len] = '\0';
|
}
|
|
xmlOutputBufferClose(out); // также освобождает buf
|
return result; // освобождать через pfree()
|
}
|
|
char* generate_simple_tag(const char *ctext, const char *cattributes,
|
const int tag_basic_len, const char *tag_name) noexcept
|
{
|
char *result = nullptr;
|
int ctext_len = 0;
|
int cattr_len = 0;
|
bool inc_space = false;
|
|
if (ctext != nullptr)
|
{
|
ctext_len = strlen(ctext);
|
}
|
if (cattributes != nullptr)
|
{
|
cattr_len = strlen(cattributes);
|
if (cattr_len)
|
{
|
inc_space = true;
|
}
|
}
|
|
result = (char*)palloc0(ctext_len + cattr_len + tag_basic_len + 1);
|
|
sprintf(result, "<%s%s%s>%s</%s>", tag_name,
|
inc_space ? " " : "",
|
cattributes ? cattributes : "",
|
ctext ? ctext : "",
|
tag_name);
|
|
return result;
|
}
|
|
char *generate_blockquote_tag(bool cnowrap, const char *cclear, const char * cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<blockquote");
|
|
if(cclear){
|
appendStringInfo(result, " clear=\"%s\"", cclear);
|
}
|
if(cnowrap){
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_body_tag(const char *cbackground, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<body");
|
|
if(cbackground){
|
appendStringInfo(result, " background=\"%s\"", cbackground);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_dlist_tag(const char *cclear, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<dl");
|
|
if(cclear){
|
appendStringInfo(result, " clear=\"%s\"", cclear);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_form_tag(const char *curl, const char *cmethod, const char *ctarget, const char *cenctype, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<form");
|
|
if(curl){
|
appendStringInfo(result, " action=\"%s\"", curl);
|
}
|
if(cmethod){
|
appendStringInfo(result, " method=\"%s\"", cmethod);
|
}
|
if(ctarget){
|
appendStringInfo(result, " target=\"%s\"", ctarget);
|
}
|
if(cenctype){
|
appendStringInfo(result, " enctype=\"%s\"", cenctype);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_font_tag(const char *ccolor, const char *cface, const char *csize, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<font");
|
|
if(ccolor){
|
appendStringInfo(result, " color=\"%s\"", ccolor);
|
}
|
if(cface){
|
appendStringInfo(result, " face=\"%s\"", cface);
|
}
|
if(csize){
|
appendStringInfo(result, " size=\"%s\"", csize);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_formselect_tag(const char *cname, const char *cprompt, const char *csize, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
if(cprompt){
|
appendStringInfo(result, " %s", cprompt);
|
}
|
appendStringInfo(result, "<select");
|
|
if(cname){
|
appendStringInfo(result, " name=\"%s\"", cname);
|
}
|
if(csize){
|
appendStringInfo(result, " size=\"%s\"", csize);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_textarea_tag(const char *cname, const char *crows, const char *ccols, const char * calign, const char *cattributes,
|
const char *cwrap = NULL){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<textarea");
|
|
if(cname){
|
appendStringInfo(result, " name=\"%s\"", cname);
|
}
|
else
|
appendStringInfo(result, " name=\"\"");
|
if(crows){
|
appendStringInfo(result, " rows=\"%s\"", crows);
|
}
|
else
|
appendStringInfo(result, " rows=\"\"");
|
if(ccols){
|
appendStringInfo(result, " cols=\"%s\"", ccols);
|
}
|
else
|
appendStringInfo(result, " cols=\"\"");
|
if(calign){
|
appendStringInfo(result, " align=\"%s\"", calign);
|
}
|
if(cwrap){
|
appendStringInfo(result, " wrap=\"%s\"", cwrap);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_frameset_tag(const char *crows, const char *ccols, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<frameset");
|
|
if(crows){
|
appendStringInfo(result, " rows=\"%s\"", crows);
|
}
|
if(ccols){
|
appendStringInfo(result, " cols=\"%s\"", ccols);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_map_tag(const char *cname, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<map name=\"%s\"", cname ? cname : "");
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_olist_tag(const char *cclear, const char* cwrap, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<ol");
|
|
if(cclear){
|
appendStringInfo(result, " clear=\"%s\"", cclear);
|
}
|
if(cwrap){
|
appendStringInfo(result, " wrap=\"%s\"", cwrap);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_pre_tag(const char *cclear, const char* cwidth, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<pre");
|
|
if(cclear){
|
appendStringInfo(result, " clear=\"%s\"", cclear);
|
}
|
if(cwidth){
|
appendStringInfo(result, " width=\"%s\"", cwidth);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_table_tag(const char *cborder, const char* calign, const char *cnowrap, const char* cclear, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<table ");
|
|
if(cborder){
|
appendStringInfo(result, " %s", cborder);
|
}
|
if(cnowrap){
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if(calign){
|
appendStringInfo(result, " align=\"%s\"", calign);
|
}
|
if(cclear){
|
appendStringInfo(result, " clear=\"%s\"", cclear);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_tablerow_tag(const char *calign, const char* cvalign, const char *cdp, const char* cnowrap, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<tr");
|
|
if(calign){
|
appendStringInfo(result, " align=\"%s\"", calign);
|
}
|
if(cvalign){
|
appendStringInfo(result, " valign=\"%s\"", cvalign);
|
}
|
if(cdp){
|
appendStringInfo(result, " dp=\"%s\"", cdp);
|
}
|
if(cnowrap){
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_ulist_tag(const char *cclear, const char* cwrap, const char *cdingbat, const char* csrc, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<ul");
|
|
if(cclear){
|
appendStringInfo(result, " clear=\"%s\"", cclear);
|
}
|
if(cwrap){
|
appendStringInfo(result, " wrap=\"%s\"", cwrap);
|
}
|
if(cdingbat){
|
appendStringInfo(result, " dingbat=\"%s\"", cdingbat);
|
}
|
if(csrc){
|
appendStringInfo(result, " src=\"%s\"", csrc);
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_checkbox_tag(const char *cname, const char *cvalue, const char* cchecked, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"checkbox\"");
|
|
if(cname){
|
appendStringInfo(result, " name=\"%s\"", cname);
|
}
|
if(cvalue){
|
appendStringInfo(result, " value=\"%s\"", cvalue);
|
}
|
if(cchecked){
|
appendStringInfo(result, " checked=\"checked\"");
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
void append_attribute(StringInfo res, const char *name, const char *value){
|
if(name){
|
if(value)
|
appendStringInfo(res, " %s=\"%s\"", name, value);
|
}
|
}
|
void append_attribute_chk_len(StringInfo res, const char *tag_name,
|
const char *tag_value) noexcept {
|
if(tag_name != nullptr)
|
{
|
if(tag_value != nullptr && strlen(tag_value))
|
{
|
appendStringInfo(res, " %s=\"%s\"", tag_name, tag_value);
|
}
|
}
|
}
|
char* generate_file_tag(const char *cname, const char *caccept, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"file\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "accept", caccept);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_hidden_tag(const char *cname, const char *cvalue, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"hidden\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "value", cvalue);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_image_tag(const char *cname, const char *csrc, const char *calign, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"image\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "src", csrc);
|
append_attribute(result, "align", calign);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_password_tag(const char *cname, const char *csize, const char *cmaxlength, const char *cvalue, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"password\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "size", csize);
|
append_attribute(result, "maxlength", cmaxlength);
|
append_attribute(result, "value", cvalue);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_radio_tag(const char *cname, const char *cvalue, const char *cchecked, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"radio\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "value", cvalue);
|
if(cchecked){
|
appendStringInfo(result, " checked=\"checked\"");
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_reset_tag(const char *cvalue, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"reset\"");
|
|
append_attribute(result, "VALUE", cvalue);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_selectoption_tag(const char *cvalue, const char *cselected, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<option");
|
|
if(cselected){
|
appendStringInfo(result, " selected=\"selected\"");
|
}
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</option>", cvalue ? cvalue : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_submit_tag(const char *cname, const char *cvalue, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"submit\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "value", cvalue);
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_formtext_tag(const char *cname, const char *csize, const char *cmaxlength, const char *cvalue, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<input type=\"text\"");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "size", csize);
|
append_attribute(result, "maxlength", cmaxlength);
|
append_attribute(result, "value", cvalue);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_formtextarea_tag(const char *cname, const char *crows, const char *ccolumns, const char *calign, const char *cattributes,
|
const char *cwrap = NULL){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<textarea");
|
|
append_attribute(result, "name", cname);
|
append_attribute(result, "rows", crows);
|
append_attribute(result, "cols", ccolumns);
|
append_attribute(result, "align", calign);
|
append_attribute(result, "wrap", cwrap);
|
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, "></textarea>");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_address_tag(const char *cvalue, const char *cnowrap, const char *cclear, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<address");
|
|
append_attribute(result, "clear", cclear);
|
if(cnowrap){
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</address>", cvalue ? cvalue : "");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_anchor_tag(const char *curl, const char *ctext, const char *cname, const char *cattributes,
|
const char *ctarget = NULL){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<a");
|
|
append_attribute(result, "href", curl);
|
append_attribute(result, "name", cname);
|
append_attribute(result, "target", ctarget);
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</a>", ctext ? ctext : "");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_area_tag(const char *ccoord, const char *cshape, const char *chref, const char *cnohref, const char *ctarget, const char *cattributes){
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<area");
|
|
append_attribute(result, "shape", cshape);
|
append_attribute(result, "coord", ccoord);
|
append_attribute(result, "href", chref);
|
if(cnohref){
|
appendStringInfo(result, " nohref=\"nohref\"");
|
}
|
append_attribute(result, "target", ctarget);
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
return ret;
|
}
|
char* generate_em_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int em_tag_len = 10; // <em ></em> is 10 symbols
|
|
return generate_simple_tag(ctext, cattributes, em_tag_len, "em");
|
}
|
char* generate_frame_tag(const char *csrc, const char *cname, const char *cmarginwidth,
|
const char *cmarginheight, const char *cscrolling,
|
const char *cnoresize, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<frame src=\"");
|
|
appendStringInfo(result, "%s\"", csrc);
|
|
append_attribute_chk_len(result, "name", cname);
|
append_attribute_chk_len(result, "marginwidth", cmarginwidth);
|
append_attribute_chk_len(result, "marginheight", cmarginheight);
|
append_attribute_chk_len(result, "scrolling", cscrolling);
|
|
if(cnoresize != nullptr && strlen(cnoresize))
|
{
|
appendStringInfo(result, " noresize=\"noresize\"");
|
}
|
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
|
appendStringInfo(result, " />");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_header_tag(int32 clevel, bool clevel_is_set, const char *cheader, const char *calign,
|
const char *cnowrap, const char *cclear, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
char clevel_str[1 + 1] = {0};
|
|
if (clevel_is_set)
|
{
|
if (clevel < 0)
|
{
|
clevel *= -1;
|
}
|
if (clevel > 6)
|
{
|
clevel = 6;
|
}
|
sprintf(clevel_str, "%d", clevel);
|
}
|
appendStringInfo(result, "<h%s", clevel_str);
|
|
append_attribute_chk_len(result, "align", calign);
|
if(cnowrap != nullptr && strlen(cnowrap))
|
{
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
append_attribute_chk_len(result, "clear", cclear);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
|
appendStringInfo(result, ">%s</h%s>", cheader ? cheader : "", clevel_str);
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_dlistterm_tag(const char *ctext, const char *cclear, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<dt");
|
|
append_attribute_chk_len(result, "clear", cclear);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s", ctext ? ctext : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_base_tag(const char *ctarget, const char *cattributes) noexcept {
|
char* url = nullptr;
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<base");
|
|
/*
|
The HREF value is populated from the CGI environment variables intercepted
|
by the PL/SQL gateway (such as mod_plsql or ORDS) during the HTTP request.
|
Specifically, the gateway constructs the base document URL by
|
concatenating the CGI environment variables:
|
1. REQUEST_PROTOCOL (e.g., http or https)
|
2. HTTP_HOST (e.g., ://example.com)
|
3. SERVER_PORT (e.g., :80 or :443)
|
4. SCRIPT_NAME (e.g., /ords or /pls/apex)
|
5. PATH_INFO (e.g., /f)
|
*/
|
|
append_attribute_chk_len(result, "target", ctarget);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " href=\"http://%s\">", url ? url : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_basefont_tag(const char *csize) noexcept {
|
char *result = nullptr;
|
constexpr int bf_tag_len = 18; // <basefont size=""> is 18 symbols
|
int csize_len = 0;
|
|
if (csize != nullptr)
|
{
|
csize_len = strlen(csize);
|
}
|
|
result = (char*)palloc0(bf_tag_len + csize_len + 1);
|
|
sprintf(result, "<basefont size=\"%s\">", csize);
|
|
return result;
|
}
|
char* generate_bgsound_tag(const char *csrc, const char *cloop, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<bgsound src=\"%s\"", csrc ? csrc : "");
|
|
append_attribute_chk_len(result, "loop", cloop);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_big_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int big_tag_len = 12; // <big ></big> is 12 symbols
|
|
return generate_simple_tag(ctext, cattributes, big_tag_len, "big");
|
}
|
char* generate_bold_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int bold_tag_len = 8; // <b ></b> is 8 symbols
|
|
return generate_simple_tag(ctext, cattributes, bold_tag_len, "b");
|
}
|
char* generate_br_tag(const char *cclear, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<br");
|
|
append_attribute_chk_len(result, "clear", cclear);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_center_tag(const char *ctext) noexcept {
|
constexpr int center_tag_len = 17; // <center></center> is 17 symbols
|
|
return generate_simple_tag(ctext, NULL, center_tag_len, "center");
|
}
|
char* generate_cite_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int cite_tag_len = 14; // <cite ></cite> is 14 symbols
|
|
return generate_simple_tag(ctext, cattributes, cite_tag_len, "cite");
|
}
|
char* generate_code_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int code_tag_len = 14; // <code ></code> is 14 symbols
|
|
return generate_simple_tag(ctext, cattributes, code_tag_len, "code");
|
}
|
char* generate_comment_tag(const char *ctext) noexcept {
|
char *result = nullptr;
|
constexpr int comm_tag_len = 11; // <!-- '' --> is 11 symbols
|
int ctext_len = 0;
|
|
if (ctext != nullptr)
|
{
|
ctext_len = strlen(ctext);
|
}
|
|
result = (char*)palloc0(comm_tag_len + ctext_len + 1);
|
|
sprintf(result, "<!-- \'\'%s -->", ctext);
|
|
return result;
|
}
|
char* generate_dfn_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int dfn_tag_len = 12; // <dfn ></dfn> is 12 symbols
|
|
return generate_simple_tag(ctext, cattributes, dfn_tag_len, "dfn");
|
}
|
char* generate_div_tag(const char *calign, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<div");
|
|
append_attribute_chk_len(result, "align", calign);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_dlistdef_tag(const char *ctext, const char *cclear, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<dd");
|
|
append_attribute_chk_len(result, "clear", cclear);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s", ctext ? ctext : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_hr_tag(const char *cclear, const char *csrc, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<hr");
|
|
append_attribute_chk_len(result, "clear", cclear);
|
append_attribute_chk_len(result, "src", csrc);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_htitle_tag(const char *ctitle, const char *header_tag) noexcept {
|
char *result = nullptr;
|
constexpr int title_tag_len = 15; // <title></title> is 15 symbols
|
int ctitle_len = 0;
|
|
if (ctitle != nullptr)
|
{
|
ctitle_len = strlen(ctitle);
|
}
|
|
result = (char*)palloc0(title_tag_len + ctitle_len + strlen(header_tag) + 1);
|
|
sprintf(result, "<title>%s</title>%s", ctitle_len ? ctitle : "", header_tag);
|
|
return result;
|
}
|
char* generate_img_tag(const char *curl, const char *calign, const char *calt,
|
const char *cismap, const char *cusemap, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<img src=\"%s\"", curl ? curl : "");
|
|
append_attribute_chk_len(result, "align", calign);
|
append_attribute_chk_len(result, "alt", calt);
|
if (cismap != nullptr && strlen(cismap))
|
{
|
appendStringInfo(result, " ismap=\"ismap\"");
|
}
|
append_attribute_chk_len(result, "usemap", cusemap);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, " />");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_isindex_tag(const char *prompt, const char *curl) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<isindex");
|
append_attribute_chk_len(result, "prompt", prompt);
|
append_attribute_chk_len(result, "href", curl);
|
appendStringInfo(result, ">");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_italics_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int ita_tag_len = 8; // <i ></i> is 8 symbols
|
|
return generate_simple_tag(ctext, cattributes, ita_tag_len, "i");
|
}
|
char* generate_kbd_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int kbd_tag_len = 12; // <kbd ></kbd> is 12 symbols
|
|
return generate_simple_tag(ctext, cattributes, kbd_tag_len, "kbd");
|
}
|
char* generate_linkrel_tag(const char *crel, const char *curl, const char *ctitle,
|
const bool rev_mode) noexcept {
|
StringInfo result = makeStringInfo();
|
|
if (rev_mode)
|
{
|
appendStringInfo(result, "<link rev=\"%s\" ", crel ? crel : "");
|
}
|
else
|
{
|
appendStringInfo(result, "<link rel=\"%s\" ", crel ? crel : "");
|
}
|
appendStringInfo(result, "href=\"%s\"", curl ? curl : "");
|
append_attribute_chk_len(result, "title", ctitle);
|
appendStringInfo(result, ">");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_lh_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int lh_tag_len = 10; // <lh ></lh> is 10 symbols
|
|
return generate_simple_tag(ctext, cattributes, lh_tag_len, "lh");
|
}
|
char* generate_li_tag(const char *ctext, const char *cclear, const char *cdingbat,
|
const char *csrc, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<li");
|
append_attribute_chk_len(result, "clear", cclear);
|
append_attribute_chk_len(result, "dingbat", cdingbat);
|
append_attribute_chk_len(result, "src", csrc);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s", ctext ? ctext : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_mailto_tag(const char *caddress, const char *ctext, const char *cname,
|
const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<a href=\"mailto:%s\"", caddress ? caddress : "");
|
append_attribute_chk_len(result, "name", cname);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</a>", ctext ? ctext : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_meta_tag(const char *chttp_equiv, const char *cname,
|
const char *ccontent) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<a http-equiv=\"%s\" name=\"%s\" content=\"%s\">",
|
chttp_equiv ? chttp_equiv : "",
|
cname ? cname : "",
|
ccontent ? ccontent : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_nextid_tag(const char *cidentifier) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<nextid n=\"%s\">", cidentifier ? cidentifier : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_nobr_tag(const char *ctext) noexcept {
|
constexpr int nobr_tag_len = 13; // <nobr></nobr> is 13 symbols
|
|
return generate_simple_tag(ctext, NULL, nobr_tag_len, "nobr");
|
}
|
char* generate_paragraph_tag(const char *calign, const char *cnowrap,
|
const char *cclear, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
appendStringInfo(result, "<p");
|
|
append_attribute_chk_len(result, "align", calign);
|
append_attribute_chk_len(result, "clear", cclear);
|
if(cnowrap){
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if(cattributes){
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_param_tag(const char *cname, const char *cvalue) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<param name=%s value= \"%s\" >",
|
cname ? cname : "",
|
cvalue ? cvalue : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_pt_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int pt_tag_len = 24; // <plaintext ></plaintext> is 24 symbols
|
|
return generate_simple_tag(ctext, cattributes, pt_tag_len, "plaintext");
|
}
|
char* generate_s_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int s_tag_len = 8; // <s ></s> is 8 symbols
|
|
return generate_simple_tag(ctext, cattributes, s_tag_len, "s");
|
}
|
char* generate_strike_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int strike_tag_len = 18; // <strike ></strike> is 18 symbols
|
|
return generate_simple_tag(ctext, cattributes, strike_tag_len, "strike");
|
}
|
char* generate_samp_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int samp_tag_len = 14; // <samp ></samp> is 14 symbols
|
|
return generate_simple_tag(ctext, cattributes, samp_tag_len, "samp");
|
}
|
char* generate_small_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int small_tag_len = 16; // <small ></small> is 16 symbols
|
|
return generate_simple_tag(ctext, cattributes, small_tag_len, "small");
|
}
|
char* generate_script_tag(const char *cscript, const char *clanguage) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<script");
|
append_attribute_chk_len(result, "language", clanguage);
|
appendStringInfo(result, ">\'%s\'</script>", cscript ? cscript : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_strong_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int strong_tag_len = 18; // <strong ></strong> is 18 symbols
|
|
return generate_simple_tag(ctext, cattributes, strong_tag_len, "strong");
|
}
|
char* generate_style_tag(const char *cstyle) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<style>%s</style>", cstyle ? cstyle : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_sub_tag(const char *ctext, const char *calign,
|
const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<sub");
|
append_attribute_chk_len(result, "align", calign);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</sub>", ctext ? ctext : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_sup_tag(const char *ctext, const char *calign,
|
const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<sup");
|
append_attribute_chk_len(result, "align", calign);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</sup>", ctext ? ctext : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_tc_tag(const char *ccaption, const char *calign,
|
const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<caption");
|
append_attribute_chk_len(result, "align", calign);
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</caption>", ccaption ? ccaption : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_td_tag(const char *cvalue, const char *calign, const char *cdp,
|
const char *cnowrap, const char *crowspan,
|
const char *ccolspan, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<td");
|
append_attribute_chk_len(result, "align", calign);
|
append_attribute_chk_len(result, "dp", cdp);
|
append_attribute_chk_len(result, "rowspan", crowspan);
|
append_attribute_chk_len(result, "colspan", ccolspan);
|
if(cnowrap != nullptr && strlen(cnowrap))
|
{
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</td>", cvalue ? cvalue : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_th_tag(const char *cvalue, const char *calign, const char *cdp,
|
const char *cnowrap, const char *crowspan,
|
const char *ccolspan, const char *cattributes) noexcept {
|
StringInfo result = makeStringInfo();
|
|
appendStringInfo(result, "<th");
|
append_attribute_chk_len(result, "align", calign);
|
append_attribute_chk_len(result, "dp", cdp);
|
append_attribute_chk_len(result, "rowspan", crowspan);
|
append_attribute_chk_len(result, "colspan", ccolspan);
|
if(cnowrap != nullptr && strlen(cnowrap))
|
{
|
appendStringInfo(result, " nowrap=\"nowrap\"");
|
}
|
if (cattributes != nullptr && strlen(cattributes))
|
{
|
appendStringInfo(result, " %s", cattributes);
|
}
|
appendStringInfo(result, ">%s</th>", cvalue ? cvalue : "");
|
|
char *ret = pstrdup(result->data);
|
destroyStringInfo(result);
|
|
return ret;
|
}
|
char* generate_teletype_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int tt_tag_len = 10; // <tt ></tt> is 10 symbols
|
|
return generate_simple_tag(ctext, cattributes, tt_tag_len, "tt");
|
}
|
char* generate_title_tag(const char *ctext) noexcept {
|
constexpr int title_tag_len = 15; // <title></title> is 15 symbols
|
|
return generate_simple_tag(ctext, NULL, title_tag_len, "title");
|
}
|
char* generate_underline_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int underline_tag_len = 8; // <u ></u> is 8 symbols
|
|
return generate_simple_tag(ctext, cattributes, underline_tag_len, "u");
|
}
|
char* generate_variable_tag(const char *ctext, const char *cattributes) noexcept {
|
constexpr int variable_tag_len = 12; // <var ></var> is 12 symbols
|
|
return generate_simple_tag(ctext, cattributes, variable_tag_len, "var");
|
}
|
}// end namespace htp
|
|
extern "C"
|
{
|
|
PG_FUNCTION_INFO_V1(htp_get_data);
|
PG_FUNCTION_INFO_V1(htp_adddefaulthtmlhdr);
|
PG_FUNCTION_INFO_V1(htp_address);
|
PG_FUNCTION_INFO_V1(htp_anchor);
|
PG_FUNCTION_INFO_V1(htp_anchor2);
|
PG_FUNCTION_INFO_V1(htp_appletopen);
|
PG_FUNCTION_INFO_V1(htp_area);
|
PG_FUNCTION_INFO_V1(htp_base);
|
PG_FUNCTION_INFO_V1(htp_basefont);
|
PG_FUNCTION_INFO_V1(htp_bgsound);
|
PG_FUNCTION_INFO_V1(htp_big);
|
PG_FUNCTION_INFO_V1(htp_blockquoteopen);
|
PG_FUNCTION_INFO_V1(htp_bodyopen);
|
PG_FUNCTION_INFO_V1(htp_bold);
|
PG_FUNCTION_INFO_V1(htp_br);
|
PG_FUNCTION_INFO_V1(htp_center);
|
PG_FUNCTION_INFO_V1(htp_cite);
|
PG_FUNCTION_INFO_V1(htp_code);
|
PG_FUNCTION_INFO_V1(htp_comment);
|
PG_FUNCTION_INFO_V1(htp_dfn);
|
PG_FUNCTION_INFO_V1(htp_div);
|
PG_FUNCTION_INFO_V1(htp_dlistdef);
|
PG_FUNCTION_INFO_V1(htp_dlistopen);
|
PG_FUNCTION_INFO_V1(htp_dlistterm);
|
PG_FUNCTION_INFO_V1(htp_download_file);
|
PG_FUNCTION_INFO_V1(htp_em);
|
PG_FUNCTION_INFO_V1(htp_emphasis);
|
PG_FUNCTION_INFO_V1(htp_escape_oracle_full);
|
PG_FUNCTION_INFO_V1(htp_escape_sc);
|
PG_FUNCTION_INFO_V1(htp_flush_charset_convert);
|
PG_FUNCTION_INFO_V1(htp_fontopen);
|
PG_FUNCTION_INFO_V1(htp_formcheckbox);
|
PG_FUNCTION_INFO_V1(htp_formfile);
|
PG_FUNCTION_INFO_V1(htp_formhidden);
|
PG_FUNCTION_INFO_V1(htp_formimage);
|
PG_FUNCTION_INFO_V1(htp_formopen);
|
PG_FUNCTION_INFO_V1(htp_formpassword);
|
PG_FUNCTION_INFO_V1(htp_formradio);
|
PG_FUNCTION_INFO_V1(htp_formreset);
|
PG_FUNCTION_INFO_V1(htp_formselectopen);
|
PG_FUNCTION_INFO_V1(htp_formselectoption);
|
PG_FUNCTION_INFO_V1(htp_formsubmit);
|
PG_FUNCTION_INFO_V1(htp_formtext);
|
PG_FUNCTION_INFO_V1(htp_formtextarea);
|
PG_FUNCTION_INFO_V1(htp_formtextarea2);
|
PG_FUNCTION_INFO_V1(htp_formtextareaopen);
|
PG_FUNCTION_INFO_V1(htp_formtextareaopen2);
|
PG_FUNCTION_INFO_V1(htp_frame);
|
PG_FUNCTION_INFO_V1(htp_framesetopen);
|
PG_FUNCTION_INFO_V1(htp_get_download_files_list);
|
PG_FUNCTION_INFO_V1(htp_get_line);
|
PG_FUNCTION_INFO_V1(htp_get_page);
|
PG_FUNCTION_INFO_V1(htp_get_page_charset_convert);
|
PG_FUNCTION_INFO_V1(htp_get_page_raw);
|
PG_FUNCTION_INFO_V1(htp_header);
|
PG_FUNCTION_INFO_V1(htp_hr);
|
PG_FUNCTION_INFO_V1(htp_htitle);
|
PG_FUNCTION_INFO_V1(htp_img);
|
PG_FUNCTION_INFO_V1(htp_img2);
|
PG_FUNCTION_INFO_V1(htp_isindex);
|
PG_FUNCTION_INFO_V1(htp_italic);
|
PG_FUNCTION_INFO_V1(htp_kbd);
|
PG_FUNCTION_INFO_V1(htp_keyboard);
|
PG_FUNCTION_INFO_V1(htp_line);
|
PG_FUNCTION_INFO_V1(htp_linkrel);
|
PG_FUNCTION_INFO_V1(htp_linkrev);
|
PG_FUNCTION_INFO_V1(htp_listheader);
|
PG_FUNCTION_INFO_V1(htp_listitem);
|
PG_FUNCTION_INFO_V1(htp_mailto);
|
PG_FUNCTION_INFO_V1(htp_mapopen);
|
PG_FUNCTION_INFO_V1(htp_meta);
|
PG_FUNCTION_INFO_V1(htp_nextid);
|
PG_FUNCTION_INFO_V1(htp_nl);
|
PG_FUNCTION_INFO_V1(htp_nobr);
|
PG_FUNCTION_INFO_V1(htp_olistopen);
|
PG_FUNCTION_INFO_V1(htp_p_ovr1);
|
PG_FUNCTION_INFO_V1(htp_p_ovr2);
|
PG_FUNCTION_INFO_V1(htp_p_ovr3);
|
PG_FUNCTION_INFO_V1(htp_paragraph);
|
PG_FUNCTION_INFO_V1(htp_param);
|
PG_FUNCTION_INFO_V1(htp_plaintext);
|
PG_FUNCTION_INFO_V1(htp_preopen);
|
PG_FUNCTION_INFO_V1(htp_print_ovr1);
|
PG_FUNCTION_INFO_V1(htp_print_ovr2);
|
PG_FUNCTION_INFO_V1(htp_print_ovr3);
|
PG_FUNCTION_INFO_V1(htp_prints);
|
PG_FUNCTION_INFO_V1(htp_print_header);
|
PG_FUNCTION_INFO_V1(htp_prn_ovr1);
|
PG_FUNCTION_INFO_V1(htp_prn_ovr2);
|
PG_FUNCTION_INFO_V1(htp_prn_ovr3);
|
PG_FUNCTION_INFO_V1(htp_ps);
|
PG_FUNCTION_INFO_V1(htp_putraw);
|
PG_FUNCTION_INFO_V1(htp_s);
|
PG_FUNCTION_INFO_V1(htp_sample);
|
PG_FUNCTION_INFO_V1(htp_script);
|
PG_FUNCTION_INFO_V1(htp_sethttpcharset);
|
PG_FUNCTION_INFO_V1(htp_set_transfer_mode);
|
PG_FUNCTION_INFO_V1(htp_small);
|
PG_FUNCTION_INFO_V1(htp_strike);
|
PG_FUNCTION_INFO_V1(htp_strong);
|
PG_FUNCTION_INFO_V1(htp_style);
|
PG_FUNCTION_INFO_V1(htp_sub);
|
PG_FUNCTION_INFO_V1(htp_sup);
|
PG_FUNCTION_INFO_V1(htp_tablecaption);
|
PG_FUNCTION_INFO_V1(htp_tabledata);
|
PG_FUNCTION_INFO_V1(htp_tableheader);
|
PG_FUNCTION_INFO_V1(htp_tableopen);
|
PG_FUNCTION_INFO_V1(htp_tablerowopen);
|
PG_FUNCTION_INFO_V1(htp_teletype);
|
PG_FUNCTION_INFO_V1(htp_title);
|
PG_FUNCTION_INFO_V1(htp_ulistopen);
|
PG_FUNCTION_INFO_V1(htp_underline);
|
PG_FUNCTION_INFO_V1(htp_variable);
|
|
PG_FUNCTION_INFO_V1(htp_appletclose);
|
PG_FUNCTION_INFO_V1(htp_blockquoteclose);
|
PG_FUNCTION_INFO_V1(htp_bodyclose);
|
PG_FUNCTION_INFO_V1(htp_centerclose);
|
PG_FUNCTION_INFO_V1(htp_centeropen);
|
PG_FUNCTION_INFO_V1(htp_dirlistclose);
|
PG_FUNCTION_INFO_V1(htp_dirlistopen);
|
PG_FUNCTION_INFO_V1(htp_dlistclose);
|
PG_FUNCTION_INFO_V1(htp_flush);
|
PG_FUNCTION_INFO_V1(htp_fontclose);
|
PG_FUNCTION_INFO_V1(htp_formclose);
|
PG_FUNCTION_INFO_V1(htp_formselectclose);
|
PG_FUNCTION_INFO_V1(htp_formtextareaclose);
|
PG_FUNCTION_INFO_V1(htp_framesetclose);
|
PG_FUNCTION_INFO_V1(htp_headclose);
|
PG_FUNCTION_INFO_V1(htp_headopen);
|
PG_FUNCTION_INFO_V1(htp_htmlclose);
|
PG_FUNCTION_INFO_V1(htp_htmlopen);
|
PG_FUNCTION_INFO_V1(htp_init);
|
PG_FUNCTION_INFO_V1(htp_listingclose);
|
PG_FUNCTION_INFO_V1(htp_listingopen);
|
PG_FUNCTION_INFO_V1(htp_mapclose);
|
PG_FUNCTION_INFO_V1(htp_menulistclose);
|
PG_FUNCTION_INFO_V1(htp_menulistopen);
|
PG_FUNCTION_INFO_V1(htp_noframesclose);
|
PG_FUNCTION_INFO_V1(htp_noframesopen);
|
PG_FUNCTION_INFO_V1(htp_olistclose);
|
PG_FUNCTION_INFO_V1(htp_para);
|
PG_FUNCTION_INFO_V1(htp_preclose);
|
PG_FUNCTION_INFO_V1(htp_reset_get_page);
|
PG_FUNCTION_INFO_V1(htp_showpage);
|
PG_FUNCTION_INFO_V1(htp_tableclose);
|
PG_FUNCTION_INFO_V1(htp_tablerowclose);
|
PG_FUNCTION_INFO_V1(htp_ulistclose);
|
PG_FUNCTION_INFO_V1(htp_wbr);
|
|
/**
|
* @brief HTP output function
|
* @details Outputs full HTP buffer by ereport
|
* * * * *
|
*/
|
Datum htp_get_data(PG_FUNCTION_ARGS)
|
{
|
if (add_hdr_mode)
|
{
|
ereport(NOTICE, (errmsg("HTML: \nContent-type: text/html\n"
|
"Content-length: %d\n%s", static_cast<int>(html_buffer.size()),
|
html_buffer.c_str())));
|
}
|
else
|
{
|
ereport(NOTICE, (errmsg("HTML: \n%s", html_buffer.c_str())));
|
}
|
|
html_buffer.clear();
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Enables/disables content type html header
|
* @details This procedure enables/disables generation the Content-type/Content-length header to the buffer
|
* * Parameters:
|
* * @param BADDHTMLHDR (in) BOOLEAN: enables header
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_adddefaulthtmlhdr(PG_FUNCTION_ARGS)
|
{
|
bool enable_hdr = PG_GETARG_BOOL(0);
|
|
if (enable_hdr)
|
{
|
add_hdr_mode = true;
|
}
|
else
|
{
|
add_hdr_mode = false;
|
}
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<ADDRESS>and</ADDRESS>tags which specify the address, author and signature of a document.
|
* @details This procedure generates the<ADDRESS>and</ADDRESS>tags which specify the address, author and signature of a document.
|
* * Parameters:
|
* * @param CVALUE (in) VARCHAR2: The string that goes between the<ADDRESS>and</ADDRESS>tags.
|
* * @param CNOWRAP (in) VARCHAR2: If the value for this parameter is notNULL, theNOWRAPattribute is included in the tag
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_address(PG_FUNCTION_ARGS)
|
{
|
char *cvalue = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cnowrap = htp::get_string_argument(fcinfo, 1, htp::StringAsIs);
|
char *cclear = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_address_tag(cvalue, cnowrap, cclear, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cvalue, cnowrap, cclear, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Like the ANCHOR2 procedure, this procedure generates the<A>and</A>HTML tags which specify the source or destination of a hypertext link.
|
* @details Like the ANCHOR2 procedure, this procedure generates the<A>and</A>HTML tags which specify the source or destination of a hypertext link.
|
* * Parameters:
|
* * @param CURL (in) VARCHAR2: The value for theHREFattribute.
|
* * @param CTEXT (in) VARCHAR2: The string that goes between the<A>and</A>tags.
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_anchor(PG_FUNCTION_ARGS)
|
{
|
char *curl = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *ctext = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracleFull);
|
char *cname = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_anchor_tag(curl, ctext, cname, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(curl, ctext, cname, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Like the ANCHOR procedure, this procedure generates the<A>and</A>HTML tags which specify the source or destination of a hypertext link.
|
* @details Like the ANCHOR procedure, this procedure generates the<A>and</A>HTML tags which specify the source or destination of a hypertext link.
|
* * Parameters:
|
* * @param CURL (in) VARCHAR2: The value for theHREFattribute.
|
* * @param CTEXT (in) VARCHAR2: The string that goes between the<A>and</A>tags.
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute
|
* * @param CTARGET (in) VARCHAR2: The value for theTARGETattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_anchor2(PG_FUNCTION_ARGS)
|
{
|
char *curl = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *ctext = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracleFull);
|
char *cname = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *ctarget = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_anchor_tag(curl, ctext, cname, cattributes, ctarget);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(curl, ctext, cname, ctarget, cattributes, tag);
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<APPLET>tag which begins the invocation of a Java applet.
|
* @details This procedure generates the<APPLET>tag which begins the invocation of a Java applet.
|
|
Specify parameters to the Java applet using thePARAM Procedure.
|
Use thecattributesparameter to specify theCODEBASEattribute since the PL/SQL cartridge does not know where to find the class files. TheCODEBASEattribute specifies the virtual path containing the class files.
|
* * Parameters:
|
* * @param CCODE (in) VARCHAR2: The the value for theCODEattribute which specifies the name of the applet class.
|
* * @param CWIDTH (in) NUMBER: The value for theWIDTHattribute.
|
* * @param CHEIGHT (in) NUMBER: The value for theHEIGHTattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_appletopen(PG_FUNCTION_ARGS)
|
{
|
Numeric cwidth_num = PG_ARGISNULL(1) ? NULL : PG_GETARG_NUMERIC(1);
|
Numeric cheight_num = PG_ARGISNULL(2) ? NULL : PG_GETARG_NUMERIC(2);
|
char *ccode = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
int32 cwidth = 0;
|
int32 cheight = 0;
|
bool cwidth_is_set = false;
|
bool cheight_is_set = false;
|
|
if(cwidth_num){
|
cwidth = DatumGetInt32(DirectFunctionCall1(numeric_int4, NumericGetDatum(cwidth_num)));
|
cwidth_is_set = true;
|
}
|
if(cheight_num){
|
cheight = DatumGetInt32(DirectFunctionCall1(numeric_int4, NumericGetDatum(cheight_num)));
|
cheight_is_set = true;
|
}
|
|
char *tag = htp::generate_applet_tag(ccode, cwidth, cwidth_is_set, cheight, cheight_is_set, cattributes);
|
htp::html_buffer_add(tag);
|
pfree(tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <AREA> tag, which defines a client-side image map. The <AREA> tag defines areas within the image and destinations for the areas.
|
* @details This procedure generates the <AREA> tag, which defines a client-side image map. The <AREA> tag defines areas within the image and destinations for the areas.
|
* * Parameters:
|
* * @param CCOORDS (in) VARCHAR2: The value for the COORDS attribute
|
* * @param CSHAPE (in) VARCHAR2: The value for the SHAPE attribute.
|
* * @param CHREF (in) VARCHAR2: The value for the HREF attribute.
|
* * @param CNOHREF (in) VARCHAR2: If the value for this parameter is not NULL, the NOHREF attribute is added to the tag.
|
* * @param CTARGET (in) VARCHAR2: The value for the TARGET attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_area(PG_FUNCTION_ARGS)
|
{
|
char *ccoords = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cshape = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *chref = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatSpecialChars);
|
char *cnohref = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *ctarget = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 5);
|
|
char *tag = htp::generate_area_tag(ccoords, cshape, chref, cnohref, ctarget, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(ccoords, cshape, chref, cnohref, ctarget, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <BASE> tag which records the URL of the document.
|
* @details This procedure generates the <BASE> with ref attribute keeping the URL of the document.
|
* * Parameters:
|
* * @param CTARGET (in) VARCHAR2: The value for the TARGET attribute which establishes a window name to which all links in this document are targeted.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_base(PG_FUNCTION_ARGS)
|
{
|
char *ctarget = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_base_tag(ctarget, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(ctarget, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <BASEFONT> tag which specifies the base font size for a Web page.
|
* @details This procedure generates the <BASEFONT> tag which specifies the base font size for a Web page.
|
* * Parameters:
|
* * @param NSIZE (in) NUMBER: The value for the SIZE attribute.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_basefont(PG_FUNCTION_ARGS)
|
{
|
char *csize = htp::get_numeric_argument_as_string(fcinfo, 0);
|
|
char *tag = htp::generate_basefont_tag(csize);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(csize);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <BGSOUND> tag which includes audio for a Web page.
|
* @details This procedure generates the <BGSOUND> tag which includes audio for a Web page.
|
* * Parameters:
|
* * @param CSRC (in) VARCHAR2: The value for the SRC attribute.
|
* * @param CLOOP (in) VARCHAR2: The value for the LOOP attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_bgsound(PG_FUNCTION_ARGS)
|
{
|
char *csrc = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cloop = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_bgsound_tag(csrc, cloop, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(csrc, cloop, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <BIG> and </BIG> tags which direct the browser to render the text in a bigger font.
|
* @details This procedure generates the <BIG> and </BIG> tags which direct the browser to render the text in a bigger font.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The the text that goes between the tags.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_big(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_big_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<BLOCKQUOTE>tag, which marks the beginning of a section of quoted text.
|
* @details This procedure generates the<BLOCKQUOTE>tag, which marks the beginning of a section of quoted text.
|
* * Parameters:
|
* * @param CNOWRAP (in) VARCHAR2: If the value for this parameter is notNULL, theNOWRAPattribute is added to the tag.
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_blockquoteopen(PG_FUNCTION_ARGS)
|
{
|
text *cnowrap_txt = PG_ARGISNULL(0) ? NULL : PG_GETARG_TEXT_PP(0);
|
bool nowrap = false;
|
char *cclear = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
if(cnowrap_txt && VARSIZE_ANY_EXHDR(cnowrap_txt)!=0) {
|
nowrap = true;
|
}
|
|
char *tag = htp::generate_blockquote_tag(nowrap, cclear, cattributes);
|
htp::html_buffer_add(tag);
|
|
pfree(tag);
|
if(cclear)
|
pfree(cclear);
|
if(cattributes)
|
pfree(cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<BODY>tag which marks the beginning of the body section of an HTML document.
|
* @details This procedure generates the<BODY>tag which marks the beginning of the body section of an HTML document.
|
* * Parameters:
|
* * @param CBACKGROUND (in) VARCHAR2: The value for theBACKGROUNDattribute which specifies a graphic file to use for the background of the document.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_bodyopen(PG_FUNCTION_ARGS)
|
{
|
char *cbackground = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_body_tag(cbackground, cattributes);
|
htp::html_buffer_add(tag);
|
|
pfree(tag);
|
|
if(cbackground)
|
pfree(cbackground);
|
if(cattributes)
|
pfree(cattributes);
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <B> and </B> tags which direct the browser to display the text in boldface.
|
* @details This procedure generates the <B> and </B> tags which direct the browser to display the text in boldface.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text that goes between the tags.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_bold(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_bold_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <BR> tag which begins a new line of text.
|
* @details This procedure generates the <BR> tag which begins a new line of text.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_br(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_br_tag(cclear, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, cclear, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <CENTER> and </CENTER> tags which center a section of text within a Web page.
|
* @details This procedure generates the <CENTER> and </CENTER> tags which center a section of text within a Web page.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text that goes between the tags.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_center(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
|
char *tag = htp::generate_center_tag(ctext);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <CITE> and </CITE> tags which direct the browser to render the text as a citation.
|
* @details This procedure generates the <CITE> and </CITE> tags which direct the browser to render the text as a citation.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render as citation.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_cite(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_cite_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <CODE> and </CODE> tags which direct the browser to render the text in monospace font or however "code" is defined stylistically.
|
* @details This procedure generates the <CODE> and </CODE> tags which direct the browser to render the text in monospace font or however "code" is defined stylistically.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render as code.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_code(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_code_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the comment <!--'' --> tags.
|
* @details This procedure generates the comment <!--'' --> tags.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The comment.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_comment(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
|
char *tag = htp::generate_comment_tag(ctext);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <DFN> and </DFN> tags which direct the browser to mark the text in italics or however "definition" is described stylistically.
|
* @details This procedure generates the <DFN> and </DFN> tags which direct the browser to mark the text in italics or however "definition" is described stylistically.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render in italics.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_dfn(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_dfn_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <DIV> tag which creates document divisions.
|
* @details This procedure generates the <DIV> tag which creates document divisions.
|
* * Parameters:
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_div(PG_FUNCTION_ARGS)
|
{
|
char *calign = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_div_tag(calign, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, calign, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <DD> tag, which inserts definitions of terms. Use this tag for a definition list <DL>.
|
* @details This procedure generates the <DD> tag, which inserts definitions of terms. Use this tag for a definition list <DL>. Terms are tagged <DT> and definitions are tagged <DD>.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The definition of the term.
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_dlistdef(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cclear = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_dlistdef_tag(ctext, cclear, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cclear, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<DL>tag which starts a definition list. You end a definition list by means of the DLISTCLOSE Procedure.
|
* @details This procedure generates the<DL>tag which starts a definition list. You end a definition list by means of the DLISTCLOSE Procedure.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_dlistopen(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_dlist_tag(cclear, cattributes);
|
htp::html_buffer_add(tag);
|
|
pfree(tag);
|
if(cclear)
|
pfree(cclear);
|
if(cattributes)
|
pfree(cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<DT>tag which defines a term in a definition list<DL>.
|
* @details This procedure generates the<DT>tag which defines a term in a definition list<DL>.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The term.
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_dlistterm(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cclear = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_dlistterm_tag(ctext, cclear, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(ctext, cclear, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Download files from the database (Not implemented)
|
* @details After uploading files to the database, you can download them, delete them from the database, and read and write their attributes.
|
* * Parameters:
|
* * @param SFILENAME (in) VARCHAR2: file to be downloaded.
|
* * @param BCOMPRESS (in) BOOLEAN: to compress file or not.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_download_file(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.download_file не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<EM>and</EM>tags, which define text to be emphasized.
|
* @details Generates the<EM>and</EM>tags by including preprocessed cattributes parameter as tag
|
* attribute and preprocessed ctext parameter as the tag body.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to emphasize.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_em(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_em_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<EM>and</EM>tags, which define text to be emphasized.
|
* @details Generates the<EM>and</EM>tags by including preprocessed cattributes parameter as the tag
|
* attribute and preprocessed ctext parameter as the tag body.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to emphasize.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_emphasis(PG_FUNCTION_ARGS)
|
{
|
char *ctext = NULL;
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
text *textarg = PG_ARGISNULL(0) ? NULL : PG_GETARG_TEXT_PP(0);
|
|
LOCAL_FCINFO(local_fcinfo, 1);
|
InitFunctionCallInfoData(*local_fcinfo, NULL, 1, PG_GET_COLLATION(), fcinfo->context, NULL);
|
local_fcinfo->args[0].value = PointerGetDatum(textarg);
|
local_fcinfo->args[0].isnull = (textarg == NULL ? true : false);
|
Datum esc_text_datum = (*htf_escape_oracle_full) (local_fcinfo);
|
text *esc_text = NULL;
|
if (DatumGetPointer(esc_text_datum) != NULL) {
|
esc_text = DatumGetTextPP(esc_text_datum);
|
}
|
|
if(esc_text)
|
ctext = text_to_cstring(esc_text);
|
|
char *tag = htp::generate_em_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
if(esc_text)
|
pfree(esc_text);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief заменяет символы, имеющие специальное значение в HTML, их escape-последовательностями.
|
* @details Функция преобразует символы <, >, & и другие в HTML-сущности для безопасного отображения.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: Строка для преобразования.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTF.html
|
*/
|
Datum htp_escape_oracle_full(PG_FUNCTION_ARGS)
|
{
|
char *res_str = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
if(res_str){
|
text *result = cstring_to_text(res_str);
|
pfree(res_str);
|
PG_RETURN_TEXT_P(result);
|
}
|
|
PG_RETURN_NULL();
|
}
|
|
/**
|
* @brief This procedure replaces characters that have special meaning in HTML with their escape sequences.
|
* @details This procedure replaces characters that have special meaning in HTML with their escape sequences.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text string to convert.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_escape_sc(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
|
if (ctext != nullptr && strlen(ctext))
|
{
|
htp::html_buffer_add(ctext);
|
}
|
|
htp::pfree_all(ctext);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Push buffered HTML content with convertation
|
* @details Push buffered HTML content to the browser while simultaneously converting the character set of the output.
|
* * Parameters:
|
* * @param CHARSET (in) VARCHAR2: character set of the output
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_flush_charset_convert(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.flush_charset_convert не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<FONT>which marks the beginning of section of text with the specified font characteristics.
|
* @details This procedure generates the<FONT>which marks the beginning of section of text with the specified font characteristics.
|
* * Parameters:
|
* * @param CCOLOR (in) VARCHAR2: The value for theCOLORattribute.
|
* * @param CFACE (in) VARCHAR2: The value for theFACEattribute
|
* * @param CSIZE (in) VARCHAR2: The value for theSIZEattribute
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_fontopen(PG_FUNCTION_ARGS)
|
{
|
char *ccolor = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cface = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *csize = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_font_tag(ccolor, cface, csize, cattributes);
|
htp::html_buffer_add(tag);
|
|
htp::pfree_all(ccolor, cface, csize, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="checkbox"which inserts a checkbox element in a form.
|
* @details This procedure generates the<INPUT>tag withTYPE="checkbox"which inserts a checkbox element in a form.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CCHECKED (in) VARCHAR2: If the value for this parameter is notNULL, theCHECKEDattribute is added to the tag.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formcheckbox(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cvalue = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cchecked = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
char *tag = htp::generate_checkbox_tag(cname, cvalue, cchecked, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, cvalue, cchecked, cattributes, tag);
|
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="file"which inserts a file form element. This is used for file uploading for a given page.
|
* @details This procedure generates the<INPUT>tag withTYPE="file"which inserts a file form element. This is used for file uploading for a given page.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CACCEPT (in) VARCHAR2: A comma-delimited list of MIME types for upload.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formfile(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *caccept = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
char *tag = htp::generate_file_tag(cname, caccept, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, caccept, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag with TYPE="hidden", which inserts a hidden form element.
|
* @details This procedure generates the<INPUT>tag with TYPE="hidden", which inserts a hidden form element.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formhidden(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *value = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
char *tag = htp::generate_hidden_tag(cname, value, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, value, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="image"which creates an image field that the user clicks to submit the form immediately.
|
* @details This procedure generates the<INPUT>tag withTYPE="image"which creates an image field that the user clicks to submit the form immediately.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CSRC (in) VARCHAR2: The value for theSRCattribute that specifies the image file.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formimage(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *csrc = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *calign = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_image_tag(cname, csrc, calign, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, csrc, calign, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<FORM>tag which marks the beginning of a form section in an HTML document.
|
* @details This procedure generates the<FORM>tag which marks the beginning of a form section in an HTML document.
|
* * Parameters:
|
* * @param CURL (in) VARCHAR2: The URL of the WRB or CGI script where the contents of the form is sent. This parameter is required.
|
* * @param CMETHOD (in) VARCHAR2: The value for theMETHODattribute. The value can be "GET" or "POST".
|
* * @param CTARGET (in) VARCHAR2: The value for theTARGETattribute.
|
* * @param CENCTYPE (in) VARCHAR2: The value for theENCTYPEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formopen(PG_FUNCTION_ARGS)
|
{
|
char *curl = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *cmethod = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *ctarget = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cenctype = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_form_tag(curl, cmethod, ctarget, cenctype, cattributes);
|
htp::html_buffer_add(tag);
|
|
htp::pfree_all(curl, cmethod, ctarget, cenctype, cattributes, tag);
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="password"which creates a single-line text entry field. When the user enters text in the field, each character is represented by one asterisk. This is used for entering passwords.
|
* @details This procedure generates the<INPUT>tag withTYPE="password"which creates a single-line text entry field. When the user enters text in the field, each character is represented by one asterisk. This is used for entering passwords.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CSIZE (in) VARCHAR2: The value for theSIZEattribute.
|
* * @param CMAXLENGTH (in) VARCHAR2: The value for theMAXLENGTHattribute.
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formpassword(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *csize = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cmaxlength = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cvalue = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_password_tag(cname, csize, cmaxlength, cvalue, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, csize, cmaxlength, cvalue, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="radio", which creates a radio button on the HTML form. Within a set of radio buttons, the user selects only one. Each radio button in the same set has the same name, but different values. The selected radio button generates a name/value pair.
|
* @details This procedure generates the<INPUT>tag withTYPE="radio", which creates a radio button on the HTML form. Within a set of radio buttons, the user selects only one. Each radio button in the same set has the same name, but different values. The selected radio button generates a name/value pair.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CCHECKED (in) VARCHAR2: If the value for this parameter is notNULL, theCHECKEDattribute is added to the tag.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formradio(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cvalue = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cchecked = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_radio_tag(cname, cvalue, cchecked, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, cvalue, cchecked, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="reset"which creates a button that, when selected, resets the form fields to their initial values.
|
* @details This procedure generates the<INPUT>tag withTYPE="reset"which creates a button that, when selected, resets the form fields to their initial values.
|
* * Parameters:
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formreset(PG_FUNCTION_ARGS)
|
{
|
char *cvalue = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_reset_tag(cvalue, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cvalue, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<SELECT>tags which creates a Select form element.
|
* @details This procedure generates the<SELECT>tags which creates a Select form element.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CPROMPT (in) VARCHAR2: The string preceding the list box.
|
* * @param NSIZE (in) NUMBER: The value for theSIZEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formselectopen(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cprompt = htp::get_string_argument(fcinfo, 1);
|
char *csize = htp::get_numeric_argument_as_string(fcinfo, 2);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_formselect_tag(cname, cprompt, csize, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, cprompt, csize, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <OPTION> tag which represents one choice in a Select element.
|
* @details This procedure generates the <OPTION> tag which represents one choice in a Select element.
|
* * Parameters:
|
* * @param CVALUE (in) VARCHAR2: The text for the option.
|
* * @param CSELECTED (in) VARCHAR2: If the value for this parameter is not NULL, the SELECTED attribute is added to the tag.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formselectoption(PG_FUNCTION_ARGS)
|
{
|
char *cvalue = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *cselected = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_selectoption_tag(cvalue, cselected, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cvalue, cselected, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="submit"which creates a button that, when clicked, submits the form. If the button has aNAMEattribute, the button contributes a name/value pair to the submitted data.
|
* @details This procedure generates the<INPUT>tag withTYPE="submit"which creates a button that, when clicked, submits the form. If the button has aNAMEattribute, the button contributes a name/value pair to the submitted data.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formsubmit(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cvalue = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_submit_tag(cname, cvalue, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, cvalue, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<INPUT>tag withTYPE="text", which creates a field for a single line of text.
|
* @details This procedure generates the<INPUT>tag withTYPE="text", which creates a field for a single line of text.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param CSIZE (in) VARCHAR2: The value for theSIZEattribute.
|
* * @param CMAXLENGTH (in) VARCHAR2: The value for theMAXLENGTHattribute.
|
* * @param CVALUE (in) VARCHAR2: The value for theVALUEattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formtext(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *csize = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cmaxlength = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cvalue = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_formtext_tag(cname, csize, cmaxlength, cvalue, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, csize, cmaxlength, cvalue, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<TEXTAREA>tag, which creates a text field that has no predefined text in the text area. This field enables entering several lines of text.
|
* @details This procedure generates the<TEXTAREA>tag, which creates a text field that has no predefined text in the text area. This field enables entering several lines of text.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param NROWS (in) NUMBER: The value for theROWSattribute.This is an integer.
|
* * @param NCOLUMNS (in) NUMBER: The value for theCOLSattribute.This is an integer.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formtextarea(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *crows = htp::get_numeric_argument_as_string(fcinfo, 1);
|
char *ccolumns = htp::get_numeric_argument_as_string(fcinfo, 2);
|
char *calign = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_formtextarea_tag(cname, crows, ccolumns, calign, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, crows, ccolumns, calign, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<TEXTAREA>tag, which creates a text field that has no predefined text in the text area. This field enables entering several lines of text.
|
* @details This procedure generates the<TEXTAREA>tag, which creates a text field that has no predefined text in the text area. This field enables entering several lines of text.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param NROWS (in) NUMBER: The value for theROWSattribute.This is an integer.
|
* * @param NCOLUMNS (in) NUMBER: The value for theCOLSattribute.This is an integer.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CWRAP (in) VARCHAR2: The value for theWRAPattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formtextarea2(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *crows = htp::get_numeric_argument_as_string(fcinfo, 1);
|
char *ccolumns = htp::get_numeric_argument_as_string(fcinfo, 2);
|
char *calign = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cwrap = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 5);
|
|
char *tag = htp::generate_formtextarea_tag(cname, crows, ccolumns, calign, cattributes, cwrap);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, crows, ccolumns, calign, cattributes, cwrap, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<TEXTAREA>which marks the beginning of a text area form element.
|
* @details This procedure generates the<TEXTAREA>which marks the beginning of a text area form element.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param NROWS (in) NUMBER: The value for theROWSattribute.This is an integer.
|
* * @param NCOLUMNS (in) NUMBER: The value for theCOLSattribute.This is an integer.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formtextareaopen(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *crows = htp::get_numeric_argument_as_string(fcinfo, 1);
|
char *ccolumns = htp::get_numeric_argument_as_string(fcinfo, 2);
|
char *calign = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_textarea_tag(cname, crows, ccolumns, calign, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, crows, ccolumns, calign, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<TEXTAREA>which marks the beginning of a text area form element.
|
* @details This procedure generates the<TEXTAREA>which marks the beginning of a text area form element.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for theNAMEattribute.
|
* * @param NROWS (in) NUMBER: The value for theROWSattribute.This is an integer.
|
* * @param NCOLUMNS (in) NUMBER: The value for theCOLSattribute.This is an integer.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CWRAP (in) VARCHAR2: The value for theWRAPattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_formtextareaopen2(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *crows = htp::get_numeric_argument_as_string(fcinfo, 1);
|
char *ccolumns = htp::get_numeric_argument_as_string(fcinfo, 2);
|
char *calign = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cwrap = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 5);
|
|
char *tag = htp::generate_textarea_tag(cname, crows, ccolumns, calign, cattributes, cwrap);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, crows, ccolumns, calign, cwrap, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <FRAME> tag which begins the characteristics of a frame created by a <FRAMESET> tag.
|
* @details This procedure generates the <FRAME> tag which begins the characteristics of a frame created by a <FRAMESET> tag.
|
* * Parameters:
|
* * @param CSRC (in) VARCHAR2: The URL to display in the frame.
|
* * @param CNAME (in) VARCHAR2: The value for the NAME attribute.
|
* * @param CMARGINWIDTH (in) VARCHAR2: The value for the MARGINWIDTH attribute.
|
* * @param CMARGINHEIGHT (in) VARCHAR2: The value for the MARGINHEIGHT attribute.
|
* * @param CSCROLLING (in) VARCHAR2: The value for the SCROLLING attribute.
|
* * @param CNORESIZE (in) VARCHAR2: If the value for this parameter is notNULL, the NORESIZE attribute is added to the tag.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_frame(PG_FUNCTION_ARGS)
|
{
|
char *csrc = htp::get_string_argument(fcinfo, 0, htp::StringAsIs);
|
char *cname = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cmarginwidth = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cmarginheight = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cscrolling = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cnoresize = htp::get_string_argument(fcinfo, 5, htp::StringAsIs);
|
char *cattributes = htp::get_string_argument(fcinfo, 6);
|
|
char *tag = htp::generate_frame_tag(csrc, cname, cmarginwidth, cmarginheight, cscrolling,
|
cnoresize, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(csrc, cname, cmarginwidth, cmarginheight, cscrolling, cnoresize, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<FRAMESET>tag which define a frameset section.
|
* @details This procedure generates the<FRAMESET>tag which define a frameset section.
|
* * Parameters:
|
* * @param CROWS (in) VARCHAR2: The value for theROWSattribute.
|
* * @param CCOLS (in) VARCHAR2: The value for theCOLSattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_framesetopen(PG_FUNCTION_ARGS)
|
{
|
char *crows = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *ccols = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_frameset_tag(crows, ccols, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(crows, ccols, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief After you have downloaded files to the database, you need to get the files.
|
* @details After you have downloaded files to the database, you need to get the files.
|
* * Parameters:
|
* * * @param SFILESLIST (out) VARCHAR2: file to get
|
* * * @param NCOMPRESS (out) BINARY_INTEGER: to compress file or not.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_get_download_files_list(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.get_download_files_list не реализована.")));
|
|
PG_RETURN_NULL();
|
}
|
|
/**
|
* @brief Retrieve a single line of HTML output from the HTP buffer.
|
* @details Retrieve a single line of HTML output from the HTP buffer.
|
* * Parameters:
|
* * * @param IROWS (out) NUMBER: Returns the number of remaining rows left in the buffer. If it returns 0, the buffer is empty.
|
* * * * *
|
* *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_get_line(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.get_line не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Retrieve the generated HTML buffer for the current web request
|
* @details Retrieve the generated HTML buffer for the current web request
|
* * Parameters:
|
* * * @param THEPAGE (out) PL/SQL TABLE: Array to capture the output.
|
* * * @param IROWS (in/out) NUMBER: As input, you specify the maximum number of rows/lines to retrieve. As output, it returns the actual number of rows retrieved.
|
* * * * *
|
* *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_get_page(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.get_page не реализована.")));
|
|
PG_RETURN_NULL();
|
}
|
|
/**
|
* @brief Extracts an generated HTML page from the Oracle buffer and converts the data to a requested character set
|
* @details Extracts an generated HTML page from the Oracle buffer and converts the data to a requested character set
|
* * Parameters:
|
* * * @param THEPAGE (out) PL/SQL TABLE: An array of strings that holds the buffered HTML data
|
* * * @param IROWS (in/out) NUMBER: As input, this defines the maximum number of rows to retrieve. As output, it returns the actual number of rows retrieved
|
* * * @param CHARSET (in) VARCHAR2: The specific character set you want the output converted to
|
* * * * *
|
* *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_get_page_charset_convert(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.get_page_charset_convert не реализована.")));
|
|
PG_RETURN_NULL();
|
}
|
|
/**
|
* @brief Captures the buffered HTML output as raw binary data.
|
* @details Captures the buffered HTML output as raw binary data.
|
* * Parameters:
|
* * * @param THEPAGE (out) PL/SQL TABLE: An array of strings that holds the raw data
|
* * * @param IROWS (in/out) NUMBER: As input, this defines the maximum number of rows to retrieve. As output, it returns the actual number of rows retrieved
|
* *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_get_page_raw(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.get_page_raw не реализована.")));
|
|
PG_RETURN_NULL();
|
}
|
|
/**
|
* @brief This procedure generates opening heading tags(<H1>to<H6>)and their corresponding closing tags (</H1>to</H6>).
|
* @details This procedure generates opening heading tags(<H1>to<H6>)and their corresponding closing tags (</H1>to</H6>).
|
* * Parameters:
|
* * @param NSIZE (in) NUMBER: The the heading level. This is an integer between 1 and 6.
|
* * @param CHEADER (in) VARCHAR2: The text to display in the heading.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CNOWRAP (in) VARCHAR2: The value for theNOWRAPattribute.
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_header(PG_FUNCTION_ARGS)
|
{
|
int32 clevel = 0;
|
bool clevel_is_set = false;
|
char *cheader = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 3, htp::StringAsIs);
|
char *cclear = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 5);
|
|
Numeric clevel_num = PG_ARGISNULL(0) ? NULL : PG_GETARG_NUMERIC(0);
|
if(clevel_num){
|
clevel = DatumGetInt32(DirectFunctionCall1(numeric_int4, NumericGetDatum(clevel_num)));
|
clevel_is_set = true;
|
}
|
|
char *tag = htp::generate_header_tag(clevel, clevel_is_set, cheader, calign, cnowrap,
|
cclear, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cheader, calign, cnowrap, cclear, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <HR> tag, which generates a line in the HTML document.
|
* @details This procedure generates the <HR> tag, which generates a line in the HTML document.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CSRC (in) VARCHAR2: The value for the SRC attribute which specifies a custom image as the source of the line.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_hr(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *csrc = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatSpecialChars);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_hr_tag(cclear, csrc, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cclear, csrc, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <title> and <h(0-6)> tags, going immediately one after another.
|
* @details This procedure generates the <title> and <h(0-6)> tags, going immediately one after another.
|
* * Parameters:
|
* * @param CTITLE (in) VARCHAR2: Page title which is enclosed between <title> and <h(0-6)> tags both.
|
* * @param NSIZE (in) NUMBER: Size of <h(0-6)>
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CNOWRAP (in) VARCHAR2: The value for the NOWRAP attribute.
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_htitle(PG_FUNCTION_ARGS)
|
{
|
int32 clevel = 1;
|
bool clevel_is_set = true;
|
char *ctitle = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 3, htp::StringAsIs);
|
char *cclear = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 5);
|
|
Numeric clevel_num = PG_ARGISNULL(1) ? NULL : PG_GETARG_NUMERIC(1);
|
if(clevel_num){
|
clevel = DatumGetInt32(DirectFunctionCall1(numeric_int4, NumericGetDatum(clevel_num)));
|
}
|
|
char *header_tag = htp::generate_header_tag(clevel, clevel_is_set, ctitle,
|
calign, cnowrap, cclear, cattributes);
|
|
char *tag = htp::generate_htitle_tag(ctitle, header_tag);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(header_tag, ctitle, calign, cnowrap, cclear, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <IMG> tag which directs the browser to load an image onto the HTML page.
|
* @details This procedure generates the <IMG> tag which directs the browser to load an image onto the HTML page.
|
* * Parameters:
|
* * @param CURL (in) VARCHAR2: The value for the SRC attribute.
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CALT (in) VARCHAR2: The value for the ALT attribute which specifies alternative text to display if the browser does not support images.
|
* * @param CISMAP (in) VARCHAR2: If the value for this parameter is not NULL, the ISMAP attribute is added to the tag. The attribute indicates that the image is an imagemap.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_img(PG_FUNCTION_ARGS)
|
{
|
char *curl = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *calt = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cismap = htp::get_string_argument(fcinfo, 3, htp::StringAsIs);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_img_tag(curl, calign, calt, cismap, NULL, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(curl, calign, calt, cismap, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <IMG> tag, which directs the browser to load an image onto the HTML page.
|
* @details This procedure generates the <IMG> tag, which directs the browser to load an image onto the HTML page.
|
* * Parameters:
|
* * @param CURL (in) VARCHAR2: The value for the SRC attribute.
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CALT (in) VARCHAR2: The value for the ALT attribute which specifies alternative text to display if the browser does not support images.
|
* * @param CISMAP (in) VARCHAR2: If the value for this parameter is not NULL, the ISMAP attribute is added to the tag. The attribute indicates that the image is an imagemap.
|
* * @param CUSEMAP (in) VARCHAR2: The value for the USEMAP attribute which specifies a client-side image map.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_img2(PG_FUNCTION_ARGS)
|
{
|
char *curl = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *calt = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cismap = htp::get_string_argument(fcinfo, 3, htp::StringAsIs);
|
char *cusemap = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 5);
|
|
char *tag = htp::generate_img_tag(curl, calign, calt, cismap, cusemap, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(curl, calign, calt, cismap, cusemap, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure creates a single entry field with a prompting text, such as "enter value," then sends that value to the URL of the page or program.
|
* @details This procedure creates a single entry field with a prompting text, such as "enter value," then sends that value to the URL of the page or program.
|
* * Parameters:
|
* * @param CPROMPT (in) VARCHAR2: The value for the PROMPT attribute.
|
* * @param CURL (in) VARCHAR2: The value for the HREF attribute.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_isindex(PG_FUNCTION_ARGS)
|
{
|
char *cprompt = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *curl = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatSpecialChars);
|
|
char *tag = htp::generate_isindex_tag(cprompt, curl);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cprompt, curl, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <I> and </I> tags which direct the browser to render the text in italics.
|
* @details This procedure generates the <I> and </I> tags which direct the browser to render the text in italics.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in italics.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_italic(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_italics_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <KBD> and </KBD> tags which direct the browser to render the text in monospace font.
|
* @details This procedure generates the <KBD> and </KBD> tags which direct the browser to render the text in monospace font.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in monospace.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_kbd(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_kbd_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <KBD> and </KBD> tags, which direct the browser to render the text in monospace font.
|
* @details This procedure generates the <KBD> and </KBD> tags, which direct the browser to render the text in monospace font.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in monospace.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_keyboard(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_kbd_tag(ctext, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <HR> tag, which generates a line in the HTML document.
|
* @details This procedure generates the <HR> tag, which generates a line in the HTML document.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CSRC (in) VARCHAR2: The value for the SRC attribute which specifies a custom image as the source of the line.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_line(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *csrc = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatSpecialChars);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_hr_tag(cclear, csrc, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cclear, csrc, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <LINK> tag with the REL attribute which delineates the relationship described by the hypertext link from the anchor to the target. This is only used when the HREF attribute is present.
|
* @details This procedure generates the <LINK> tag with the REL attribute which delineates the relationship described by the hypertext link from the anchor to the target. This is only used when the HREF attribute is present.
|
* * Parameters:
|
* * @param CREL (in) VARCHAR2: The value for the REL attribute.
|
* * @param CURL (in) VARCHAR2: The value for the HREF attribute.
|
* * @param CTITLE (in) VARCHAR2: The value for the TITLE attribute.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_linkrel(PG_FUNCTION_ARGS)
|
{
|
char *crel = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *curl = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatSpecialChars);
|
char *ctitle = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
|
char *tag = htp::generate_linkrel_tag(crel, curl, ctitle, false);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(crel, curl, ctitle, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <LINK> tag with the REV attribute which delineates the relationship described by the hypertext link from the target to the anchor.
|
* @details This procedure generates the <LINK> tag with the REV attribute which delineates the relationship described by the hypertext link from the target to the anchor.
|
* * Parameters:
|
* * @param CREV (in) VARCHAR2: The value for the REV attribute.
|
* * @param CURL (in) VARCHAR2: The value for the HREF attribute.
|
* * @param CTITLE (in) VARCHAR2: The value for the TITLE attribute.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_linkrev(PG_FUNCTION_ARGS)
|
{
|
char *crev = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *curl = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatSpecialChars);
|
char *ctitle = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
|
char *tag = htp::generate_linkrel_tag(crev, curl, ctitle, true);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(crev, curl, ctitle, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <LH> and </LH> tags which print an HTML tag at the beginning of the list.
|
* @details This procedure generates the <LH> and </LH> tags which print an HTML tag at the beginning of the list.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to place between <LH> and </LH>.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_listheader(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_lh_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <LI> tag, which indicates a list item.
|
* @details This procedure generates the <LI> tag, which indicates a list item.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text for the list item.
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CDINGBAT (in) VARCHAR2: The value for the DINGBAT attribute.
|
* * @param CSRC (in) VARCHAR2: The value for the SRC attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_listitem(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cclear = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cdingbat = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *csrc = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_li_tag(ctext, cclear, cdingbat, csrc, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(ctext, cclear, cdingbat, csrc, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <A> tag with the HREF is set to 'mailto' prepended to the mail address argument.
|
* @details This procedure generates the <A> tag with the HREF is set to 'mailto' prepended to the mail address argument.
|
* * Parameters:
|
* * @param CADDRESS (in) VARCHAR2: The email address of the recipient.
|
* * @param CTEXT (in) VARCHAR2: The clickable portion of the link.
|
* * @param CNAME (in) VARCHAR2: The value for the NAME attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_mailto(PG_FUNCTION_ARGS)
|
{
|
char *caddress = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
char *ctext = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracleFull);
|
char *cname = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_mailto_tag(caddress, ctext, cname, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(caddress, ctext, cname, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <MAP> tag which mark the beginning of a set of regions in a client-side image map.
|
* @details This procedure generates the <MAP> tag which mark the beginning of a set of regions in a client-side image map.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for the NAME attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_mapopen(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_map_tag(cname, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <META> tag, which embeds meta-information about the document and also specifies values for HTTP headers. For example, you can specify the expiration date, keywords, and author name.
|
* @details This procedure generates the <META> tag, which embeds meta-information about the document and also specifies values for HTTP headers. For example, you can specify the expiration date, keywords, and author name.
|
* * Parameters:
|
* * @param CHTTP_EQUIV (in) VARCHAR2: The value for the CHTTP_EQUIV attribute.
|
* * @param CNAME (in) VARCHAR2: The value for the NAME attribute.
|
* * @param CCONTENT (in) VARCHAR2: The value for the CONTENT attribute.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_meta(PG_FUNCTION_ARGS)
|
{
|
char *chttp_equiv = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cname = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *ccontent = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
|
char *tag = htp::generate_meta_tag(chttp_equiv, cname, ccontent);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(chttp_equiv, cname, ccontent, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Obsolete function to generate next ID.
|
* @details Obsolete function to generate next ID.
|
* * Parameters:
|
* * @param CIDENTIFIER (in) VARCHAR2: ID prefix.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_nextid(PG_FUNCTION_ARGS)
|
{
|
char *cidentifier = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
|
char *tag = htp::generate_nextid_tag(cidentifier);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cidentifier, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <BR> tag which begins a new line of text.
|
* @details This procedure generates the <BR> tag which begins a new line of text.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_nl(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_br_tag(cclear, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, cclear, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <NOBR> and </NOBR> tags which turn off line-breaking in a section of text.
|
* @details This procedure generates the <NOBR> and </NOBR> tags which turn off line-breaking in a section of text.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text that is to be rendered on one line.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_nobr(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
|
char *tag = htp::generate_nobr_tag(ctext);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<OL>tag which marks the beginning of an ordered list. An ordered list presents a list of numbered items.
|
* @details This procedure generates the<OL>tag which marks the beginning of an ordered list. An ordered list presents a list of numbered items.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CWRAP (in) VARCHAR2: The value for theWRAPattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_olistopen(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cwrap = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_olist_tag(cclear, cwrap, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cclear, cwrap, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Adds HTP text as registered event to OWA package
|
* @details Adds HTP text (in form of the text) as registered event to OWA package
|
* * Parameters:
|
* * @param CBUF (in) VARCHAR2: text to be added
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_p_ovr1(PG_FUNCTION_ARGS)
|
{
|
if (PG_ARGISNULL(0))
|
{
|
Owa::appendHtpText("", true);
|
PG_RETURN_VOID();
|
}
|
|
text *str_t = PG_GETARG_TEXT_P(0);
|
char *str = text_to_cstring(str_t);
|
|
Owa::appendHtpText(str, true);
|
pfree(str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Adds HTP text as registered event to OWA package
|
* @details Adds HTP text (in form of the date) as registered event to OWA package
|
* * Parameters:
|
* * @param DBUF (in) DATE: date to be added
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_p_ovr2(PG_FUNCTION_ARGS)
|
{
|
if (PG_ARGISNULL(0))
|
{
|
Owa::appendHtpText("", true);
|
PG_RETURN_VOID();
|
}
|
|
Datum date = PG_GETARG_DATUM(0);
|
char *date_str = DatumGetCString(DirectFunctionCall1(date_out, date));
|
|
Owa::appendHtpText(date_str, true);
|
pfree(date_str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Adds HTP text as registered event to OWA package
|
* @details Adds HTP text (in form of the number) as registered event to OWA package
|
* * Parameters:
|
* * @param NBUF (in) NUMBER: number to be added
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_p_ovr3(PG_FUNCTION_ARGS)
|
{
|
if (PG_ARGISNULL(0))
|
{
|
Owa::appendHtpText("", true);
|
PG_RETURN_VOID();
|
}
|
|
Datum num = PG_GETARG_DATUM(0);
|
char *num_str = DatumGetCString(DirectFunctionCall1(numeric_out, num));
|
|
Owa::appendHtpText(num_str, true);
|
pfree(num_str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief You can use this procedure to add attributes to the <P> tag created by the PARA Procedure.
|
* @details You can use this procedure to add attributes to the <P> tag created by the PARA Procedure.
|
* * Parameters:
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CNOWRAP (in) VARCHAR2: If the value for this parameter is not NULL, the NOWRAP attribute is added to the tag.
|
* * @param CCLEAR (in) VARCHAR2: The value for the CLEAR attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_paragraph(PG_FUNCTION_ARGS)
|
{
|
char *calign = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 1, htp::StringAsIs);
|
char *cclear = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 3);
|
|
char *tag = htp::generate_paragraph_tag(calign, cnowrap, cclear, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(calign, cnowrap, cclear, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <PARAM> tag which specifies parameter values for Java applets.
|
* @details This procedure generates the <PARAM> tag which specifies parameter values for Java applets.
|
* * Parameters:
|
* * @param CNAME (in) VARCHAR2: The value for the NAME attribute.
|
* * @param CVALUE (in) VARCHAR2: The value for the VALUE attribute.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_param(PG_FUNCTION_ARGS)
|
{
|
char *cname = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cvalue = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
|
char *tag = htp::generate_param_tag(cname, cvalue);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cname, cvalue, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <PLAINTEXT> and </PLAINTEXT> tags which direct the browser to render the text they surround in fixed-width type.
|
* @details This procedure generates the <PLAINTEXT> and </PLAINTEXT> tags which direct the browser to render the text they surround in fixed-width type.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in fixed-width font.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_plaintext(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_pt_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<PRE>tag which marks the beginning of a section of preformatted text in the body of the HTML page.
|
* @details This procedure generates the<PRE>tag which marks the beginning of a section of preformatted text in the body of the HTML page.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CWIDTH (in) VARCHAR2: The value for theWIDTHattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_preopen(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cwidth = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_pre_tag(cclear, cwidth, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cclear, cwidth, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief These procedures generate the specified parameter as a string terminated with the\nnewline character.
|
* @details These procedures generate the specified parameter as a string terminated with the\nnewline character.
|
* * Parameters:
|
* * @param CBUF (in) VARCHAR2: The string to generate terminated by a newline.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_print_ovr1(PG_FUNCTION_ARGS)
|
{
|
text *str_t = PG_GETARG_TEXT_P(0);
|
char *str = text_to_cstring(str_t);
|
html_buffer.append(str);
|
html_buffer.push_back('\n');
|
|
pfree(str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief These procedures generate the specified parameter as a string terminated with the\nnewline character.
|
* @details These procedures generate the specified parameter as a string terminated with the\nnewline character.
|
* * Parameters:
|
* * @param DBUF (in) DATE: The string to generate terminated by a newline.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_print_ovr2(PG_FUNCTION_ARGS)
|
{
|
Datum date = PG_GETARG_DATUM(0);
|
char *date_str = DatumGetCString(DirectFunctionCall1(date_out, date));
|
|
html_buffer.append(date_str);
|
html_buffer.push_back('\n');
|
|
pfree(date_str);
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief These procedures generate the specified parameter as a string terminated with the\nnewline character.
|
* @details These procedures generate the specified parameter as a string terminated with the\nnewline character.
|
* * Parameters:
|
* * @param NBUF (in) NUMBER: The string to generate terminated by a newline.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_print_ovr3(PG_FUNCTION_ARGS)
|
{
|
Datum num = PG_GETARG_DATUM(0);
|
char *num_str = DatumGetCString(DirectFunctionCall1(numeric_out, num));
|
|
html_buffer.append(num_str);
|
html_buffer.push_back('\n');
|
|
pfree(num_str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates a string and replaces certain characters with a corresponding escape sequence.
|
* @details This procedure generates a string and replaces certain characters with a corresponding escape sequence.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The string where to perform character substitution.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_prints(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
|
if (ctext != nullptr && strlen(ctext))
|
{
|
htp::html_buffer_add(ctext);
|
}
|
|
htp::pfree_all(ctext);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Prints the HTTP response header, including trailing newlines
|
* @details Prints the HTTP response header, including trailing newlines
|
* * Parameters:
|
* * @param CBUF (in) VARCHAR2: HTTP response header
|
* * @param NLINE (in) NUMBER: number of lines
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_print_header(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.print_header не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief These procedures generate the specified parameter as a string.
|
* @details These procedures generate the specified parameter as a string.
|
* * Parameters:
|
* * @param CBUF (in) VARCHAR2: The string to generate (not terminated by a newline).
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_prn_ovr1(PG_FUNCTION_ARGS)
|
{
|
text *str_t = PG_GETARG_TEXT_P(0);
|
char *str = text_to_cstring(str_t);
|
Owa::appendHtpText(str, false);
|
html_buffer.append(str);
|
|
pfree(str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief These procedures generate the specified parameter as a string.
|
* @details These procedures generate the specified parameter as a string.
|
* * Parameters:
|
* * @param DBUF (in) DATE: The string to generate (not terminated by a newline).
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_prn_ovr2(PG_FUNCTION_ARGS)
|
{
|
Datum date = PG_GETARG_DATUM(0);
|
char *date_str = DatumGetCString(DirectFunctionCall1(date_out, date));
|
|
html_buffer.append(date_str);
|
|
pfree(date_str);
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief These procedures generate the specified parameter as a string.
|
* @details These procedures generate the specified parameter as a string.
|
* * Parameters:
|
* * @param NBUF (in) NUMBER: The string to generate (not terminated by a newline).
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_prn_ovr3(PG_FUNCTION_ARGS)
|
{
|
Datum num = PG_GETARG_DATUM(0);
|
char *num_str = DatumGetCString(DirectFunctionCall1(numeric_out, num));
|
|
html_buffer.append(num_str);
|
|
pfree(num_str);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates a string and replaces certain characters with the corresponding escape sequence.
|
* @details This procedure generates a string and replaces certain characters with the corresponding escape sequence.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The string where to perform character substitution.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_ps(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatSpecialChars);
|
|
if (ctext != nullptr && strlen(ctext))
|
{
|
htp::html_buffer_add(ctext);
|
}
|
|
htp::pfree_all(ctext);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Sends binary data (like images or PDF files) to a web browser from an Oracle database with no character set conversion
|
* @details Sends binary data (like images or PDF files) to a web browser from an Oracle database with no character set conversion
|
* * Parameters:
|
* * @param BBUF (in) RAW: The binary data to send.
|
* * @param BUFLEN (in) BINARY_INTEGER: The length of the raw data.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_putraw(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.putraw не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <S> and </S> tags which direct the browser to render the text they surround in strikethrough type.
|
* @details This procedure generates the <S> and </S> tags which direct the browser to render the text they surround in strikethrough type.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in strikethrough type.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_s(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_s_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <SAMP> and </SAMP> tags which direct the browser to render the text they surround in monospace font or however "sample" is defined stylistically.
|
* @details This procedure generates the <SAMP> and </SAMP> tags which direct the browser to render the text they surround in monospace font or however "sample" is defined stylistically.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in monospace font.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_sample(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_samp_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <SCRIPT> and </SCRIPT> tags which contain a script written in languages such as JavaScript and VBscript.
|
* @details This procedure generates the <SCRIPT> and </SCRIPT> tags which contain a script written in languages such as JavaScript and VBscript.
|
* * Parameters:
|
* * @param CSCRIPT (in) VARCHAR2: The text of the script. This is the text that makes up the script itself, not the name of a file containing the script.
|
* * @param CLANGUAGE (in) VARCHAR2: The language in which the script is written. If this parameter is omitted, the user's browser determines the scripting language.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_script(PG_FUNCTION_ARGS)
|
{
|
char *cscript = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatTextU);
|
char *clanguage = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
|
char *tag = htp::generate_script_tag(cscript, clanguage);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cscript, clanguage, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Sets the character encoding in the HTTP response headers, ensuring the browser renders text correctly
|
* @details Sets the character encoding in the HTTP response headers, ensuring the browser renders text correctly
|
* * Parameters:
|
* * @param IANA_CHARSET (in) VARCHAR2: The standard IANA character set name
|
* * @param ORA_CHARSET (in) VARCHAR2: The Oracle-specific character set name
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_sethttpcharset(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.sethttpcharset не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief Tells your server to send data as "raw" bytes instead of standard text
|
* @details Tells your server to send data as "raw" bytes instead of standard text
|
* * Parameters:
|
* * @param TMODE (in) VARCHAR2: Transfer mode
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_set_transfer_mode(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.set_transfer_mode не реализована.")));
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <SMALL> and </SMALL> tags, which direct the browser to render the text they surround using a small font.
|
* @details This procedure generates the <SMALL> and </SMALL> tags, which direct the browser to render the text they surround using a small font.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in small font.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_small(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_small_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <STRIKE> and </STRIKE> tags which direct the browser to render the text they surround in strikethrough type.
|
* @details This procedure generates the <STRIKE> and </STRIKE> tags which direct the browser to render the text they surround in strikethrough type.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be rendered in strikethrough type.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_strike(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_strike_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <STRONG> and </STRONG> tags which direct the browser to render the text they surround in bold, or however "strong" is defined.
|
* @details This procedure generates the <STRONG> and </STRONG> tags which direct the browser to render the text they surround in bold, or however "strong" is defined.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to be emphasized.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_strong(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_strong_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <STYLE> and </STYLE> tags which include a style sheet in a Web page.
|
* @details This procedure generates the <STYLE> and </STYLE> tags which include a style sheet in a Web page.
|
* * Parameters:
|
* * @param CSTYLE (in) VARCHAR2: The the style information to include.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_style(PG_FUNCTION_ARGS)
|
{
|
char *cstyle = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatCss);
|
|
char *tag = htp::generate_style_tag(cstyle);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, cstyle);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <SUB> and </SUB> tags which direct the browser to render the text they surround as subscript.
|
* @details This procedure generates the <SUB> and </SUB> tags which direct the browser to render the text they surround as subscript.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render in subscript.
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_sub(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_sub_tag(ctext, calign, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, calign, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <SUP> and </SUP> tags which direct the browser to render the text they surround as superscript.
|
* @details This procedure generates the <SUP> and </SUP> tags which direct the browser to render the text they surround as superscript.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render in superscript.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_sup(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_sup_tag(ctext, calign, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, calign, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <CAPTION> and </CAPTION> tags which place a caption in an HTML table.
|
* @details This procedure generates the <CAPTION> and </CAPTION> tags which place a caption in an HTML table.
|
* * Parameters:
|
* * @param CCAPTION (in) VARCHAR2: The text for the caption.
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_tablecaption(PG_FUNCTION_ARGS)
|
{
|
char *ccaption = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 2);
|
|
char *tag = htp::generate_tc_tag(ccaption, calign, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ccaption, calign, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <TD> and </TD> tags which insert data into a cell of an HTML table.
|
* @details This procedure generates the <TD> and </TD> tags which insert data into a cell of an HTML table.
|
* * Parameters:
|
* * @param CVALUE (in) VARCHAR2: The data for the cell in the table.
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CDP (in) VARCHAR2: The value for the DP attribute.
|
* * @param CNOWRAP (in) VARCHAR2: If the value of this parameter is not NULL, the NOWRAP attribute is added to the tag.
|
* * @param CROWSPAN (in) VARCHAR2: The value for the ROWSPAN attribute.
|
* * @param CCOLSPAN (in) VARCHAR2: The value for the COLSPAN attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_tabledata(PG_FUNCTION_ARGS)
|
{
|
char *cvalue = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cdp = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 3, htp::StringAsIs);
|
char *crowspan = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *ccolspan = htp::get_string_argument(fcinfo, 5, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 6);
|
|
char *tag = htp::generate_td_tag(cvalue, calign, cdp, cnowrap, crowspan,
|
ccolspan, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cvalue, calign, cdp, cnowrap, crowspan, ccolspan, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <TH> and </TH> tags which insert a header cell in an HTML table.
|
* @details This procedure generates the <TH> and </TH> tags which insert a header cell in an HTML table.
|
* * Parameters:
|
* * @param CVALUE (in) VARCHAR2: The data for the cell in the table.
|
* * @param CALIGN (in) VARCHAR2: The value for the ALIGN attribute.
|
* * @param CDP (in) VARCHAR2: The value for the DP attribute.
|
* * @param CNOWRAP (in) VARCHAR2: If the value of this parameter is not NULL, the NOWRAP attribute is added to the tag.
|
* * @param CROWSPAN (in) VARCHAR2: The value for the ROWSPAN attribute.
|
* * @param CCOLSPAN (in) VARCHAR2: The value for the COLSPAN attribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_tableheader(PG_FUNCTION_ARGS)
|
{
|
char *cvalue = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cdp = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 3, htp::StringAsIs);
|
char *crowspan = htp::get_string_argument(fcinfo, 4, htp::StringEscapeFormatOracle);
|
char *ccolspan = htp::get_string_argument(fcinfo, 5, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 6);
|
|
char *tag = htp::generate_th_tag(cvalue, calign, cdp, cnowrap, crowspan,
|
ccolspan, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cvalue, calign, cdp, cnowrap, crowspan, ccolspan, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <TABLE> tag which marks the beginning of an HTML table.
|
* @details This procedure generates the <TABLE> tag which marks the beginning of an HTML table.
|
* * Parameters:
|
* * @param CBORDER (in) VARCHAR2: The value for the BORDER attribute.
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CNOWRAP (in) VARCHAR2: If the value of this parameter is notNULL, theNOWRAPattribute is added to the tag.
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_tableopen(PG_FUNCTION_ARGS)
|
{
|
char *cborder = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *calign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cclear = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_table_tag(cborder, calign, cnowrap, cclear, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cborder, calign, cnowrap, cclear, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<TR>tag which marks the beginning of a new row in an HTML table.
|
* @details This procedure generates the<TR>tag which marks the beginning of a new row in an HTML table.
|
* * Parameters:
|
* * @param CALIGN (in) VARCHAR2: The value for theALIGNattribute.
|
* * @param CVALIGN (in) VARCHAR2: The value for theVALIGNattribute.
|
* * @param CDP (in) VARCHAR2: The value for theDPattribute.
|
* * @param CNOWRAP (in) VARCHAR2: If the value of this parameter is notNULL, theNOWRAPattribute is added to the tag.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_tablerowopen(PG_FUNCTION_ARGS)
|
{
|
char *calign = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cvalign = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cdp = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *cnowrap = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_tablerow_tag(calign, cvalign, cdp, cnowrap, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(calign, cvalign, cdp, cnowrap, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <TT> and </TT> tags which direct the browser to render the text they surround in a fixed width typewriter font, for example, the courier font.
|
* @details This procedure generates the <TT> and </TT> tags which direct the browser to render the text they surround in a fixed width typewriter font, for example, the courier font.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render in a fixed width typewriter font.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_teletype(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_teletype_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <TITLE> and </TITLE> tags which specify the text to display in the titlebar of the browser window.
|
* @details This procedure generates the <TITLE> and </TITLE> tags which specify the text to display in the titlebar of the browser window.
|
* * Parameters:
|
* * @param CTITLE (in) VARCHAR2: The text to display in the titlebar of the browser window.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_title(PG_FUNCTION_ARGS)
|
{
|
char *ctitle = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
|
char *tag = htp::generate_title_tag(ctitle);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctitle);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the<UL>tag which marks the beginning of an unordered list. An unordered list presents items with bullets.
|
* @details This procedure generates the<UL>tag which marks the beginning of an unordered list. An unordered list presents items with bullets.
|
* * Parameters:
|
* * @param CCLEAR (in) VARCHAR2: The value for theCLEARattribute.
|
* * @param CWRAP (in) VARCHAR2: The value for theWRAPattribute.
|
* * @param CDINGBAT (in) VARCHAR2: The value for theDINGBATattribute.
|
* * @param CSRC (in) VARCHAR2: The value for theSRCattribute.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_ulistopen(PG_FUNCTION_ARGS)
|
{
|
char *cclear = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracle);
|
char *cwrap = htp::get_string_argument(fcinfo, 1, htp::StringEscapeFormatOracle);
|
char *cdingbat = htp::get_string_argument(fcinfo, 2, htp::StringEscapeFormatOracle);
|
char *csrc = htp::get_string_argument(fcinfo, 3, htp::StringEscapeFormatOracle);
|
char *cattributes = htp::get_string_argument(fcinfo, 4);
|
|
char *tag = htp::generate_ulist_tag(cclear, cwrap, cdingbat, csrc, cattributes);
|
htp::html_buffer_add(tag);
|
htp::pfree_all(cclear, cwrap, cdingbat, csrc, cattributes, tag);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <U> and </U> tags, which direct the browser to render the text they surround with an underline.
|
* @details This procedure generates the <U> and </U> tags, which direct the browser to render the text they surround with an underline.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render with an underline.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_underline(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_underline_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
/**
|
* @brief This procedure generates the <VAR> and </VAR> tags which direct the browser to render the text they surround in italics or however "variable" is defined stylistically.
|
* @details This procedure generates the <VAR> and </VAR> tags which direct the browser to render the text they surround in italics or however "variable" is defined stylistically.
|
* * Parameters:
|
* * @param CTEXT (in) VARCHAR2: The text to render in italics.
|
* * @param CATTRIBUTES (in) VARCHAR2: The other attributes to be included as-is in the tag.
|
* * * * *
|
* @see https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/HTP.html
|
*/
|
Datum htp_variable(PG_FUNCTION_ARGS)
|
{
|
char *ctext = htp::get_string_argument(fcinfo, 0, htp::StringEscapeFormatOracleFull);
|
char *cattributes = htp::get_string_argument(fcinfo, 1);
|
|
char *tag = htp::generate_variable_tag(ctext, cattributes);
|
|
htp::html_buffer_add(tag);
|
htp::pfree_all(tag, ctext, cattributes);
|
|
PG_RETURN_VOID();
|
}
|
|
// NO ARGUMENTS
|
Datum htp_appletclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</applet>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_blockquoteclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</blockquote>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_bodyclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</body>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_centerclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</center>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_centeropen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<center>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_dirlistclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</dir>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_dirlistopen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<dir>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_dlistclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</dl>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_flush(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.flush еще не реализована.")));
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_fontclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</font>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_formclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</form>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_formselectclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</select>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_formtextareaclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</textarea>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_framesetclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</frameset>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_headclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</head>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_headopen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<head>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_htmlclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</html>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_htmlopen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<html>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_init(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.init еще не реализована.")));
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_listingclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</listing>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_listingopen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<listing>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_mapclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</map>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_menulistclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</menu>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_menulistopen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<menu>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_noframesclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</noframes>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_noframesopen(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<noframes>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_olistclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</ol>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_para(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<p>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_preclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</pre>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_reset_get_page(PG_FUNCTION_ARGS)
|
{
|
ereport(NOTICE, (errmsg("Функция htp.reset_get_page еще не реализована.")));
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_showpage(PG_FUNCTION_ARGS)
|
{
|
DirectFunctionCall1(owa_util_showpage_utils, Int32GetDatum(0));
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_tableclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</table>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_tablerowclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</tr>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_ulistclose(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("</ul>");
|
PG_RETURN_VOID();
|
}
|
|
Datum htp_wbr(PG_FUNCTION_ARGS)
|
{
|
htp::html_buffer_add("<wbr>");
|
PG_RETURN_VOID();
|
}
|
|
} // extern "C"
|