本文整理汇总了C++中enableAuthorizer函数的典型用法代码示例。如果您正苦于以下问题:C++ enableAuthorizer函数的具体用法?C++ enableAuthorizer怎么用?C++ enableAuthorizer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enableAuthorizer函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disableAuthorizer
Vector<String> Database::performGetTableNames()
{
disableAuthorizer();
SQLiteStatement statement(sqliteDatabase(), "SELECT name FROM sqlite_master WHERE type='table';");
if (statement.prepare() != SQLResultOk) {
LOG_ERROR("Unable to retrieve list of tables for database %s", databaseDebugName().ascii().data());
enableAuthorizer();
return Vector<String>();
}
Vector<String> tableNames;
int result;
while ((result = statement.step()) == SQLResultRow) {
String name = statement.getColumnText(0);
if (name != databaseInfoTableName())
tableNames.append(name);
}
enableAuthorizer();
if (result != SQLResultDone) {
LOG_ERROR("Error getting tables for database %s", databaseDebugName().ascii().data());
return Vector<String>();
}
return tableNames;
}
示例2: locker
int SQLiteDatabase::runIncrementalVacuumCommand()
{
LockHolder locker(m_authorizerLock);
enableAuthorizer(false);
if (!executeCommand(ASCIILiteral("PRAGMA incremental_vacuum")))
LOG(SQLDatabase, "Unable to run incremental vacuum - %s", lastErrorMsg());
enableAuthorizer(true);
return lastError();
}
示例3: locker
int64_t SQLiteDatabase::maximumSize()
{
MutexLocker locker(m_authorizerLock);
enableAuthorizer(false);
SQLiteStatement statement(*this, "PRAGMA max_page_count");
int64_t size = statement.getColumnInt64(0) * pageSize();
enableAuthorizer(true);
return size;
}
示例4: locker
int64_t SQLiteDatabase::freeSpaceSize()
{
MutexLocker locker(m_authorizerLock);
enableAuthorizer(false);
// Note: freelist_count was added in SQLite 3.4.1.
SQLiteStatement statement(*this, "PRAGMA freelist_count");
int64_t size = statement.getColumnInt64(0) * pageSize();
enableAuthorizer(true);
return size;
}
示例5: pageSize
void SQLiteDatabase::setMaximumSize(int64_t size)
{
if (size < 0)
size = 0;
int currentPageSize = pageSize();
ASSERT(currentPageSize || !m_db);
int64_t newMaxPageCount = currentPageSize ? size / currentPageSize : 0;
LockHolder locker(m_authorizerLock);
enableAuthorizer(false);
SQLiteStatement statement(*this, "PRAGMA max_page_count = " + String::number(newMaxPageCount));
statement.prepare();
if (statement.step() != SQLITE_ROW)
LOG_ERROR("Failed to set maximum size of database to %lli bytes", static_cast<long long>(size));
enableAuthorizer(true);
}
示例6: pageSize
void SQLiteDatabase::setMaximumSize(int64_t size)
{
if (size < 0)
size = 0;
int currentPageSize = pageSize();
ASSERT(currentPageSize || !m_db);
int64_t newMaxPageCount = currentPageSize ? size / currentPageSize : 0;
MutexLocker locker(m_authorizerLock);
enableAuthorizer(false);
SQLiteStatement statement(*this, "PRAGMA max_page_count = " + String::number(newMaxPageCount));
statement.prepare();
if (statement.step() != SQLResultRow)
DLOG(ERROR) << "Failed to set maximum size of database to " << size << " bytes";
enableAuthorizer(true);
}
示例7: NOTREACHED
void SQLiteDatabase::setAuthorizer(DatabaseAuthorizer* auth)
{
if (!m_db) {
NOTREACHED() << "Attempt to set an authorizer on a non-open SQL database";
return;
}
MutexLocker locker(m_authorizerLock);
m_authorizer = auth;
enableAuthorizer(true);
}