MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / PgAdminDbBinaryString

Class PgAdminDbBinaryString

web/pgadmin/model/__init__.py:140–157  ·  view source on GitHub ↗

To make binary string storing compatible with both SQLite and PostgreSQL, convert the bin data to hex to store and convert hex back to binary to get

Source from the content-addressed store, hash-verified

138
139
140class PgAdminDbBinaryString(types.TypeDecorator):
141 """
142 To make binary string storing compatible with both
143 SQLite and PostgreSQL, convert the bin data to hex
144 to store and convert hex back to binary to get
145 """
146 cache_ok = True
147 impl = types.String
148
149 def process_bind_param(self, value, dialect):
150 return value.hex() if hasattr(value, 'hex') \
151 else value
152
153 def process_result_value(self, value, dialect):
154 try:
155 return bytes.fromhex(value)
156 except Exception as _:
157 return value
158
159
160class Version(db.Model):

Callers 5

UserClass · 0.85
ServerClass · 0.85
QueryHistoryModelClass · 0.85
ApplicationStateClass · 0.85
SharedServerClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected