Repository navigation
$queryRaw and $executeRaw GA - #2177
Conversation
thebiglabasky
left a comment
There was a problem hiding this comment.
Left some comments but generally looks good to me.
The interactive transactions content being there is a bit disturbing, but can work fine
thebiglabasky
left a comment
There was a problem hiding this comment.
I've spotted a couple of minor things.
One key question revolves around the ALTER table limitation and suggestion solution where I wonder if there is an error in the doc here.
|
|
||
| - Both versions of `$executeRaw` (tagged template and parameterized) can only run **one** query at a time. You cannot append a second query - for example, adding `DROP bobby_tables` to the end of an `ALTER`. | ||
|
|
||
| If you cannot use tagged templates or parameterized queries (for example, you need to pass in table or column names as variables), you can instead use [`$queryRawUnsafe`](#query-raw-unsafe) or [`$executeRawUnsafe`](#execute-raw-unsafe) but **be aware that your code may be vulnerable to SQL injection**. |
There was a problem hiding this comment.
Note for later: it could be good to point people to how to properly escape strings etc. to prevent SQL injections whenever using Unsafe signature methods. This can be done in a separate effort, but would be worthwhile as a user, since you otherwise just see you're in this situation but left with the task to figure out how to deal with it on your own.
There was a problem hiding this comment.
I agree, a new section within this page about how to escape strings while using $executeRawUnsafe / $queryRawUnsafe would be ideal. Ive asked @millsp about that. Would be good to link to it from within the page
There was a problem hiding this comment.
Somewhat related: I'm wondering if we could allow ALTER, CREATE, DROP in $executeRaw and instead of doing a prepared statement, we would automatically escape their inputs. I also think that we should look into providing some helper to escape input.
There was a problem hiding this comment.
@millsp is this something you are thinking about for 7th sept release?
There was a problem hiding this comment.
Those are interesting ideas indeed @millsp and I think we should track them in their individual issues, unless they would come with a breaking change, in such case that would be better to indeed do those before the new major.
There was a problem hiding this comment.
That won't be a breaking change, so I'll keep the improvements for later.
* SQL Server GA (#2164) * working on tutorial * MSSQL tasks, 2095, 2083, 2094, 2091, 2086, 2082 * working on tutorial * MSSQL tasks, 2095, 2083, 2094, 2091, 2086, 2082 * Update content/100-getting-started/02-setup-prisma/100-start-from-scratch/110-relational-databases/100-connect-your-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Feedback changes, including: mssql => sqlserver, clean up sections, fix sql tables Co-authored-by: Jan Piotrowski <[email protected]> * fix: broken links in mdx files * $queryRaw and $executeRaw GA (#2177) * Updated query raw page * Made sql injection warning scary * Changed sql injection warning, updated sql injection section, changed mock emails * Removed in preview from Interactive Transactions * fixed query * Removed section about template literals, fixed query * Minor change * Revert removal of in preview tags * Removed link to issue * add: initial full-text search docs * Sql Server GA part 2 (#2192) * Fixes #2084 * Fixes #2085 * Fixes #2088 * Fixes #2093 * Changed title of section, moved content and deleted tls section * Patch typeorm uses mssql (#2198) * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Sql server fixes (#2200) * SQL Server boolean type is bit * Note about decimal parameters * No need for params, when describing allowed types * bit is not bytes! * Fix SQL Server feature matrix (#2199) * Fix SQL Server feature matrix - No support for `RESTRICT` action - JSON support is only partial * Fix phrasing * Moved previews to GA (#2196) * Update schema ref attributes (#2213) * Added note of until version 3 the signiture was... * Fixed codeblocks inside quote blocks * `db seed` GA (#2161) * Updated db seed docs * Trigger build * Chnaged to require syntax * Update content/300-guides/050-database/300-seed-database.mdx Co-authored-by: Joël Galeran <[email protected]> * Feedback changes * Simplified copy and seed field * Added note about compile options when using nextjs * Update content/300-guides/050-database/300-seed-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Update content/300-guides/050-database/300-seed-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Changed copy according to feedback * Update content/300-guides/050-database/300-seed-database.mdx Co-authored-by: Tom Houlé <[email protected]> * Moved migrate section and added more context * Fixed alignment bug causing failed builds Co-authored-by: Joël Galeran <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Tom Houlé <[email protected]> * update node requirement from 12.2 to 12.6 (#2245) Closes prisma/orm#8839 * Sql server add to project guide (#2248) * Update 060-full-text-search.mdx (#2218) * Update 060-full-text-search.mdx Unfortunately pipes can't be escaped in our docs markdown parser right now. * Fixed code in md table with pipe Co-authored-by: Rich Haines <[email protected]> * Small fixes in self relation docs (#2221) - Fix a minor heading level inconsistency - Fix an issue with incorrect code highlighting * fix(codemods): Fix title (#2224) * fix(deps): update dependency @prisma/lens to v0.0.222 * fix(deps): update dependency @prisma/lens to v0.0.223 * fix(deps): update dependency @prisma/lens to v0.0.224 * fix(logging): Fix highlighted line in code (#2230) * fix(use-custom-model-and-field-names): Fix a typo (#2228) * feat(environment-variables): Expand env vars from system env, not only .env file (#2208) Co-authored-by: Rich Haines <[email protected]> * interactive transactions: update concept and tx guide with a better example (#2227) * interactive transactions: update concept and tx guide with a better example * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * fix(deps): update dependency @prisma/lens to v0.0.223 * fix(deps): update dependency @prisma/lens to v0.0.224 * fix(logging): Fix highlighted line in code (#2230) * fix(use-custom-model-and-field-names): Fix a typo (#2228) * feat(environment-variables): Expand env vars from system env, not only .env file (#2208) Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Rich Haines <[email protected]> * add spacing between header Co-authored-by: Hervé Labas <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Rich Haines <[email protected]> * Add to existing project sql server guide * Feedback changes Co-authored-by: Matthew Mueller <[email protected]> Co-authored-by: Tasin Ishmam <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Hervé Labas <[email protected]> * remove --preview-feature from db seed (#2250) * Upgrade guide to Prisma 3 + structural changes (#2247) * Update 060-full-text-search.mdx (#2218) * Update 060-full-text-search.mdx Unfortunately pipes can't be escaped in our docs markdown parser right now. * Fixed code in md table with pipe Co-authored-by: Rich Haines <[email protected]> * Small fixes in self relation docs (#2221) - Fix a minor heading level inconsistency - Fix an issue with incorrect code highlighting * fix(codemods): Fix title (#2224) * fix(deps): update dependency @prisma/lens to v0.0.222 * fix(deps): update dependency @prisma/lens to v0.0.223 * fix(deps): update dependency @prisma/lens to v0.0.224 * fix(logging): Fix highlighted line in code (#2230) * fix(use-custom-model-and-field-names): Fix a typo (#2228) * upgrade to prisma 3 guide plus structural changes * feat(environment-variables): Expand env vars from system env, not only .env file (#2208) Co-authored-by: Rich Haines <[email protected]> * interactive transactions: update concept and tx guide with a better example (#2227) * interactive transactions: update concept and tx guide with a better example * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * fix(deps): update dependency @prisma/lens to v0.0.223 * fix(deps): update dependency @prisma/lens to v0.0.224 * fix(logging): Fix highlighted line in code (#2230) * fix(use-custom-model-and-field-names): Fix a typo (#2228) * feat(environment-variables): Expand env vars from system env, not only .env file (#2208) Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Rich Haines <[email protected]> * add spacing between header Co-authored-by: Hervé Labas <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Rich Haines <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Refactor * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/100-named-constraints.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/100-named-constraints.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/100-named-constraints.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/100-named-constraints.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/index.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/300-upgrade-guides/250-upgrading-to-use-preview-features.mdx Co-authored-by: Hervé Labas <[email protected]> * small changes * Chnaged order of breaking changes to match release notes Co-authored-by: Matthew Mueller <[email protected]> Co-authored-by: Tasin Ishmam <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Hervé Labas <[email protected]> * Update 07-names-in-underlying-database.mdx * Upgrade guide mk2 (#2263) * Update 060-full-text-search.mdx (#2218) * Update 060-full-text-search.mdx Unfortunately pipes can't be escaped in our docs markdown parser right now. * Fixed code in md table with pipe Co-authored-by: Rich Haines <[email protected]> * Small fixes in self relation docs (#2221) - Fix a minor heading level inconsistency - Fix an issue with incorrect code highlighting * fix(codemods): Fix title (#2224) * fix(deps): update dependency @prisma/lens to v0.0.222 * fix(deps): update dependency @prisma/lens to v0.0.223 * fix(deps): update dependency @prisma/lens to v0.0.224 * fix(logging): Fix highlighted line in code (#2230) * fix(use-custom-model-and-field-names): Fix a typo (#2228) * feat(environment-variables): Expand env vars from system env, not only .env file (#2208) Co-authored-by: Rich Haines <[email protected]> * interactive transactions: update concept and tx guide with a better example (#2227) * interactive transactions: update concept and tx guide with a better example * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * fix(deps): update dependency @prisma/lens to v0.0.223 * fix(deps): update dependency @prisma/lens to v0.0.224 * fix(logging): Fix highlighted line in code (#2230) * fix(use-custom-model-and-field-names): Fix a typo (#2228) * feat(environment-variables): Expand env vars from system env, not only .env file (#2208) Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Hervé Labas <[email protected]> * Update content/300-guides/100-performance-and-optimization/100-prisma-client-transactions-guide.mdx Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/058-transactions.mdx Co-authored-by: Rich Haines <[email protected]> * add spacing between header Co-authored-by: Hervé Labas <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Rich Haines <[email protected]> * Missed feedback from previous PR Co-authored-by: Matthew Mueller <[email protected]> Co-authored-by: Tasin Ishmam <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Hervé Labas <[email protected]> * Chnaged image sin cloudinary (#2275) * Minor fixes to constraint names upgrade guide (#2274) * Minor fixes to constraint names upgrade guide * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/100-named-constraints.mdx * fix(prisma-client-transactions-guide): fix referential actions admon + Whats new week 30th sept (#2264) (#2267) * Whats new week 30th sept (#2264) * fix: broken links in mdx files * add: initial full-text search docs * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * Update content/200-concepts/100-components/02-prisma-client/060-full-text-search.mdx * whats new week 23rd and 30th Co-authored-by: Nilu <[email protected]> Co-authored-by: Matthew Mueller <[email protected]> * fix(prisma-client-transactions-guide): fix referential actions admon Co-authored-by: Rich Haines <[email protected]> Co-authored-by: Nilu <[email protected]> Co-authored-by: Matthew Mueller <[email protected]> * Added docs about the json nullability breaking change (#2265) * added docs about the json nullability breaking change * fix todos * Update content/200-concepts/100-components/02-prisma-client/051-working-with-fields/100-working-with-json-fields.mdx Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/051-working-with-fields/100-working-with-json-fields.mdx Co-authored-by: Rich Haines <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/051-working-with-fields/100-working-with-json-fields.mdx Co-authored-by: Rich Haines <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/index.mdx Co-authored-by: Rich Haines <[email protected]> Co-authored-by: Rich Haines <[email protected]> * Feedback changes (#2276) * db seed small fixes (#2281) * Document Node-API library (#2258) Co-authored-by: Hervé Labas <[email protected]> * Update content/400-reference/200-api-reference/300-environment-variables-reference.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Update content/400-reference/200-api-reference/300-environment-variables-reference.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Changes text * Update content/300-guides/050-database/300-seed-database.mdx Co-authored-by: Jan Piotrowski <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/150-referential-actions.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/150-referential-actions.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/150-referential-actions.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/150-referential-actions.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/150-referential-actions.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Introspection/db pull: Moved sections around, added link (#2282) * Moved sections around, added link * Update content/400-reference/200-api-reference/200-command-reference.mdx Co-authored-by: Joël Galeran <[email protected]> * Update content/400-reference/200-api-reference/200-command-reference.mdx Co-authored-by: Joël Galeran <[email protected]> * Update content/400-reference/200-api-reference/200-command-reference.mdx Co-authored-by: Joël Galeran <[email protected]> * split warning into 2 sections * Removed text as wrong * Update content/400-reference/200-api-reference/200-command-reference.mdx Co-authored-by: Joël Galeran <[email protected]> * Update content/400-reference/200-api-reference/200-command-reference.mdx Co-authored-by: Joël Galeran <[email protected]> Co-authored-by: Joël Galeran <[email protected]> * Update content/300-guides/300-upgrade-guides/200-upgrading-versions/050-upgrading-to-prisma-3/150-referential-actions.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Use the new constraint name defaults in SQL Server (#2284) ... migrate example * New constraint names for SQL Server introspection (#2286) * DANGER_PLAINTEXT should not be mentioned (#2287) * Update content/200-concepts/200-database-connectors/08-sql-server/index.mdx Co-authored-by: Julius de Bruijn <[email protected]> * Raw query fixes (#2285) * raw query fixes * changes * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * Update content/200-concepts/100-components/02-prisma-client/090-raw-database-access.mdx Co-authored-by: Pierre-Antoine Mills <[email protected]> * fixes Co-authored-by: Pierre-Antoine Mills <[email protected]> Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Nilu <[email protected]> Co-authored-by: Matthew Mueller <[email protected]> Co-authored-by: Hervé Labas <[email protected]> Co-authored-by: Julius de Bruijn <[email protected]> Co-authored-by: Joël Galeran <[email protected]> Co-authored-by: Tom Houlé <[email protected]> Co-authored-by: Tasin Ishmam <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Vespaiach <[email protected]> Co-authored-by: Pierre-Antoine Mills <[email protected]>
This PR update the
$queryRawand$executeRawdocs to reflect the changes made in prisma/orm#7142Fixes: #2157