当前位置: 首页>>代码示例>>C++>>正文


C++ Blob::constData方法代码示例

本文整理汇总了C++中Blob::constData方法的典型用法代码示例。如果您正苦于以下问题:C++ Blob::constData方法的具体用法?C++ Blob::constData怎么用?C++ Blob::constData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blob的用法示例。


在下文中一共展示了Blob::constData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Open

void SqliteConnection::Open(const path& file, FileAccess fileAccess, FileShare share) {
	int flags = 0;
#if UCFG_USE_SQLITE==3
	if (share == FileShare::None)
		flags = SQLITE_OPEN_EXCLUSIVE;
#else
	Blob utf = Encoding::UTF8.GetBytes(String(file));
#endif
	switch (fileAccess) {
	case FileAccess::ReadWrite: flags |= SQLITE_OPEN_READWRITE; break;
	case FileAccess::Read: flags |= SQLITE_OPEN_READONLY; break;
	default:
		Throw(E_INVALIDARG);
	}
	sqlite_db *pdb;
#if UCFG_USE_SQLITE==3
	SqliteCheck(m_db, ::sqlite3_open_v2(String(file), &pdb, flags, 0));
	m_db.reset(pdb);
	::sqlite3_extended_result_codes(m_db, true);
#else
	SqliteCheck(m_db, ::sqlite4_open(0, (const char*)utf.constData(), &pdb));
	m_db.reset(pdb);
#endif
	ExecuteNonQuery("PRAGMA foreign_keys = ON");
}
开发者ID:Groestlcoin,项目名称:el,代码行数:25,代码来源:ext-sqlite.cpp

示例2: ExecuteNonQuery

void SqliteConnection::ExecuteNonQuery(RCString sql) {
    String s = sql.TrimEnd();
    if (s.Length > 1 && s[s.Length-1] != ';')
        s += ";";

#if UCFG_USE_SQLITE==3
    for (const void *tail=(const Char16*)s; SqliteIsComplete16(tail);) {
        SqliteCommand cmd(_self);
        SqliteCheck(_self, ::sqlite3_prepare16_v2(_self, tail, -1, &cmd.m_stmt, &tail));
#else
    Blob utf = Encoding::UTF8.GetBytes(s);
    for (const char *tail=(const char*)utf.constData(); SqliteIsComplete(tail);) {
        SqliteCommand cmd(_self);
        SqliteCheck(_self, ::sqlite_prepare(_self, tail, -1, &cmd.m_stmt, &tail));
#endif
        cmd.ExecuteNonQuery();
    }
}

Int64 SqliteConnection::get_LastInsertRowId() {
    return sqlite_last_insert_rowid(m_db);
}

pair<int, int> SqliteConnection::Checkpoint(int eMode) {
#if UCFG_USE_SQLITE==3
    int log, ckpt;
    SqliteCheck(_self, ::sqlite3_wal_checkpoint_v2(_self, 0, eMode, &log, &ckpt));
    return make_pair(log, ckpt);
#else
    ExecuteNonQuery("PRAGMA lsm_checkpoint");
    return make_pair(0, 0);							//!!!?
#endif
}
开发者ID:sirmax1,项目名称:coin,代码行数:33,代码来源:ext-sqlite.cpp

示例3: ConvertToBase58

String ConvertToBase58(const ConstBuf& cbuf) {
	HashValue hash = HasherEng::GetCurrent()->HashForAddress(cbuf);
	Blob v = cbuf + Blob(hash.data(), 4);
	vector<char> r;

	vector<byte> tmp(v.Size+1, 0);
	std::reverse_copy(v.begin(), v.end(), tmp.begin());
	for (BigInteger n(&tmp[0], tmp.size()); Sign(n);) {
		pair<BigInteger, BigInteger> pp = div(n, 58);
		n = pp.first;
		r.insert(r.begin(), s_pszBase58[explicit_cast<int>(pp.second)]);
	}

	for (int i=0; i<v.Size && !v.constData()[i]; ++i)
		r.insert(r.begin(), s_pszBase58[0]);
	return String(&r[0], r.size());
}
开发者ID:Groestlcoin,项目名称:Groestlcoin-WPF,代码行数:17,代码来源:base58.cpp

示例4: Create

void SqliteConnection::Create(RCString file) {
#if UCFG_USE_SQLITE==3
    SqliteCheck(m_db, ::sqlite3_open16((const String::Char*)file, &m_db));
    ::sqlite_extended_result_codes(m_db, true);	//!!!? only Sqlite3?
#else
    Blob utf = Encoding::UTF8.GetBytes(file);
    SqliteCheck(m_db, ::sqlite4_open(0, (const char*)utf.constData(), &m_db));
#endif
    ExecuteNonQuery("PRAGMA encoding = \"UTF-8\"");
    ExecuteNonQuery("PRAGMA foreign_keys = ON");

    /*!!!
    #ifndef SQLITE_OMIT_TRACE
    	sqlite3_trace(m_con.db, DbTraceHandler, this);
    #endif
    	*/
}
开发者ID:sirmax1,项目名称:coin,代码行数:17,代码来源:ext-sqlite.cpp

示例5: ConvertToBase58ShaSquare

String ConvertToBase58ShaSquare(const ConstBuf& cbuf) {
	SHA256 sha;
	HashValue hash = HashValue(sha.ComputeHash(sha.ComputeHash(cbuf)));
	Blob v = cbuf + Blob(hash.data(), 4);
	vector<char> r;

	vector<byte> tmp(v.Size+1, 0);
	std::reverse_copy(v.begin(), v.end(), tmp.begin());
	for (BigInteger n(&tmp[0], tmp.size()); Sign(n);) {
		pair<BigInteger, BigInteger> pp = div(n, 58);
		n = pp.first;
		r.insert(r.begin(), s_pszBase58[explicit_cast<int>(pp.second)]);
	}

	for (int i=0; i<v.Size && !v.constData()[i]; ++i)
		r.insert(r.begin(), s_pszBase58[0]);
	return String(&r[0], r.size());
}
开发者ID:Groestlcoin,项目名称:Groestlcoin-WPF,代码行数:18,代码来源:base58.cpp

示例6: WriteAttributeString

void XmlTextWriter::WriteAttributeString(RCString name, RCString value) {
	Blob blob = Encoding->GetBytes(name);
	WriteAttributeString((const char*)blob.constData(), value);
}
开发者ID:coinhelper,项目名称:coin,代码行数:4,代码来源:xml-writer.cpp

示例7: WriteQuotedString

void XmlTextWriter::WriteQuotedString(RCString value) {
	Blob blob = Encoding->GetBytes(value);
	m_os << quote(string((char*)blob.constData(), blob.Size));
}
开发者ID:coinhelper,项目名称:coin,代码行数:4,代码来源:xml-writer.cpp

示例8:

void XptMessage::WriteString16(BinaryWriter& wr, RCString s) {
	Blob blob = Encoding::UTF8.GetBytes(s);
	uint16_t len = (uint16_t)blob.Size;
	(wr << len).BaseStream.WriteBuffer(blob.constData(), len);
}
开发者ID:Groestlcoin,项目名称:Groestlcoin-WPF,代码行数:5,代码来源:xpt-message.cpp


注:本文中的Blob::constData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。