Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(sql-editor): display for the bit type in decimal (#9769)

Liu Ji4859e60d51f9
diff --git a/frontend/src/utils/v1/sql.ts b/frontend/src/utils/v1/sql.ts
index f02a58426b..42601d95fa 100644
--- a/frontend/src/utils/v1/sql.ts
+++ b/frontend/src/utils/v1/sql.ts
@@ -16,6 +16,21 @@ export const extractSQLRowValue = (value: RowValue) => {
if (keys.length > 1) {
console.debug("mixed type in row value", value);
}
+ if (value.bytesValue) {
+ // convert byte arrays to binary 10101001 strings
+ const byteArray = value.bytesValue;
+ const parts: string[] = [];
+ for (let i = 0; i < byteArray.length; i++) {
+ const byte = byteArray[i];
+ const part = byte.toString(2).padStart(8, "0");
+ parts.push(part);
+ }
+ const binaryString = parts.join("").replace(/^0+/g, "");
+ if (binaryString.length === 0) {
+ return "0";
+ }
+ return binaryString;
+ }
const key = keys[0];
return plainObject[key];
};