r2dbc_exec()

Read(2394) Label: execute, sql statement,

Description:

Execute a SQL statement through R2DBC.

Syntax:

r2dbc_exec(con,sql)

Note:

The external library function (See External Library Guide) executes basic SQL statements.

Parameter:

con

Database connection string

sql

A SQL statement

Example:

 

A

 

1

=r2dbc_open("r2dbcs:mysql://root:123456@127.0.0.1:3306/mytest")

Connect to mysql database.

2

=r2dbc_exec(A1,"create table test (id int PRIMARY KEY,name VARCHAR(255),age INT)")

Create a table.

3

=r2dbc_exec(A1, "drop table test1")

Delete a table.

4

=r2dbc_exec(A1,"insert into test values(?,?,?)",1,"Lily",1001)

Insert data to table.