Skip to content

Commit

Permalink
Merge pull request #424 from kaneeldias/sentence
Browse files Browse the repository at this point in the history
Update doc titles with sentence case and remove -ing
  • Loading branch information
daneshk authored Mar 25, 2022
2 parents 6b0fbf3 + de15f26 commit 2f3b8c5
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 73 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To access a database, you must first create a
[`mysql:Client`](https://docs.central.ballerina.io/ballerinax/mysql/latest/clients/Client) object.
The samples for creating a MySQL client can be found below.
#### Creating a Client
#### Create a client
This sample shows the different ways of creating the `mysql:Client`.
The client can be created with an empty constructor, and thereby, the client will be initialized with the default properties.
Expand Down Expand Up @@ -77,9 +77,9 @@ mysql:Client|sql:Error dbClient = new (user = "rootUser", password = "rootPass",
connectionPool = {maxOpenConnections: 5});
```

#### Using SSL
#### SSL usage
To connect to the MySQL database using an SSL connection, you must add the SSL configurations to `mysql:Options` when creating the `mysql:Client`.
For the SSL Mode, you can select one of the modes: `mysql:SSL_PREFERRED`, `mysql:SSL_REQUIRED`, `mysql:SSL_VERIFY_CA`, or `mysql:SSL_VERIFY_IDENTITY` according to the requirement.
For the SSL mode, you can select one of the modes: `mysql:SSL_PREFERRED`, `mysql:SSL_REQUIRED`, `mysql:SSL_VERIFY_CA`, or `mysql:SSL_VERIFY_IDENTITY` according to the requirement.
The key and cert files must be provided in the `.p12` format.

```ballerina
Expand All @@ -100,7 +100,7 @@ mysql:Options mysqlOptions = {
}
};
```
#### Connection Pool Handling
#### Handle connection pools

All database libraries share the same connection pooling concept and there are three possible scenarios for
connection pool handling. For its properties and possible values, see [`sql:ConnectionPool`](https://docs.central.ballerina.io/ballerina/sql/latest/records/ConnectionPool).
Expand Down Expand Up @@ -150,7 +150,7 @@ The [`mysql:Client`](https://docs.central.ballerina.io/ballerinax/mysql/latest/c
the [`sql:Client`](https://docs.central.ballerina.io/ballerina/sql/latest/clients/Client) and all the operations
defined by the `sql:Client` will be supported by the `mysql:Client` as well.
#### Closing the Client
#### Close the client
Once all the database operations are performed, you can close the client you have created by invoking the `close()`
operation. This will close the corresponding connection pool if it is not shared by any other clients.
Expand All @@ -163,13 +163,13 @@ Or
check dbClient.close();
```

### Database Operations
### Database operations

Once the client is created, database operations can be executed through that client. This library defines the interface
and common properties that are shared among multiple database clients. It also supports querying, inserting, deleting,
updating, and batch updating data.

#### Parameterized Query
#### Parameterized query

The `sql:ParameterizedQuery` is used to construct the SQL query to be executed by the client.
You can create a query with constant or dynamic input data as follows.
Expand Down Expand Up @@ -221,7 +221,7 @@ sql:ParameterizedQuery sqlQuery =
sql:arrayFlattenQuery(ids), `)`);
```

#### Creating Tables
#### Create tables

This sample creates a table with three columns. The first column is a primary key of type `int`, while the second
column is of type `int` and the other is of type `varchar`.
Expand All @@ -239,7 +239,7 @@ sql:ExecutionResult result =
// A value of the sql:ExecutionResult type is returned for 'result'.
```

#### Inserting Data
#### Insert data

These samples show the data insertion by executing an `INSERT` statement using the `execute` remote function
of the client.
Expand Down Expand Up @@ -279,7 +279,7 @@ sql:ParameterizedQuery query = `INSERT INTO student(age, name)
sql:ExecutionResult result = check dbClient->execute(query);
```

#### Inserting Data With Auto-generated Keys
#### Insert data with auto-generated keys

