Feature #2574 ยป 0001-Add-support-for-deferrable-FK-constraints.patch
| src/Wt/Dbo/Session.C | ||
|---|---|---|
|
else if (field.fkConstraints() & Impl::FKOnDeleteSetNull)
|
||
|
sql << " on delete set null";
|
||
|
if (connection(false)->supportDeferrableFKConstraint()) //backend condition
|
||
|
sql << " deferrable initially deferred";
|
||
|
return sql.str();
|
||
|
}
|
||
| src/Wt/Dbo/SqlConnection | ||
|---|---|---|
|
*/
|
||
|
virtual bool supportAlterTable() const;
|
||
|
/*! \brief Returns true if the backend supports "deferrable initially
|
||
|
* deferred" foreign key constraints
|
||
|
*
|
||
|
* This method will return false by default.
|
||
|
*/
|
||
|
virtual bool supportDeferrableFKConstraint() const;
|
||
|
/*! \brief Returns the command used in alter table .. drop constraint ..
|
||
|
*
|
||
|
* This method will return "constraint" by default.
|
||
| src/Wt/Dbo/SqlConnection.C | ||
|---|---|---|
|
return false;
|
||
|
}
|
||
|
bool SqlConnection::supportDeferrableFKConstraint() const
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
const char *SqlConnection::alterTableConstraintString() const
|
||
|
{
|
||
|
return "constraint";
|
||
| src/Wt/Dbo/backend/Postgres | ||
|---|---|---|
|
virtual const char *dateTimeType(SqlDateTimeType type) const;
|
||
|
virtual const char *blobType() const;
|
||
|
virtual bool supportAlterTable() const;
|
||
|
virtual bool supportDeferrableFKConstraint() const;
|
||
|
//@}
|
||
|
private:
|
||
| src/Wt/Dbo/backend/Postgres.C | ||
|---|---|---|
|
return true;
|
||
|
}
|
||
|
bool Postgres::supportDeferrableFKConstraint() const
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
void Postgres::startTransaction()
|
||
|
{
|
||
|
PGresult *result = PQexec(conn_, "start transaction");
|
||
| src/Wt/Dbo/backend/Sqlite3 | ||
|---|---|---|
|
virtual std::string autoincrementInsertSuffix() const;
|
||
|
virtual const char *dateTimeType(SqlDateTimeType type) const;
|
||
|
virtual const char *blobType() const;
|
||
|
virtual bool supportDeferrableFKConstraint() const;
|
||
|
//@}
|
||
|
private:
|
||
|
DateTimeStorage dateTimeStorage_[2];
|
||
| src/Wt/Dbo/backend/Sqlite3.C | ||
|---|---|---|
|
return "blob not null";
|
||
|
}
|
||
|
bool Sqlite3::supportDeferrableFKConstraint() const
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
void Sqlite3::setDateTimeStorage(SqlDateTimeType type,
|
||
|
DateTimeStorage storage)
|
||
|
{
|
||
| test/dbo/DboTest.C | ||
|---|---|---|
|
}
|
||
|
}
|
||
|
#if 0 // doesn't work, no solution yet
|
||
|
BOOST_AUTO_TEST_CASE( dbo_test17 )
|
||
|
{
|
||
|
DboFixture f;
|
||
| ... | ... | |
|
a.modify()->b = b;
|
||
|
}
|
||
|
#if !defined(FIREBIRD) && !defined(MYSQL)
|
||
|
{
|
||
|
dbo::Transaction t(*session_);
|
||
|
dbo::ptr<A> a = session_->find<A>();
|
||
| ... | ... | |
|
b.remove(); // 2
|
||
|
a.remove(); // 3
|
||
|
}
|
||
|
#endif //!FIREBIRD && !MYSQL
|
||
|
}
|
||
|
#endif
|
||
|
BOOST_AUTO_TEST_CASE( dbo_test18 )
|
||
|
{
|
||