I use RedBean PHP for testing, and I really like it, but I have no idea how I can crop the table. I can get all the beans and remove them, but that seems cumbersome.
In RedBean 1.3, you can use R :: wipe ($ type) to crop the table.
RedBean is just an ORM tool (AFAIK), so if your base database is SQL based, you can simply execute the SQL statement, for example: TRUNCATE TABLE yourTable;
TRUNCATE TABLE yourTable;
Fulfill queries directly through RedBean
- , RedBean. . :
$adapter = $toolbox->getDatabaseAdapter();
http://www.redbeanphp.com/downloads/redbean.pdf - 1.3 http://www.redbeanphp.com/manual/manual.pdf - 2.0
:
R::wipe($table);
MySQL :
function CleanAllTables() { $tables = R::getCol(' show tables '); foreach ($tables as $table) { R::wipe($table); } }
MySQL
TRUNCATE TABLE <table_name>
RedBean
$adapter->exec('TRUNCATE TABLE <table_name>');
!:)
, , , RedBean 4.0+ (, , ) , N-M .
So, in this case, in my case, to get around this, it was necessary to set the foreign key checks to 0.
R::exec('SET FOREIGN_KEY_CHECKS = 0;'); R::wipe('tablename');
Source: https://habr.com/ru/post/1778354/More articles:Super call in method of redefined class - method-overridingКлавиши ускорения DevExpress не отображаются в xtraBars - vb.netGood version of Ruby on Rails for .Net developer - ruby-on-railsSQL Server: is it possible to cascade update its own binding table? - sql-serverПроблема с grails [object не является экземпляром объявления класса] - tomcatКак перенаправить вывод интерпретатора python и перехватить его в строке в программе на С++? - c++JQuery Delay between key functions - jqueryOverriding or aliasing a column name in an old database using Rails / ActiveRecord - databasehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1778358/dynamically-adding-columns-to-a-dbixclass-resultset&usg=ALkJrhijOUuuCXjSlDcb3ugKHKLhO50a4AIs ThreadPool in this scenario? - multithreadingAll Articles