Skip to content

Commit 4f2a119

Browse files
committed
Removing references to multi-statement prepare().
1 parent 73083c0 commit 4f2a119

File tree

3 files changed

+0
-19
lines changed

3 files changed

+0
-19
lines changed

src/content/changelogs/d1.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ productLink: "/d1/"
55
productArea: Developer platform
66
productAreaLink: /workers/platform/changelog/platform/
77
entries:
8-
- publish_date: "2024-11-01"
9-
title: Support for multiple queries in a single prepared statement
10-
description: |-
11-
You can now have multiple queries in a single prepared statement when using `db.prepare`. To use this feature, separate each query with a semi-colon. Prepared statements with multiple queries only returns the results of the last query, even though all queries are executed. Additionally, you can only bind parameters to the last query in the prepared statement.
12-
13-
For more information, refer to [`db.prepare` guidance](/d1/worker-api/prepare-a-statement/#guidance).
148
- publish_date: "2024-08-23"
159
title: D1 alpha databases have stopped accepting SQL queries
1610
description: |-

src/content/docs/d1/worker-api/index.mdx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export default {
6868
const companyName1 = `Bs Beverages`;
6969
const companyName2 = `Around the Horn`;
7070
const stmt = env.DB.prepare(`SELECT * FROM Customers WHERE CompanyName = ?`);
71-
const stmtMulti = env.DB.prepare(`SELECT * FROM Customers; SELECT * FROM Customers WHERE CompanyName = ?`);
7271

7372
if (pathname === `/RUN`){
7473
const returnValue = await stmt.bind(companyName1).run();
@@ -87,13 +86,8 @@ export default {
8786
stmt.bind(companyName1),
8887
stmt.bind(companyName2)
8988
]);
90-
// const returnValue = await stmt.run();
9189
return Response.json(batchResult);
9290

93-
} else if (pathname === `/RUNMULTI`){
94-
const returnValue = await stmtMulti.bind(companyName1).run();
95-
return Response.json(returnValue);
96-
9791
} else if (pathname === `/EXEC`){
9892
const returnValue = await env.DB.exec(`SELECT * FROM Customers WHERE CompanyName = "Bs Beverages"`);
9993
return Response.json(returnValue);

src/content/docs/d1/worker-api/prepare-a-statement.mdx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ const stmt = env.DB.prepare("SELECT * FROM Customers WHERE CompanyName = ?").bin
5858
.bind(1, "Alfreds Futterkiste");
5959
```
6060

61-
- You can pass multiple queries into a single `.prepare()` statement. Simply delineate each query with a semi-colon.
62-
- The statement only returns the results of the last query, even though all queries are executed.
63-
- You can only bind parameters to the last query.
64-
```js
65-
const stmt = db.prepare(`SELECT * FROM users WHERE name = "Anthony"; SELECT * FROM users WHERE name = ?1`).bind("Joe")
66-
```
67-
6861
## Static statements
6962

7063
D1 API supports static statements. Static statements are SQL statements where the variables have been hard coded. When writing a static statement, you manually type the variable within the statement string.

0 commit comments

Comments
 (0)