|
1 | | -# gp_url_tools: Greenplum extension providing functionality for working with URL addresses |
| 1 | +<!-- |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + or more contributor license agreements. See the NOTICE file |
| 4 | + distributed with this work for additional information |
| 5 | + regarding copyright ownership. The ASF licenses this file |
| 6 | + to you under the Apache License, Version 2.0 (the |
| 7 | + "License"); you may not use this file except in compliance |
| 8 | + with the License. You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, |
| 13 | + software distributed under the License is distributed on an |
| 14 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + KIND, either express or implied. See the License for the |
| 16 | + specific language governing permissions and limitations |
| 17 | + under the License. |
| 18 | +--> |
| 19 | + |
| 20 | +# gp_url_tools: Cloudberry extension providing functionality for working with URL addresses |
2 | 21 |
|
3 | 22 | ### Features |
4 | | -gp_url_tools is an extension for the Greenplum database that gives implementation |
| 23 | +`gp_url_tools` is an extension for the Cloudberry database that gives implementation |
5 | 24 | for functions that encode/decode url/uri. |
6 | 25 |
|
7 | | -### Installation |
8 | | -Install from source: |
9 | | -``` |
10 | | -git clone https://github.com/open-gpdb/gp_url_tools.git |
11 | | -cd gp_url_tools |
12 | | -# Build it. Building would require GP installed nearby and sourcing greenplum_path.sh |
13 | | -source <path_to_gp>/greenplum_path.sh |
14 | | -make && make install |
15 | | -``` |
| 26 | +### Functions |
| 27 | +The extension creates the `url_tools_schema` schema and adds four SQL functions: |
| 28 | + |
| 29 | +- `url_tools_schema.encode_url`/`.encode_uri` |
| 30 | + Encodes a text value for use as a URL/URI component by replacing reserved characters with percent-encoded sequences. |
| 31 | + |
| 32 | +- `url_tools_schema.decode_url`/`.decode_uri` |
| 33 | + Decodes percent-encoded sequences in a URL/URI-encoded text value back to their original characters (human-readable). |
16 | 34 |
|
17 | 35 | ### Usage |
| 36 | +```sql |
| 37 | +CREATE EXTENSION gp_url_tools; |
18 | 38 | ``` |
19 | | -=# create extension gp_url_tools; |
20 | | -
|
21 | | -=# select url_tools_schema.encode_url('Hello World'); |
| 39 | +```sql |
| 40 | +SELECT url_tools_schema.encode_url('Hello World'); |
| 41 | +``` |
| 42 | +```bash |
22 | 43 | encode_url |
23 | 44 | ─────────────── |
24 | 45 | Hello%20World |
25 | 46 | (1 row) |
26 | | -
|
27 | | -=# select url_tools_schema.decode_url('Hello%20World'); |
| 47 | +``` |
| 48 | +```sql |
| 49 | +SELECT url_tools_schema.decode_url('Hello%20World'); |
| 50 | +``` |
| 51 | +```bash |
28 | 52 | decode_url |
29 | 53 | ───────────── |
30 | 54 | Hello World |
31 | 55 | (1 row) |
32 | | -
|
33 | | -=# select url_tools_schema.encode_uri('https://ru.wikipedia.org/wiki/Greenplum_(компания)'); |
| 56 | +``` |
| 57 | +```sql |
| 58 | +SELECT url_tools_schema.encode_uri('https://ru.wikipedia.org/wiki/Greenplum_(компания)'); |
| 59 | +``` |
| 60 | +```bash |
34 | 61 | encode_uri |
35 | 62 | ──────────────────────────────────────────────────────────────────────────────────────────── |
36 | 63 | https://ru.wikipedia.org/wiki/Greenplum_(%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D1%8F) |
37 | | -
|
38 | | -=# select url_tools_schema.decode_uri('https://ru.wikipedia.org/wiki/Greenplum_(%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D1%8F)'); |
| 64 | +``` |
| 65 | +```sql |
| 66 | +SELECT url_tools_schema.decode_uri('https://ru.wikipedia.org/wiki/Greenplum_(%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D1%8F)'); |
| 67 | +``` |
| 68 | +```bash |
39 | 69 | decode_uri |
40 | 70 | ──────────────────────────────────────────────────── |
41 | 71 | https://ru.wikipedia.org/wiki/Greenplum_(компания) |
42 | 72 | ``` |
43 | 73 |
|
44 | 74 | ### Acknowledgments |
45 | | -Thank you very much for the extension for postgrsql: https://github.com/okbob/url_encode, its sources were very useful. |
| 75 | +Thank you very much for the extension for PostgreSQL: https://github.com/okbob/url_encode, its sources were very useful. |
0 commit comments