本文整理汇总了PHP中R::wipe方法的典型用法代码示例。如果您正苦于以下问题:PHP R::wipe方法的具体用法?PHP R::wipe怎么用?PHP R::wipe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::wipe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBatch
/**
* Begin testing.
* This method runs the actual test pack.
*
* @return void
*/
public function testBatch()
{
$toolbox = R::$toolbox;
$adapter = $toolbox->getDatabaseAdapter();
$writer = $toolbox->getWriter();
$redbean = $toolbox->getRedBean();
$pdo = $adapter->getDatabase();
$page = $redbean->dispense("page");
$page->name = "page no. 1";
$page->rating = 1;
$id1 = $redbean->store($page);
$page = $redbean->dispense("page");
$page->name = "page no. 2";
$id2 = $redbean->store($page);
$batch = $redbean->batch("page", array($id1, $id2));
asrt(count($batch), 2);
asrt($batch[$id1]->getMeta("type"), "page");
asrt($batch[$id2]->getMeta("type"), "page");
asrt((int) $batch[$id1]->id, $id1);
asrt((int) $batch[$id2]->id, $id2);
$book = $redbean->dispense("book");
$book->name = "book 1";
$redbean->store($book);
$book = $redbean->dispense("book");
$book->name = "book 2";
$redbean->store($book);
$book = $redbean->dispense("book");
$book->name = "book 3";
$redbean->store($book);
$books = $redbean->batch("book", $adapter->getCol("SELECT id FROM book"));
asrt(count($books), 3);
$a = $redbean->batch('book', 9919);
asrt(is_array($a), TRUE);
asrt(count($a), 0);
$a = $redbean->batch('triangle', 1);
asrt(is_array($a), TRUE);
asrt(count($a), 0);
R::freeze(TRUE);
$a = $redbean->batch('book', 9919);
asrt(is_array($a), TRUE);
asrt(count($a), 0);
$a = $redbean->batch('triangle', 1);
asrt(is_array($a), TRUE);
asrt(count($a), 0);
R::freeze(FALSE);
asrt(R::wipe('spaghettimonster'), FALSE);
}
示例2: testCountAndWipe
/**
* Test count and wipe.
*
* @return void
*/
public function testCountAndWipe()
{
testpack("Test count and wipe");
$page = R::dispense("page");
$page->name = "ABC";
R::store($page);
$n1 = R::count("page");
$page = R::dispense("page");
$page->name = "DEF";
R::store($page);
$n2 = R::count("page");
asrt($n1 + 1, $n2);
R::wipe("page");
asrt(R::count("page"), 0);
asrt(R::$redbean->count("page"), 0);
asrt(R::$redbean->count("kazoo"), 0);
// non existing table
R::freeze(TRUE);
asrt(R::$redbean->count("kazoo"), 0);
// non existing table
R::freeze(FALSE);
$page = R::dispense('page');
$page->name = 'foo';
R::store($page);
$page = R::dispense('page');
$page->name = 'bar';
R::store($page);
asrt(R::count('page', ' name = ? ', array('foo')), 1);
// Now count something that does not exist, this should return 0. (just be polite)
asrt(R::count('teapot', ' name = ? ', array('flying')), 0);
asrt(R::count('teapot'), 0);
$currentDriver = $this->currentlyActiveDriverID;
// Some drivers don't support that many error codes.
if ($currentDriver === 'mysql' || $currentDriver === 'postgres') {
try {
R::count('teaport', ' for tea ');
fail();
} catch (RedBean_Exception_SQL $e) {
pass();
}
}
}
示例3:
<?php
/**
* GNL/SF Routing
*/
/**
* Updating SF Credentials
*
*/
if (isset($_REQUEST['sf_credentials'])) {
//print_r($_REQUEST);
R::wipe('sfcredentials');
$creds = R::dispense('sfcredentials');
$creds->usr = $_REQUEST['usr'];
$creds->pwd = $_REQUEST['pwd'];
$creds->key = $_REQUEST['key'];
$id = R::store($creds);
}
/**
* Create admin page
*/
if ($_SERVER['REQUEST_URI'] == '/') {
if (isset($_SESSION['loggedin'])) {
require 'page.tpl.php';
} else {
require 'login.tpl.php';
}
}
/*
A Few Phone Call Leads:
465314 - *
示例4:
<?php
require './rb.php';
R::setup('mysql:host=192.168.56.154;dbname=c9hallhatoszinek', 'c9hallhatoszinek', 'justNow465');
R::wipe("user");
R::wipe("sound");
示例5: function
} else {
return FALSE;
}
}
});
/**
* @api {get} /api/v1/wipe/ Erases all jobs.
* @apiDescription Erases all jobs (Testing purposes only).
* @apiGroup wipe
* @apiName WipeJobs
* @apiVersion 1.0.0
* @apiExample {curl} Example usage:
* curl 'http://pyro.demo/api/v1/wipe'
*/
$app->get('/api/v1/wipe/', function () use($app) {
R::wipe("job");
echo "The jobs have been wiped.";
});
/**
* @api {get} /api/v1/kill/:id Kills a job.
* @apiDescription Kills a currently running job.
* @apiGroup kill
* @apiName KillJob
* @apiVersion 1.0.0
* @apiExample {curl} Example usage:
* curl 'http://pyro.demo/api/v1/kill/1
* @apiSuccess (200 OK) {String} A string indicating kill and delete were successful.
* @apiError (400 Bad Request) {String) A string indicating the job does not exist.
*/
$app->get('/api/v1/kill/:id', function ($id) use($app) {
$job = DB::GetJob($id);
示例6: updateRoomList
/**
* Updating class rooms from list.
*
* @param array $array Class rooms list
*/
private function updateRoomList($array)
{
R::wipe('sale');
//print_r($array);
foreach ($array as $salax) {
//print_r($salax);
R::useWriterCache(true);
$classroom = R::dispense('sale');
$legacy_id = $salax[0];
$legacy_id = substr($legacy_id, 0, strlen($legacy_id) - 5);
$legacy_id = substr($legacy_id, 34);
$test = 'test';
$classroom->legacy_id = (string) $legacy_id;
$classroom->skrot = (string) $salax[1];
$classroom->pelna_nazwa = (string) '';
$id = R::store($classroom);
}
}
示例7: deleteAll
public static function deleteAll()
{
Database::setup();
$userBean = R::dispense(Model_User::$table_name);
R::wipe($userBean);
}
示例8: clearsystemlog
public static function clearsystemlog($userid)
{
if (self::if_table_exists('systemlog')) {
$rs = R::wipe('systemlog');
return $rs;
} else {
self::createSystemlog();
return 0;
}
}
示例9: DeleteAllCompanyStatus
public function DeleteAllCompanyStatus()
{
R::wipe('companystatus');
}
示例10: testViews
R::$writer->setBeanFormatter($tf);
testViews("prefix_");
$tf2 = new Fm2();
R::$writer->setBeanFormatter($tf2);
testViews("prefix_");
testpack("wipe and constraints");
R::exec(" drop table if exists page ");
R::exec(" drop table if exists book ");
R::exec(" drop table if exists book_page ");
R::exec(" drop table if exists prefix_page ");
R::exec(" drop table if exists prefix_book ");
R::exec(" drop table if exists prefix_book_page ");
R::exec("DROP TRIGGER IF EXISTS fkc2d4c7ea9e656a361bc08c9d072914cca ");
R::exec("DROP TRIGGER IF EXISTS fkc2d4c7ea9e656a361bc08c9d072914ccb ");
$page1 = R::dispense("page");
$book1 = R::dispense("book");
$page2 = R::dispense("page");
$book2 = R::dispense("book");
$page1->name = "page1";
$page2->name = "page2";
$book1->name = "book1";
$book2->name = "book2";
R::associate($book1, $page1);
R::associate($book2, $page2);
//exit;
asrt(count(R::getAll("select * from prefix_book_page")), 2);
R::trash($book1);
asrt(count(R::getAll("select * from prefix_book_page")), 1);
R::wipe("book");
asrt(count(R::getAll("select * from prefix_book_page")), 0);
printtext("\nALL TESTS PASSED. REDBEAN SHOULD WORK FINE.\n");
示例11: asrt
asrt(setget("null"), "null");
asrt(setget("NULL"), "NULL");
asrt(setget("0123", 1), "0123");
asrt(setget("0000123", 1), "0000123");
asrt(setget(null), null);
asrt(setget(0) == 0, true);
asrt(setget(1) == 1, true);
asrt(setget(true) == true, true);
asrt(setget(false) == false, true);
testpack("fetch tagged items");
R::exec("drop table author_book");
R::exec("drop table author");
R::exec("drop table book");
R::wipe("book");
R::wipe("tag");
R::wipe("book_tag");
$b = R::dispense("book");
$b->title = 'horror';
R::store($b);
$c = R::dispense("book");
$c->title = 'creepy';
R::store($c);
$d = R::dispense("book");
$d->title = "chicklit";
R::store($d);
R::tag($b, "horror,classic");
R::tag($d, "women,classic");
R::tag($c, "horror");
$x = R::tagged("book", "classic");
asrt(count($x), 2);
$x = R::tagged("book", "classic,horror");
示例12: testTransactions
/**
* Test Transactions.
*
* @return void
*/
public function testTransactions()
{
testpack('transactions');
R::begin();
$bean = R::dispense('bean');
R::store($bean);
R::commit();
asrt(R::count('bean'), 1);
R::wipe('bean');
R::freeze(1);
R::begin();
$bean = R::dispense('bean');
R::store($bean);
R::rollback();
asrt(R::count('bean'), 0);
R::freeze(FALSE);
testpack('genSlots');
asrt(R::genSlots(array('a', 'b')), '?,?');
asrt(R::genSlots(array('a')), '?');
asrt(R::genSlots(array()), '');
}
示例13: createImportTempTable
protected function createImportTempTable($columnCount, $tableName)
{
$freezeWhenComplete = false;
if (RedBeanDatabase::isFrozen()) {
RedBeanDatabase::unfreeze();
$freezeWhenComplete = true;
}
$newBean = R::dispense($tableName);
for ($i = 0; $i < $columnCount; $i++) {
$columnName = 'column_' . $i;
$newBean->{$columnName} = str_repeat(' ', 50);
$columns[] = $columnName;
}
R::store($newBean);
R::trash($newBean);
R::wipe($tableName);
ImportDatabaseUtil::optimizeTableNonImportColumns($tableName);
R::wipe($tableName);
if ($freezeWhenComplete) {
RedBeanDatabase::freeze();
}
}
示例14: asrt
R::associate($painter, $painter);
asrt(getList(R::unrelated($accountant, "person"), "job"), "");
asrt(getList(R::unrelated($painter, "person"), "job"), "developer,salesman");
asrt(getList(R::unrelated($salesman, "person"), "job"), "painter");
asrt(getList(R::unrelated($developer, "person"), "job"), "painter");
testpack("Test count and wipe");
$page = R::dispense("page");
$page->name = "ABC";
R::store($page);
$n1 = R::count("page");
$page = R::dispense("page");
$page->name = "DEF";
R::store($page);
$n2 = R::count("page");
asrt($n1 + 1, $n2);
R::wipe("page");
asrt(R::count("page"), 0);
asrt(R::$redbean->count("page"), 0);
function setget($val)
{
global $pdo;
$bean = R::dispense("page");
$_tables = R::$writer->getTables();
if (in_array("page", $_tables)) {
$pdo->Execute("DROP TABLE page");
}
$bean->prop = $val;
$id = R::store($bean);
$bean = R::load("page", $id);
asrt(is_string($bean->prop) || is_null($bean->prop), true);
return $bean->prop;
示例15: wipe
public function wipe()
{
\R::wipe($this->getTableName());
}