@prisma-next/sql-orm-client 0.5.1 → 0.6.0-dev.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,7 @@ import {
20
20
  ProjectionItem,
21
21
  SelectAst,
22
22
  } from '@prisma-next/sql-relational-core/ast';
23
+ import { codecRefForStorageColumn } from '@prisma-next/sql-relational-core/codec-descriptor-registry';
23
24
 
24
25
  export function bindWhereExpr(contract: Contract<SqlStorage>, expr: AnyExpression): AnyExpression {
25
26
  return bindWhereExprNode(contract, expr);
@@ -118,14 +119,11 @@ function createParamRef(
118
119
  columnRef: ColumnRef,
119
120
  value: unknown,
120
121
  ): ParamRef {
121
- const codecId = contract.storage.tables[columnRef.table]?.columns[columnRef.column]?.codecId;
122
- if (!codecId) {
122
+ if (!contract.storage.tables[columnRef.table]?.columns[columnRef.column]) {
123
123
  throw new Error(`Unknown column "${columnRef.column}" in table "${columnRef.table}"`);
124
124
  }
125
- return ParamRef.of(value, {
126
- codecId,
127
- refs: { table: columnRef.table, column: columnRef.column },
128
- });
125
+ const codec = codecRefForStorageColumn(contract.storage, columnRef.table, columnRef.column);
126
+ return ParamRef.of(value, codec ? { codec } : undefined);
129
127
  }
130
128
 
131
129
  function createExpressionBinder(contract: Contract<SqlStorage>): ExpressionRewriter {
@@ -176,8 +174,7 @@ function bindSelectAst(contract: Contract<SqlStorage>, ast: SelectAst): SelectAs
176
174
  new ProjectionItem(
177
175
  projection.alias,
178
176
  bindProjectionExpr(contract, projection.expr),
179
- projection.codecId,
180
- projection.refs,
177
+ projection.codec,
181
178
  ),
182
179
  ),
183
180
  where: ast.where ? bindWhereExprNode(contract, ast.where) : undefined,