Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40239c0

Browse files
author
Artur Zakirov
committed
Added more info into README
1 parent12eeb56 commit40239c0

File tree

2 files changed

+57
-730
lines changed

2 files changed

+57
-730
lines changed

‎README.md

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,35 @@ Typical installation procedure may look like this:
3939

4040
##Module functions
4141

42+
The functions provided by the**pg_variables** module are shown in the tables
43+
below. The module supports the following scalar and record types.
44+
45+
To use**pgv_get_()** functions required package and variable must exists. It is
46+
necessary to set variable with**pgv_set_()** functions to use**pgv_get_()**
47+
functions.
48+
49+
If a package does not exists you will get the following error:
50+
51+
```sql
52+
SELECT pgv_get_int('vars','int1');
53+
ERROR: unrecognized package"vars"
54+
```
55+
56+
If a variable does not exists you will get the following error:
57+
58+
```sql
59+
SELECT pgv_get_int('vars','int1');
60+
ERROR: unrecognized variable"int1"
61+
```
62+
63+
**pgv_get_()** functions check the variable type. If the variable type does not
64+
match with the function type the error will be raised:
65+
66+
```sql
67+
SELECT pgv_get_text('vars','int1');
68+
ERROR: variable"int1" requires"integer" value
69+
```
70+
4271
###Integer variables
4372

4473
Function | Returns
@@ -90,25 +119,37 @@ Function | Returns
90119

91120
###Records
92121

93-
Function | Returns
94-
-------- | -------
95-
`pgv_insert(package text, name text, r record)` |`void`
96-
`pgv_update(package text, name text, r record)` |`boolean`
97-
`pgv_delete(package text, name text, value anynonarray)` |`boolean`
98-
`pgv_select(package text, name text)` |`set of record`
99-
`pgv_select(package text, name text, value anynonarray)` |`record`
100-
`pgv_select(package text, name text, value anyarray)` |`set of record`
122+
The following functions are provided by the module to work with collections of
123+
record types.
124+
125+
To use**pgv_update()**,**pgv_delete()** and**pgv_select()** functions
126+
required package and variable must exists. Otherwise the error will be raised.
127+
It is necessary to set variable with**pgv_insert()** function to use these
128+
functions.
129+
130+
**pgv_update()**,**pgv_delete()** and**pgv_select()** functions check the
131+
variable type. If the variable type does not**record** type the error will be
132+
raised.
133+
134+
Function | Returns | Description
135+
-------- | ------- | -----------
136+
`pgv_insert(package text, name text, r record)` |`void` | Inserts a record to the variable collection. If package and variable do not exists they will be created. The first column of**r** will be a primary key. If exists a record with the same primary key the error will be raised. If this variable collection has other structure the error will be raised.
137+
`pgv_update(package text, name text, r record)` |`boolean` | Updates a record with the corresponding primary key (the first column of**r** is a primary key). Returns**true** if a record was found. If this variable collection has other structure the error will be raised.
138+
`pgv_delete(package text, name text, value anynonarray)` |`boolean` | Deletes a record with the corresponding primary key (the first column of**r** is a primary key). Returns**true** if a record was found.
139+
`pgv_select(package text, name text)` |`set of record` | Returns the variable collection records.
140+
`pgv_select(package text, name text, value anynonarray)` |`record` | Returns the record with the corresponding primary key (the first column of**r** is a primary key).
141+
`pgv_select(package text, name text, value anyarray)` |`set of record` | Returns the variable collection records with the corresponding primary keys (the first column of**r** is a primary key).
101142

102143
###Miscellaneous functions
103144

104-
Function | Returns
105-
-------- | -------
106-
`pgv_exists(package text, name text)` |`bool`
107-
`pgv_remove(package text, name text)` |`void`
108-
`pgv_remove(package text)` |`void`
109-
`pgv_free()` |`void`
110-
`pgv_list()` |`table(package text, name text)`
111-
`pgv_stats()` |`table(package text, used_memory bigint)`
145+
Function | Returns | Description
146+
-------- | ------- | -----------
147+
`pgv_exists(package text, name text)` |`bool` | Returns**true** if package and variable exists.
148+
`pgv_remove(package text, name text)` |`void` | Removes the variable with the corresponding name. Required package and variable must exists, otherwise the error will be raised.
149+
`pgv_remove(package text)` |`void` | Removes the package and all package variables with the corresponding name. Required package must exists, otherwise the error will be raised.
150+
`pgv_free()` |`void` | Removes all packages and variables.
151+
`pgv_list()` |`table(package text, name text)` | Returns set of records of assigned packages and variables.
152+
`pgv_stats()` |`table(package text, used_memory bigint)` | Returns list of assigned packages and used memory in bytes.
112153

113154
Note that**pgv_stats()** works only with the PostgreSQL 9.6 and newer.
114155

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp