File: mariadb_field_attr.3

package info (click to toggle)
mariadb 1%3A11.8.3-0%2Bdeb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 772,508 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (83 lines) | stat: -rw-r--r-- 2,366 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.\" Automatically generated by Pandoc 3.5
.\"
.TH "mariadb_field_attr" "3" "" "Version 3.4" "MariaDB Connector/C"
.SS Name
mariadb_field_attr \- returns extended metadata information for
pluggable field types
.SS Synopsis
.IP
.EX
#include \f[B]<mysql.h>\f[R]

int *mariadb_field_attr(MARIADB_CONST_STRING *attr,
                        const MYSQL_FIELD *field,
                        \f[B]enum\f[R] mariadb_field_attr_t type)
.EE
.SS Description
Returns extended metadata information for pluggable field types like
JSON and GEOMETRY.
.SS Parameter
.IP \[bu] 2
\f[CR]attr\f[R]: A pointer which returns extended metadata information
.IP \[bu] 2
\f[CR]field\f[R]: Specifies the field which contains extended metadata
information
.IP \[bu] 2
\f[CR]type:\f[R] Specifies type of metadata information.
Supported types are \f[CR]MARIADB_FIELD_METADATA_DATA_TYPE_NAME\f[R] and
\f[CR]MARIADB_FIELD_METADATA_FORMAT_NAME\f[R].
.SS Return value
Returns zero on success or non zero if the field doesn\[cq]t provide
extended metadata information.
.SS Notes
.IP \[bu] 2
Pluggable field type support is available in MariaDB server version
10.5.2 and later
.IP \[bu] 2
To check if the server supports pluggable field types, check the
extended server capabilities which can be obtained by api function
\f[B]mariadb_get_info(3)\f[R]
.SS Example
.IP
.EX
#include \f[B]<mysql.h>\f[R]

int display_extended_field_attribute(MYSQL *mysql)
{
  MYSQL_RES *result;
  MYSQL_FIELD *fields;

  \f[B]if\f[R] (mysql_query(mysql, \[dq]CREATE TEMPORARY TABLE t1 (a POINT)\[dq]))
    \f[B]return\f[R] 1;

  \f[B]if\f[R] (mysql_query(mysql, \[dq]SELECT a FROM t1\[dq]))
    \f[B]return\f[R] 1;

  \f[B]if\f[R] (!(result= mysql_store_result(mysql)))
    \f[B]return\f[R] 1;

  \f[B]if\f[R] ((fields= mysql_fetch_fields(result)))
  {
    MARIADB_CONST_STRING field_attr;

    \f[B]if\f[R] (!mariadb_field_attr(&field_attr, &fields[0],
                            MARIADB_FIELD_ATTR_DATA_TYPE_NAME))
    {
      printf(\[dq]Extended field attribute: %s\[rs]n\[dq], field_attr.str);
    }
  }
  mysql_free_result(result);
  \f[B]return\f[R] 0;
}
.EE
.SS History
mariadb_field_attr was added in MariaDB Connector/C 3.1.8
.SS See also
.IP \[bu] 2
\f[B]mysql_store_result(3)\f[R]
.IP \[bu] 2
\f[B]mysql_use_result(3)\f[R]
.IP \[bu] 2
\f[B]mariadb_get_info(3)\f[R]
.IP \[bu] 2
\f[B]mysql_fetch_fields(3)\f[R]