You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cpp/libpq/README.md
+78-22Lines changed: 78 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,52 @@
1
-
# Aurora DSQL Libpq code examples
1
+
# Libpq with Aurora DSQL
2
2
3
3
## Overview
4
4
5
-
The code examples in this topic show you how to use the Libpq with Aurora DSQL.
5
+
This code example demonstrates how to use the Libpq library to interact with Amazon Aurora DSQL (DSQL). The example shows you how
6
+
to connect to an Aurora DSQL cluster and perform basic database operations.
7
+
8
+
Aurora DSQL is a distributed SQL database service that provides high availability and scalability for
9
+
your PostgreSQL-compatible applications. Libpq is a popular PostgreSQL library that allows
10
+
you to interact with PostgreSQL databases using c/cpp code.
11
+
12
+
## About the code example
13
+
14
+
The example demonstrates a flexible connection approach that works for both admin and non-admin users:
15
+
16
+
* When connecting as an **admin user**, the example uses the `public` schema and generates an admin authentication
17
+
token.
18
+
* When connecting as a **non-admin user**, the example uses a custom `myschema` schema and generates a standard
19
+
authentication token. The `myschema` schema needs to be created prior to running the example and the **non-admin user** needs to be granted access to the schema.
20
+
21
+
The code automatically detects the user type and adjusts its behavior accordingly.
22
+
The example contains comments explaining the code and the operations being performed.
23
+
24
+
## ⚠️ Important
25
+
26
+
* Running this code might result in charges to your AWS account.
27
+
* We recommend that you grant your code least privilege. At most, grant only the
28
+
minimum permissions required to perform the task. For more information, see
29
+
[Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
30
+
* This code is not tested in every AWS Region. For more information, see
# Note: Follow build and installation instructions on the official website.
69
+
# This example is meant to point to the -DBUILD_ONLY="dsql" flag.
70
+
```
27
71
28
72
#### Libpq library and Postgres include files
29
73
30
74
- The path to the Libpq library and include files will need to be specified for compilation
31
75
- The path to the Libpq library will need to be specified for execution
32
76
- Obtaining Libpq library
33
77
- It is installed with postgres installation. Therefore, if postgres is installed on the system the libpq is present in ../postgres_install_dir/lib, ../postgres_install_dir/include
34
-
- It is installed when psql client program is installed, similarily as with postgres installation
78
+
- It is installed when psql client program is installed, similarly as with postgres installation
35
79
- On some systems libpq can be installed through package manager (if the package exists for the system) e.g.
Edit the variables specifying path to the postgres include files and path to the location of the libpq library.
@@ -96,16 +136,26 @@ pg_config --libdir
96
136
97
137
##### Mac
98
138
99
-
The Mac related variables are in the 'Mac' section of the make file.
100
-
If necessary, adjust the directory locations.
101
-
For example:
139
+
The Mac related variables are in the 'Mac' section of the Makefile.
140
+
Edit the variables specifying path to the postgres include files and path to the location of the libpq library as well as the compiler include directory.
141
+
142
+
**Note:** These are examples only. Replace them with your path.
0 commit comments