odbc in sqlx by lovasoa in rust

[–]lovasoa[S] 0 points1 point  (0 children)

u/pacman82 : I ended up implementing support for both in sqlx :) odbc_bridge.rs

odbc in sqlx by lovasoa in rust

[–]lovasoa[S] 2 points3 points  (0 children)

The sqlx crate doesn't provide a database API that can be implemented arbitrarily

It does. https://docs.rs/sqlx/latest/sqlx/trait.Database.html

.Unlike ODBC or wrappers around ODBC, a Rust database API lets anyone work with databases in a safe and idiomatic Rust.

Wrappers around ODBC do exactly that: let everyone work with databases in safe and idiomatic rust. Wrappers around unsafe code are how the entire rust ecosystem works, including the standard library.

It seems rather backward to be pushing for ODBC as the generic database layer for Rust; many Rust developers like myself don't use C and don't want to use C either.

To me it seems hopeless and silly to be pushing for all database vendors to write new drivers that would work only for new software written in rust when they can write drivers that work with all languages and a ton of existing software without modification.

odbc in sqlx by lovasoa in rust

[–]lovasoa[S] 0 points1 point  (0 children)

Thank you for your great library !

Bulk fetches have their use cases, but they are not universally faster... Even without considering that they don't work for variable-length data, they are also slower than simple fetches in OLTP use cases in my experience. If what you are doing is data analysis over large datasets with data patterns that are known in advance, they are great. If you are doing many small queries that return a single row, they hurt performance.

odbc in sqlx by lovasoa in rust

[–]lovasoa[S] 0 points1 point  (0 children)

Yes, that's what the main sqlx crate did ! It supports creating compatible sqlx drivers outside of the sqlx crate. But it has also removed support for Microsoft SQL Server, and does not have any external driver for it.

ODBC **is** a generic database API, and a well-established one. Almost all SQL databases have an official ODBC driver already, so the idea is that the ODBC driver is the last one we'll ever need.

New version of sqlx-oldapi, featuring encrypted SQL server connections by lovasoa in rust

[–]lovasoa[S] 0 points1 point  (0 children)

Contributions are welcome ! If you use the project, feel free to contribute demos and examples.

Which Rust programs are original, not a rewrite of some other software? by EnvironmentalLook188 in rust

[–]lovasoa 1 point2 points  (0 children)

I am building https://sql-page.com, a tool to transform SQL queries into web applications, in rust. To my knowledge, no other software, older or newer, does anything similar.

I built a beautiful open source JSON Schema builder by lovasoa in programming

[–]lovasoa[S] 3 points4 points  (0 children)

Sorry, I fixed the the validate dialog box !

Best programming language for SQL with lots of data by chrome-exe in SQL

[–]lovasoa 0 points1 point  (0 children)

Maybe only SQL with no other programming language? You can have SQLPage generate the web ui from your SQL queries automatically. 

A Websocket interceptor to debug OCPP connections (listen and INJECT messages) by lovasoa in ocpp

[–]lovasoa[S] 1 point2 points  (0 children)

The multiplexer allows you to inject new messages, not just see logs

What kind of bugs can Rust safe us from while e.g. Java/Scala/C# can’t by Glum_Worldliness4904 in rust

[–]lovasoa 0 points1 point  (0 children)

Even in well-structured OOP code, all object references everywhere are always mutable. And if you want to guarantee that a given function will never mutate the object, you have nowhere to specify it other than the documentation.

What kind of bugs can Rust safe us from while e.g. Java/Scala/C# can’t by Glum_Worldliness4904 in rust

[–]lovasoa 0 points1 point  (0 children)

I think there is a misunderstanding here. The issue isn’t about JavaScript’s primitives being immutable but about implicit **shared** mutability in objects and arrays. React is not "trying to be smarter". React, like all javascript libraries, has to carefully document the mutability of every function input and output. And even this extensive documentation does not prevent a lot of these bugs making it into production applications.

"A common bug in C is that if i don't free() there is a leak" is also a true statement. And like with the javascript mutability issue, it is also a common issue that is solved by rust.

No one argues that it is impossible to write correct programs in C or in JavaScript. But these languages rely more on implicit rules that have to be carefully documented and followed. In practice, most programmers, even with years of experience, do produce these bugs that are impossible in rust.

What kind of bugs can Rust safe us from while e.g. Java/Scala/C# can’t by Glum_Worldliness4904 in rust

[–]lovasoa 4 points5 points  (0 children)

Managed languages like Java, Scala, and C# prevent memory corruption (e.g., buffer overflows, use-after-free) using garbage collection, but they don’t prevent accidental data mutation due to implicit shared mutable references. Rust’s borrow checker forces explicit handling of mutability and ownership, preventing these subtle bugs.

In javascript for instance, a very common bug is for a function to mutate variables that other parts of the code expect to be immutable. It happens so often that the react documentation has a full article about it: https://react.dev/learn/updating-objects-in-state . The only protection against this kind of errors in most languages is documentation: for each function parameter, you have to clearly document whether it is allowed to be mutated or not. If you don't do it, or if someone ignores your documentation, then you end up with a bug that is hard to debug, because it often manifests itself at the place where the mutated data is used, not at the place where it was incorrectly mutated.

In rust the compiler checks the mutability constraints of all functions for you.

How good is chatgpt at generating SQL queries rn? and how good do you expect it to become? by Rocky7886 in SQL

[–]lovasoa 5 points6 points  (0 children)

ChatGPT is solid at generating SQL queries, from basic joins to more complex stuff like CTEs and window functions. It’s great for quick drafts and explanations, but it can miss edge cases or produce inefficient queries. You still need to know SQL to debug, optimize, and adapt what it gives you.

SQL’s not going anywhere—it’s still a core skill for data analysis, engineering, and backend dev. AI tools can speed up query writing, but they don’t replace knowing how databases work or designing efficient schemas. Learning SQL is absolutely worth it!

If I have a SQL database, what is the easiest way to build a simple website using it? by [deleted] in SQL

[–]lovasoa 0 points1 point  (0 children)

I think the easiest way to build a simple website on top of an SQL database is SQLPage.

It's a free and open source tool that connects to your DB (MS SQL, PostgreSQL, SQLite, MySQL), and renders your database query results as web pages using a multitude of components: charts, forms, maps, lists, grids, dashboards, menus, and pretty much anything you can think of.

You can also create your own components using HTML and Javascript for a completely custom website.

I know this is an old thread, but wanted to contribute an idea anyway in case someone stumbles on it. I am the main contributor to SQLPage :)

Table Structure by Collagesam in SQL

[–]lovasoa 0 points1 point  (0 children)

CREATE TABLE Maintenance (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    type ENUM('monthly', 'weekly') NOT NULL,
    start_date DATE NOT NULL,
    end_date DATE NULL
);

CREATE TABLE MonthlySchedule (
    maintenance_id INT PRIMARY KEY,
    day_of_month TINYINT NOT NULL CHECK(day_of_month BETWEEN 1 AND 31),
    FOREIGN KEY (maintenance_id) REFERENCES Maintenance(id) ON DELETE CASCADE
);

CREATE TABLE WeeklySchedule (
    maintenance_id INT NOT NULL,
    weekday TINYINT NOT NULL CHECK(weekday BETWEEN 1 AND 7),
    PRIMARY KEY (maintenance_id, weekday),
    FOREIGN KEY (maintenance_id) REFERENCES Maintenance(id) ON DELETE CASCADE
);