예제 #1
0
array<System::Byte>^ zDBBinaryReader::ToBytes(int offset, int length)
{
	const unsigned char*		puData;			// Pointer into raw data
	array<System::Byte>^		rg;				// Managed byte array of data
	PinnedBytePtr				pinRg;			// Pinned pointer into rg[]

	CHECK_DISPOSED(m_disposed);
	if(offset < 0) throw gcnew ArgumentException();
	if(length < 0) throw gcnew ArgumentException();
	if((offset + length) > m_cb) throw gcnew ArgumentOutOfRangeException();

	// Special case: If the caller wants zero bytes, don't go pinning
	// pointers and copying nothing.  Just return what they want

	if(length == 0) return gcnew array<System::Byte>(0);

	rg = gcnew array<System::Byte>(length);		// Create return array
	pinRg = &rg[0];								// Pin and get a pointer

	// Only copy the amount of data that the caller is looking for

	puData = reinterpret_cast<const unsigned char*>(sqlite3_column_blob(m_pStatement->Handle, m_ordinal));
	memcpy_s(pinRg, length, puData + offset, length);
	return rg;
}
void StorageDirectoryEnumerator::Reset(void)
{
	CHECK_DISPOSED(m_disposed);
	
	m_enum->Reset();					// Reset the real enumerator
	m_spent = false;					// Enumerator is no longer spent
}
bool StorageDirectoryEnumerator::MoveNext(void)
{
	bool				result;			// Operational result

	CHECK_DISPOSED(m_disposed);
	
	result = m_enum->MoveNext();		// Move the real enumerator
	if(!result) m_spent = true;			// Set spent enumerator flag
	return result;						// Return result from MoveNext()
}
VirtualDirectory^ StorageDirectoryEnumerator::Current::get(void)
{
	StorageContainer^		container;			// Object to be returned
	StoragePath^			path;				// New StoragePath instance

	CHECK_DISPOSED(m_disposed);
	
	container = m_enum->Current;
	path = gcnew StoragePath(m_path, m_path->Full + "/" + container->Name);
	return gcnew StorageDirectory(path, container);
}
예제 #5
0
SByte zDBBinaryReader::ToSByte(int offset)
{
	const char*					pu;			// Pointer into the data

	CHECK_DISPOSED(m_disposed);
	if(offset < 0) throw gcnew ArgumentException();
	if(offset > (m_cb - 1)) throw gcnew ArgumentOutOfRangeException();

	pu = reinterpret_cast<const char*>(sqlite3_column_blob(m_pStatement->Handle, m_ordinal));
	return *(pu + offset);
}
예제 #6
0
VirtualFile^ StorageFileEnumerator::Current::get(void)
{
	StorageObject^			object;			// Object to be returned
	StoragePath^			path;			// New virtual file path

	CHECK_DISPOSED(m_disposed);
	
	object = m_enum->Current;
	path = gcnew StoragePath(m_path, m_path->Full + "/" + object->Name);
	return gcnew StorageFile(path, object);
}
Diagnostic^ LoadedDiagnosticCollection::default::get(int index)
{
	CHECK_DISPOSED(m_disposed);

	// Check for a cached instance of the Diagnostic first, this will also
	// validate that the index is within the boundaries of the collection
	Diagnostic^ cached = m_cache[index];
	if(!Object::ReferenceEquals(cached, nullptr)) return cached;

	// Create a new diagnostic and cache it to prevent multiple creations, there
	// is no translation unit associated with the loaded diagnostics to use here
	m_cache[index] = Diagnostic::Create(m_handle, TranslationUnitHandle::Null, clang_getDiagnosticInSet(DiagnosticSetHandle::Reference(m_handle), static_cast<unsigned int>(index)));
	return m_cache[index];
}
예제 #8
0
float zDBBinaryReader::ToSingle(int offset)
{
	int						cb = sizeof(float);		// Number of bytes to alloc/copy
	const unsigned char*	puData;					// Pointer into raw data
	array<System::Byte>^	rg;						// Managed byte array of data
	PinnedBytePtr			pinRg;					// Pinned pointer into rg[]

	CHECK_DISPOSED(m_disposed);
	if(offset < 0) throw gcnew ArgumentException();
	if(offset > (m_cb - cb)) throw gcnew ArgumentOutOfRangeException();

	rg = gcnew array<System::Byte>(cb);		// Allocate the local buffer
	pinRg = &rg[0];							// Pin it down for memcpy_s

	// Copy only the amount of data we specifically need from SQLite, and attempt
	// to convert it using a standard binary conversion mechanism

	puData = reinterpret_cast<const unsigned char*>(sqlite3_column_blob(m_pStatement->Handle, m_ordinal));
	memcpy_s(pinRg, cb, puData + offset, cb);
	return BitConverter::ToSingle(rg, 0);
}
예제 #9
0
array<__wchar_t>^ zDBBinaryReader::ToChars(int offset, int length)
{
	int							cb;				// Local size information
	const wchar_t*				pwchData;		// Pointer into raw data
	array<__wchar_t>^			rg;				// Managed char array of data
	PinnedCharPtr				pinRg;			// Pinned pointer into rg[]
	int							cch;			// Unicode character count

	CHECK_DISPOSED(m_disposed);
	if(offset < 0) throw gcnew ArgumentException();
	if(length < 0) throw gcnew ArgumentException();
	if((offset % sizeof(wchar_t)) != 0) throw gcnew ArgumentException();
	if((length % sizeof(wchar_t)) != 0) throw gcnew ArgumentException();

	// When accessing things as Unicode character data, ask SQLite for a
	// specific size that will properly adjusted as necessary

	cb = sqlite3_column_bytes16(m_pStatement->Handle, m_ordinal);
	if((offset + length) > cb) throw gcnew ArgumentOutOfRangeException();

	// Special case: If the caller wants zero bytes, don't go pinning
	// pointers and copying nothing.  Just return what they want

	if(length == 0) return gcnew array<__wchar_t>(0);

	cch = length / sizeof(wchar_t);				// Calculate character count
	rg = gcnew array<__wchar_t>(cch);			// Create return array
	pinRg = &rg[0];								// Pin and get a pointer

	// Only copy the amount of data that the caller is looking for from
	// the SQLite buffer into the managed Char array buffer

	pwchData = reinterpret_cast<const wchar_t*>(sqlite3_column_text16(m_pStatement->Handle, m_ordinal));
	wmemcpy_s(pinRg, cch, pwchData + (offset / sizeof(wchar_t)), cch);
	return rg;
}
예제 #10
0
zDBConnection^ zDBVirtualTable<_cursor>::Connection::get(void)
{
	CHECK_DISPOSED(m_disposed);
	return m_args->Connection;
}
예제 #11
0
ReadOnlyCollection<String^>^ zDBVirtualTable<_cursor>::Arguments::get(void)
{
	CHECK_DISPOSED(m_disposed);
	return m_args->Arguments;
}
예제 #12
0
String^ zDBVirtualTable<_cursor>::DatabaseName::get(void)
{
	CHECK_DISPOSED(m_disposed);
	return m_args->DatabaseName;
}
예제 #13
0
bool zDBBinaryReader::ToBoolean(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return ToByte(offset) != 0;				// Use ToByte() instead
}
예제 #14
0
array<System::Byte>^ zDBBinaryReader::ToBytes(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return ToBytes(offset, m_cb - offset);
}
예제 #15
0
array<__wchar_t>^ zDBBinaryReader::ToChars(void)
{
	CHECK_DISPOSED(m_disposed);
	return ToChars(0, m_cb);
}
예제 #16
0
Guid zDBBinaryReader::ToGuid(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return Guid(ToBytes(0, 16));
}
예제 #17
0
DateTime zDBBinaryReader::ToDateTime(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return DateTime(ToInt64(offset));		// Use ToInt64() instead
}
int LoadedDiagnosticCollection::Count::get(void)
{
	CHECK_DISPOSED(m_disposed);
	return m_cache->Length;
}
예제 #19
0
int zDBBinaryReader::Length::get(void)
{
	CHECK_DISPOSED(m_disposed);
	return m_cb;
}
예제 #20
0
String^ zDBBinaryReader::ToString(void)
{
	CHECK_DISPOSED(m_disposed);
	return String::Format(BINARY_DATA_STRING, m_cb);;
}
예제 #21
0
array<__wchar_t>^ zDBBinaryReader::ToChars(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return ToChars(offset, m_cb - offset);
}
예제 #22
0
TypeCode zDBBinaryReader::GetTypeCode(void)
{
	CHECK_DISPOSED(m_disposed);
	return TypeCode::Object;
}
예제 #23
0
array<System::Byte>^ zDBBinaryReader::ToBytes(void)
{
	CHECK_DISPOSED(m_disposed);
	return ToBytes(0, m_cb);
}