source: branches/4.x/docs/contents/pgdb/types.rst @ 695

Last change on this file since 695 was 695, checked in by cito, 4 years ago

Reorganize and improve the Sphinx docs

The Sphinx HTML docs can now also serve as home page for the project.
They can be built with the mkdocs script and can then be found in the
docs/_build/html directory (this needs sphinx and the cloud_sptheme).

The "actual" core docs can be found in docs/contents. The layout has
been modified to only show these pages with the typical documentation
relbars; the other pages of the homepage use a simpler layout. The
pg and pgdb documentation has been cut in chunks and can now be found
in docs/contents/pg and docs/contents/pgdb.

File size: 2.5 KB
Line 
1pgdbType -- Type objects and constructors
2=========================================
3
4.. class:: pgdbType
5
6The :attr:`pgdbCursor.description` attribute returns information about each
7of the result columns of a query. The *type_code* must compare equal to one
8of the :class:`pgdbType` objects defined below. Type objects can be equal to
9more than one type code (e.g. :class:`DATETIME` is equal to the type codes
10for date, time and timestamp columns).
11
12The :mod:`pgdb` module exports the following constructors and singletons:
13
14.. function:: Date(year, month, day)
15
16    Construct an object holding a date value
17
18.. function:: Time(hour, minute=0, second=0, microsecond=0)
19
20    Construct an object holding a time value
21
22.. function:: Timestamp(year, month, day, hour=0, minute=0, second=0, microsecond=0)
23
24    Construct an object holding a time stamp value
25
26.. function:: DateFromTicks(ticks)
27
28    Construct an object holding a date value from the given *ticks* value
29
30.. function:: TimeFromTicks(ticks)
31
32    Construct an object holding a time value from the given *ticks* value
33
34.. function:: TimestampFromTicks(ticks)
35
36    Construct an object holding a time stamp from the given *ticks* value
37
38.. function:: Binary(bytes)
39
40    Construct an object capable of holding a (long) binary string value
41
42.. class:: STRING
43
44    Used to describe columns that are string-based (e.g. ``char``, ``varchar``, ``text``)
45
46.. class:: BINARY type
47
48    Used to describe (long) binary columns (``bytea``)
49
50.. class:: NUMBER
51
52    Used to describe numeric columns (e.g. ``int``, ``float``, ``numeric``, ``money``)
53
54.. class:: DATETIME
55
56    Used to describe date/time columns (e.g. ``date``, ``time``, ``timestamp``, ``interval``)
57
58.. class:: ROWID
59
60    Used to describe the ``oid`` column of PostgreSQL database tables
61
62.. note:
63
64    The following more specific types are not part of the DB-API 2 standard.
65
66.. class:: BOOL
67
68    Used to describe ``boolean`` columns
69
70.. class:: SMALLINT
71
72    Used to describe ``smallint`` columns
73
74.. class:: INTEGER
75
76    Used to describe ``integer`` columns
77
78.. class:: LONG
79
80    Used to describe ``bigint`` columns
81
82.. class:: FLOAT
83
84    Used to describe ``float`` columns
85
86.. class:: NUMERIC
87
88    Used to describe ``numeric`` columns
89
90.. class:: MONEY
91
92    Used to describe ``money`` columns
93
94.. class:: DATE
95
96    Used to describe ``date`` columns
97
98.. class:: TIME
99
100    Used to describe ``time`` columns
101
102.. class:: TIMESTAMP
103
104    Used to describe ``timestamp`` columns
105
106.. class:: INTERVAL
107
108    Used to describe date and time ``interval`` columns
Note: See TracBrowser for help on using the repository browser.