Skip to content

Adding support for prepared statements in Swift driver#91

Open
shruti-p-s wants to merge 2 commits intoapple:mainfrom
shruti-p-s:enc-prepared-statements
Open

Adding support for prepared statements in Swift driver#91
shruti-p-s wants to merge 2 commits intoapple:mainfrom
shruti-p-s:enc-prepared-statements

Conversation

@shruti-p-s
Copy link
Copy Markdown
Contributor

Adding support for prepared statements in Swift driver.

Motivation:

The client had no way to prepare CQL queries server-side and reuse them. Every query was parsed fresh on each execution. For encrypted workloads, this also meant write-path validation could only check one direction — encrypted values bound to wrong columns — because inline queries lack column name metadata for positional parameters.

Modifications:

  • PreparedStatement wrapper class around the C driver's CassPrepared*, exposing parameter count and column name metadata. - prepare() and execute(prepared:) on CassandraSession protocol, with both EventLoopFuture and async variants, plus Codable decoding overload.
  • Bidirectional encryption validation using prepared statement parameter metadata — catches both plaintext→encrypted and encrypted→plaintext mismatches.
  • 5 integration tests (4 ELF, 1 async) and 3 encryption integration tests using prepared statements.

Result:

Users can prepare queries once and execute them repeatedly with different parameters, avoiding repeated server-side parsing. Encrypted workloads get full bidirectional write-path validation when using prepared statements with column registration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant