Comments (6)
Предположительно поправили в последнем релизе.
from database.
Возможно пофикшено в #66
from database.
Possibly fixed in # 66
I think so. I haven't had this issue in a while. This was also suggested in #62 (comment)
from database.
I'm getting the same exception on SPV0
not sure if it's related. It's coming from spiral/migrations when running migrations.
while (($migration = $migrator->run()) !== null) {
$output->writeln("+ {$migration->getState()->getName()}");
}
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT SVP0 does not exist
I think this is running execute on a CREATE TABLE
statement that implicitly commits the transaction. Then when you try to commit the transaction it throws an exception that is caught and then the rollBack
is called and dose not have a save point to go back to. The below snippet is from https://github.com/spiral/database/blob/master/src/Database.php#L244-L254 and if you wrap the commit
in a try you get "There is no active transaction"
try {
$result = $callback($this);
- $this->commit();
+ try {
+ $this->commit();
+ } catch (Throwable $e) {
+ $e->getMessage(); // "There is no active transaction"
+ }
return $result;
} catch (Throwable $e) {
$this->rollBack();
throw $e;
}
I have managed to fix the issue by wrapping the $this->getPDO()->commit()
in $this->getPDO()->inTransaction()
only commit if there is an active transaction in the driver.
try {
- return $this->getPDO()->commit();
+ if ($this->getPDO()->inTransaction()) {
+ return $this->getPDO()->commit();
+ }
} catch (Throwable $e) {
throw $this->mapException($e, 'COMMIT TRANSACTION');
}
It is also worth mentioning I am only getting this on php 8 it is working OK on 7.4. Don't know what the next steps are, I am happy to make a PR if your happy with the $this->getPDO()->inTransaction()
fix.
from database.
Об ошибке PDOException: There is no active transaction
:
Прошёл по всему стеку и выяснил, что транзакцию прерывает, например, CREATE TABLE
в $pdo->execute()
.
Полагаю, что это связано с тем, что $pdo->beginTransaction()
не срабатывает должным образом.
Похоже на то, что транзакция начинается (вызов $pdo->inTransaction()
после beginTransaction()
возвращает true
), но при этом не выключается режим автоматической фиксации транзакции, как написано в документации.
Воспроизводится на php 8 + mysql (5.7, 8.0)
from database.
Also covered by tests in cycle/database#16
from database.
Related Issues (20)
- `where between` with reverted order escapes the value as it is a column name HOT 3
- Hints for new features for INSERT HOT 3
- Would like to add an oci8 driver for Oracle Support HOT 1
- Migration fails with too-long index name
- Support json for mysql driver HOT 1
- [Question] - SQL Injection HOT 2
- Incorrect logic for isolation level setting for Postgres driver HOT 1
- Statement->fetchAll(\PDO::FETCH_OBJ) returns arrays HOT 2
- В SELECT запросе в качестве колонки некорректно работает Expression HOT 10
- Улучшение работы с транзакциями
- ManyToMany relation persist problem HOT 1
- Feature request: Create connection from DSN HOT 7
- Cannot create compound unique index in Postgres HOT 6
- [MySQL 5.7] Test failed HOT 1
- Разобраться с методом `SelectQuery->join()` HOT 1
- Максимальная длина varchar
- Column with attribute ON UPDATE CURRENT_TIMESTAMP
- Map `Packets out of order` mysqlnd error in MySQL driver HOT 1
- [Datetime Format] Incorrect format for [Y-m-d H:i:s.u].
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from database.