Commit 72b29763 authored by jan.koester's avatar jan.koester
Browse files

test

parent f4283bc6
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -184,11 +184,9 @@ void dbpp::ReplicatedDatabase::addReplica(const std::string &dbdriver, const std
bool dbpp::ReplicatedDatabase::isWriteStatement(const char *sql) {
    if (!sql) return false;

    // Skip leading whitespace
    while (*sql == ' ' || *sql == '\t' || *sql == '\n' || *sql == '\r')
        ++sql;

    // Case-insensitive prefix check for write statements
    auto startsWith = [](const char *s, const char *prefix) -> bool {
        while (*prefix) {
            if (std::tolower((unsigned char)*s) != std::tolower((unsigned char)*prefix))
@@ -208,7 +206,6 @@ bool dbpp::ReplicatedDatabase::isWriteStatement(const char *sql) {

int dbpp::ReplicatedDatabase::exec(const SQL &sql, DBResult &res) const {
    if (isWriteStatement(sql.c_str())) {
        // Write: execute on primary first, then replicate to all replicas
        int rows = _primary->exec(sql, res);

        for (const auto &replica : _replicas) {
@@ -222,7 +219,6 @@ int dbpp::ReplicatedDatabase::exec(const SQL &sql, DBResult &res) const {

        return rows;
    } else {
        // Read: only from primary
        return _primary->exec(sql, res);
    }
}