Skip to content

Commit

Permalink
X
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfengHKU committed Nov 29, 2023
1 parent ba3f037 commit 158e5df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ std::unique_ptr<PreparedStatement> Connection::prepareNoLock(
auto statement = Parser::parseQuery(query);
preparedStatement->preparedSummary.statementType = statement->getStatementType();
preparedStatement->readOnly = parser::StatementReadWriteAnalyzer().isReadOnly(*statement);
if (database->systemConfig.readOnly && !preparedStatement->isReadOnly()) {
throw ConnectionException("Cannot execute write operations in a read-only database!");
}
if (statement->getStatementType() != StatementType::TRANSACTION) {
auto txContext = clientContext->transactionContext.get();
if (txContext->isAutoTransaction()) {
Expand All @@ -114,6 +111,9 @@ std::unique_ptr<PreparedStatement> Connection::prepareNoLock(
if (!clientContext->getTx()->isReadOnly()) {
database->catalog->initCatalogContentForWriteTrxIfNecessary();
database->storageManager->initStatistics();
if (database->systemConfig.readOnly) {
throw ConnectionException("Cannot execute write operations in a read-only database!");
}
}
}
// binding
Expand Down

0 comments on commit 158e5df

Please sign in to comment.