You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are these two traits that represent a database value, yet it seems that most of SQLx relies on ValueRef and I struggled to find the use of Value implementors when developing sqlx-exasol.
My question is really about how is this relationship between implementors of Value and the ones of ValueRef supposed to work? In sqlx-exasol, Value contains a serde_json::Value (the data communicated in JSON format over a websocket) and ValueRef contains a reference to that serde_json::Value.
However, if the ownership of the data would be transferred to the ValueRef, that would remove the need to clone the value when deserializing it to a concrete type. The only reason I didn't directly go with that is because there's also the Row API, which can theoretically allow you to retrieve the same column value multiple times. If the ownership of the serde_json::Value is transferred (leaving maybe a Value::Null in its place) then that would provide inconsistent results.
I don't know how much the Row API is used though, or if this "gimme the value at row[2] multiple times" is even something that's expected to work (personally I don't think so), so I'd like to understand the proper way to go about this and what the expectations are.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There are these two traits that represent a database value, yet it seems that most of SQLx relies on
ValueRef
and I struggled to find the use ofValue
implementors when developing sqlx-exasol.My question is really about how is this relationship between implementors of
Value
and the ones ofValueRef
supposed to work? Insqlx-exasol
,Value
contains aserde_json::Value
(the data communicated in JSON format over a websocket) andValueRef
contains a reference to thatserde_json::Value
.However, if the ownership of the data would be transferred to the
ValueRef
, that would remove the need to clone the value when deserializing it to a concrete type. The only reason I didn't directly go with that is because there's also theRow
API, which can theoretically allow you to retrieve the same column value multiple times. If the ownership of theserde_json::Value
is transferred (leaving maybe aValue::Null
in its place) then that would provide inconsistent results.I don't know how much the
Row
API is used though, or if this "gimme the value at row[2] multiple times" is even something that's expected to work (personally I don't think so), so I'd like to understand the proper way to go about this and what the expectations are.Beta Was this translation helpful? Give feedback.
All reactions