docs icon indicating copy to clipboard operation
docs copied to clipboard

SQL Statements Doc Update : PREPARE / EXECUTE / DEALLOCATE

Open hand-crdb opened this issue 3 years ago • 0 comments

Re: SQL Statements

Issue Description

There is no documentation on the following statements:

  • PREPARE
  • EXECUTE
  • DEALLOCATE

Per internal discussion, these statements are supported.

Related PostgreSQL doc is https://www.postgresql.org/docs/current/sql-prepare.html

Suggested Resolution

Document the PREPARE, EXECUTE, and DEALLOCATE statements.

Here is an example of using these statements, using the cockroach demo command:

[email protected]:26257/movr> select count(*) from users where city='seattle';
  count
---------
      6
(1 row)

Time: 2ms total (execution 2ms / network 0ms)

[email protected]:26257/movr> prepare q1 (string) as select count(*) from users where city=$1;
PREPARE

Time: 1ms total (execution 1ms / network 0ms)

[email protected]:26257/movr> execute q1 ('seattle');
  count
---------
      6
(1 row)

Time: 2ms total (execution 2ms / network 0ms)

[email protected]:26257/movr> deallocate q1;
DEALLOCATE

Time: 1ms total (execution 0ms / network 0ms)

hand-crdb avatar Apr 22 '22 12:04 hand-crdb