Merge branch 'v1.8' of https://github.com/dapr/docs into v1.8

This commit is contained in:
Hannah Hunter 2022-09-23 10:39:29 -05:00
commit d55a5c3875
1 changed files with 17 additions and 5 deletions

View File

@ -38,6 +38,7 @@ spec:
{{% alert title="Warning" color="warning" %}}
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
Note that you can not use secret just for username/password. If you use secret, it has to be for the complete connection string.
{{% /alert %}}
## Spec metadata fields
@ -59,6 +60,14 @@ If your server requires SSL your connection string must end of `&tls=custom` for
```
You must replace the `<PEM PATH>` with a full path to the PEM file. If you are using [MySQL on Azure](http://bit.ly/AzureMySQLSSL) see the Azure [documentation on SSL database connections](http://bit.ly/MySQLSSL), for information on how to download the required certificate. The connection to MySQL will require a minimum TLS version of 1.2.
Also note that by default [MySQL go driver](https://github.com/go-sql-driver/mysql) only supports one SQL statement per query/command.
To allow multiple statements in one query you need to add `multiStatements=true` to a query string, for example:
```bash
"<user>:<password>@tcp(<server>:3306)/<database>?multiStatements=true"
```
While this allows batch queries, it also greatly increases the risk of SQL injections. Only the result of the first query is returned,
all other results are silently discarded.
## Binding support
This component supports **output binding** with the following operations:
@ -123,14 +132,17 @@ The `query` operation is used for `SELECT` statements, which returns the metadat
"end-time": "2020-09-24T11:13:46.420566Z",
"sql": "SELECT * FROM foo WHERE id < 3"
},
"data": "[
[0,\"test-0\",\"2020-09-24T04:13:46Z\"],
[1,\"test-1\",\"2020-09-24T04:13:46Z\"],
[2,\"test-2\",\"2020-09-24T04:13:46Z\"]
]"
"data": [
{column_name: value, column_name: value, ...},
{column_name: value, column_name: value, ...},
{column_name: value, column_name: value, ...},
]
}
```
Here column_name is the name of the column returned by query, and value is a value of this column. Note that values are returned as string
or numbers (language specific data type)
### close
Finally, the `close` operation can be used to explicitly close the DB connection and return it to the pool. This operation doesn't have any response.