This sample demonstrates inserting data while returning the auto-generated keys. It achieves this by using the
`execute` remote function to execute the `INSERT` statement.
Expand All @@ -299,7 +299,7 @@ int? count = result.affectedRowCount;
string|int? generatedKey = result.lastInsertId;
```

#### Querying Data
#### Query data

These samples show how to demonstrate the different usages of the `query` operation to query the
database table and obtain the results.
Expand Down Expand Up @@ -382,7 +382,7 @@ sql:ParameterizedQuery query = `SELECT COUNT(*) FROM students WHERE age < ${age}
int youngStudents = check dbClient->queryRow(query);
```

#### Updating Data
#### Update data

This sample demonstrates modifying data by executing an `UPDATE` statement via the `execute` remote function of
the client.
Expand All @@ -393,7 +393,7 @@ sql:ParameterizedQuery query = `UPDATE students SET name = 'John' WHERE age = ${
sql:ExecutionResult result = check dbClient->execute(query);
```

#### Deleting Data
#### Delete data

This sample demonstrates deleting data by executing a `DELETE` statement via the `execute` remote function of
the client.
Expand All @@ -404,7 +404,7 @@ sql:ParameterizedQuery query = `DELETE from students WHERE name = ${name}`;
sql:ExecutionResult result = check dbClient->execute(query);
```

#### Batch Updating Data
#### Batch update data

This sample demonstrates how to insert multiple records with a single `INSERT` statement that is executed via the
`batchExecute` remote function of the client. This is done by creating a `table` with multiple records and
Expand All @@ -425,7 +425,7 @@ sql:ParameterizedQuery[] batch = from var row in data
sql:ExecutionResult[] result = check dbClient->batchExecute(batch);
```

#### Execute Stored Procedures
#### Execute stored procedures

This sample demonstrates how to execute a stored procedure with a single `INSERT` statement that is executed via the
`call` remote function of the client.
Expand All @@ -449,28 +449,28 @@ Note that you have to invoke the close operation explicitly on the `sql:Procedur

>**Note:** The default thread pool size used in Ballerina is: `the number of processors available * 2`. You can configure the thread pool size by using the `BALLERINA_MAX_POOL_SIZE` environment variable.
## Issues and Projects
## Issues and projects

Issues and Projects tabs are disabled for this repository as this is part of the Ballerina Standard Library. To report bugs, request new features, start new discussions, view project boards, etc. please visit Ballerina Standard Library [parent repository](https://github.com/ballerina-platform/ballerina-standard-library).
Issues and Projects tabs are disabled for this repository as this is part of the Ballerina standard library. To report bugs, request new features, start new discussions, view project boards, etc. please visit Ballerina Standard Library [parent repository](https://github.com/ballerina-platform/ballerina-standard-library).

This repository only contains the source code for the package.

## Building from the Source
## Build from the source

### Setting Up the Prerequisites
### Set up the prerequisites

1. Download and install Java SE Development Kit (JDK) version 11 (from one of the following locations).
* [Oracle](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)
* [OpenJDK](http://openjdk.java.net/install/index.html)

2. Download and install [Docker](https://www.docker.com/get-started)

3. Export GitHub Personal access token with read package permissions as follows,
3. Export your GitHub personal access token with read package permissions as follows.

export packageUser=<Username>
export packagePAT=<Personal access token>

### Building the Source
### Build the source

Execute the commands below to build from the source.

Expand All @@ -492,7 +492,7 @@ Execute the commands below to build from the source.

**Tip:** The following groups of test cases are available.

Groups | Test Cases
Groups | Test cases
---| ---
connection | connection-init<br> ssl
pool | pool
Expand Down Expand Up @@ -528,17 +528,17 @@ Execute the commands below to build from the source.

./gradlew clean build -PpublishToCentral=true

## Contributing to Ballerina
## Contribute to Ballerina

As an open source project, Ballerina welcomes contributions from the community.

For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md).

## Code of Conduct
## Code of conduct

All contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct).
All contributors are encouraged to read the [Ballerina code of conduct](https://ballerina.io/code-of-conduct).

## Useful Links
## Useful links

* For more information go to the [`mysql` library](https://lib.ballerina.io/ballerinax/mysql/latest).
* For example demonstrations of the usage, go to [Ballerina By Examples](https://ballerina.io/learn/by-example/mysql-init-options.html).
Expand Down
30 changes: 15 additions & 15 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To access a database, you must first create a
[`mysql:Client`](https://docs.central.ballerina.io/ballerinax/mysql/latest/clients/Client) object.
The samples for creating a MySQL client can be found below.
#### Creating a Client
#### Create a client
This sample shows the different ways of creating the `mysql:Client`.
The client can be created with an empty constructor, and thereby, the client will be initialized with the default properties.
Expand Down Expand Up @@ -70,9 +70,9 @@ mysql:Client|sql:Error dbClient = new (user = "rootUser", password = "rootPass",
connectionPool = {maxOpenConnections: 5});
```

#### Using SSL
#### SSL usage
To connect to the MySQL database using an SSL connection, you must add the SSL configurations to `mysql:Options` when creating the `mysql:Client`.
For the SSL Mode, you can select one of the modes: `mysql:SSL_PREFERRED`, `mysql:SSL_REQUIRED`, `mysql:SSL_VERIFY_CA`, or `mysql:SSL_VERIFY_IDENTITY` according to the requirement.
For the SSL mode, you can select one of the modes: `mysql:SSL_PREFERRED`, `mysql:SSL_REQUIRED`, `mysql:SSL_VERIFY_CA`, or `mysql:SSL_VERIFY_IDENTITY` according to the requirement.
The key and cert files must be provided in the `.p12` format.

```ballerina
Expand All @@ -93,7 +93,7 @@ mysql:Options mysqlOptions = {
}
};
```
#### Connection Pool Handling
#### Handle connection pools

All database modules share the same connection pooling concept and there are three possible scenarios for
connection pool handling. For its properties and possible values, see [`sql:ConnectionPool`](https://docs.central.ballerina.io/ballerina/sql/latest/records/ConnectionPool).
Expand Down Expand Up @@ -143,7 +143,7 @@ The [`mysql:Client`](https://docs.central.ballerina.io/ballerinax/mysql/latest/c
the [`sql:Client`](https://docs.central.ballerina.io/ballerina/sql/latest/clients/Client) and all the operations
defined by the `sql:Client` will be supported by the `mysql:Client` as well.
#### Closing the Client
#### Close the client
Once all the database operations are performed, you can close the client you have created by invoking the `close()`
operation. This will close the corresponding connection pool if it is not shared by any other clients.
Expand All @@ -156,13 +156,13 @@ Or
check dbClient.close();
```

### Database Operations
### Database operations

Once the client is created, database operations can be executed through that client. This module defines the interface
and common properties that are shared among multiple database clients. It also supports querying, inserting, deleting,
updating, and batch updating data.

#### Parameterized Query
#### Parameterized query

The `sql:ParameterizedQuery` is used to construct the SQL query to be executed by the client.
You can create a query with constant or dynamic input data as follows.
Expand Down Expand Up @@ -214,7 +214,7 @@ sql:ParameterizedQuery sqlQuery =
sql:arrayFlattenQuery(ids), `)`);
```

#### Creating Tables
#### Create tables

This sample creates a table with three columns. The first column is a primary key of type `int`, while the second
column is of type `int` and the other is of type `varchar`.
Expand All @@ -232,7 +232,7 @@ sql:ExecutionResult result =
// A value of the sql:ExecutionResult type is returned for 'result'.
```

#### Inserting Data
#### Insert data

These samples show the data insertion by executing an `INSERT` statement using the `execute` remote function
of the client.
Expand Down Expand Up @@ -272,7 +272,7 @@ sql:ParameterizedQuery query = `INSERT INTO student(age, name)
sql:ExecutionResult result = check dbClient->execute(query);
```

#### Inserting Data With Auto-generated Keys
#### Insert data with auto-generated keys

This sample demonstrates inserting data while returning the auto-generated keys. It achieves this by using the
`execute` remote function to execute the `INSERT` statement.
Expand All @@ -292,7 +292,7 @@ int? count = result.affectedRowCount;
string|int? generatedKey = result.lastInsertId;
```

#### Querying Data
#### Query data

These samples show how to demonstrate the different usages of the `query` operation to query the
database table and obtain the results.
Expand Down Expand Up @@ -375,7 +375,7 @@ sql:ParameterizedQuery query = `SELECT COUNT(*) FROM students WHERE age < ${age}
int youngStudents = check dbClient->queryRow(query);
```

#### Updating Data
#### Update data

This sample demonstrates modifying data by executing an `UPDATE` statement via the `execute` remote function of
the client.
Expand All @@ -386,7 +386,7 @@ sql:ParameterizedQuery query = `UPDATE students SET name = 'John' WHERE age = ${
sql:ExecutionResult result = check dbClient->execute(query);
```

#### Deleting Data
#### Delete data

This sample demonstrates deleting data by executing a `DELETE` statement via the `execute` remote function of
the client.
Expand All @@ -397,7 +397,7 @@ sql:ParameterizedQuery query = `DELETE from students WHERE name = ${name}`;
sql:ExecutionResult result = check dbClient->execute(query);
```

#### Batch Updating Data
#### Batch update data

This sample demonstrates how to insert multiple records with a single `INSERT` statement that is executed via the
`batchExecute` remote function of the client. This is done by creating a `table` with multiple records and
Expand All @@ -418,7 +418,7 @@ sql:ParameterizedQuery[] batch = from var row in data
sql:ExecutionResult[] result = check dbClient->batchExecute(batch);
```

#### Execute Stored Procedures
#### Execute stored procedures

This sample demonstrates how to execute a stored procedure with a single `INSERT` statement that is executed via the
`call` remote function of the client.
Expand Down
Loading

0 comments on commit 2f3b8c5

Please sign in to comment.