outerbase / studio

A lightweight SQLite graphical client on your browser. It also support connecting to LibSQL/Turso/rqlite
https://libsqlstudio.com
GNU Affero General Public License v3.0
464 stars 23 forks source link

feat: added a type mismatch indicator (fixes #138) #143

Closed rentalhost closed 3 months ago

rentalhost commented 3 months ago

When a column is defined with one type (e.g., INTEGER) but stores a value of another type (e.g., TEXT), an indicator is displayed with a tooltip showing the mismatched type. This is very useful since SQLite has flexible typing, which can cause issues when the data is handled in an environment where this behavior is not expected.

image image image

Important information:

I had to modify a series of files to make this work properly, but I tried to do it in the best way possible. However, the convertSqliteType() function in the sql-helper.ts file made me the most "uncomfortable," since it's used in many places.

I had to make this change because there are cases where the type is not explicitly defined for SQLite, such as when accessing the default sqlite_sequence table. It defines name and seq, but their types are "" (literally empty), and currently, the code was forcing them to be interpreted as TEXT, which seems incorrect. For example, seq is sent as an integer, so it should be treated as INTEGER.

This was done to ensure that the mismatch comparison system stops considering this field for analysis, as the column type is natively undefined.

vercel[bot] commented 3 months ago

@rentalhost is attempting to deploy a commit to the Mediaload Team on Vercel.

A member of the Team first needs to authorize it.

invisal commented 3 months ago

convertSqliteType() at the moment is only used for determine the header type and use it for render cell. There is no other use-case. It is everywhere because it is used in each driver implementation. Everything looks good. Let me test further.

invisal commented 3 months ago

@rentalhost I commented the mismatch code temporary as it run into a few issues such as

Once I resolve these issues, I will uncomment it back

rentalhost commented 3 months ago

@invisal Thanks! I'll check that out right now.

invisal commented 3 months ago

@invisal Thanks! I'll check that out right now.

Thanks :) Don't make PR on that part temporary. I am porting MySQL support this weekend and will touch that part. Don't want to conflict with each other :)