also looking at this
fix(client)!: bind db.raw and db.sql fragment values or refuse them
#1152
16 files
+455
-118
| @@ -350,13 +350,15 @@ function optimizeForSQLite() { | ||
| 350 | 350 | - **Migration Strategy**: Plan for potential dialect changes |
| 351 | 351 | |
| 352 | 352 | ```ts |
| 353 | import { raw } from 'bun-query-builder' | |
| 354 | ||
| 353 | 355 | // Feature detection pattern |
| 354 | 356 | function getRandomOrderQuery() { |
| 355 | 357 | const randomFunction = config.sql.randomFunction || 'RANDOM()' |
| 356 | 358 | |
| 357 | 359 | return db |
| 358 | 360 | .selectFrom('quotes') |
| 359 | .orderByRaw(db.sql`${randomFunction}`) | |
| 361 | .orderByRaw(raw(randomFunction)) | |
| 360 | 362 | .limit(1) |
| 361 | 363 | } |
| 362 | 364 | |