23 #include "ocilibcpp/types.hpp"
34 template<
class T,
int U>
39 template<
class T,
int U>
45 connection.GetHandle()
49 template<
class T,
int U>
52 AcquireTransient(pLob, parent);
60 unsigned int charCount = length;
61 unsigned int byteCount = 0;
65 length = byteCount /
sizeof(otext);
68 return core::MakeString(
static_cast<const otext *
>(buffer),
static_cast<int>(length));
76 unsigned int charCount = length;
77 unsigned int byteCount = 0;
81 length = byteCount /
sizeof(otext);
84 return core::MakeString(
static_cast<const otext *
>(buffer),
static_cast<int>(length));
91 core::ManagedBuffer<unsigned char> buffer(length + 1);
98 template<
class T,
int U>
106 unsigned int res = 0;
107 unsigned int charCount = 0;
108 unsigned int byteCount =
static_cast<unsigned int>(content.size() *
sizeof(
typename T::value_type));
109 const AnyPointer buffer =
static_cast<AnyPointer>(
const_cast<typename T::value_type *
>(&content[0]));
113 res = U == LobBinary ? byteCount : charCount;
119 template<
class T,
int U>
125 template<
class T,
int U>
133 const AnyPointer data =
static_cast<AnyPointer>(
const_cast<typename T::value_type*
>(&content[0]));
138 template<
class T,
int U>
144 template<
class T,
int U>
147 Lob result(GetConnection());
154 template<
class T,
int U>
160 template<
class T,
int U>
166 template<
class T,
int U>
172 template<
class T,
int U>
178 template<
class T,
int U>
184 template<
class T,
int U>
190 template<
class T,
int U>
196 Environment::GetEnvironmentHandle()
200 template<
class T,
int U>
206 template<
class T,
int U>
212 template<
class T,
int U>
218 template<
class T,
int U>
224 template<
class T,
int U>
230 template<
class T,
int U>
236 template<
class T,
int U>
242 template<
class T,
int U>
248 template<
class T,
int U>
254 template<
class T,
int U>
261 template<
class T,
int U>
264 return Equals(other);
267 template<
class T,
int U>
270 return !(*
this == other);
A connection or session with a specific database.
static unsigned int GetCharMaxSize()
Return maximum size for a character.
Object identifying the SQL data type LOB (CLOB, NCLOB and BLOB)
void Truncate(big_uint length)
Truncate the lob to a shorter length.
unsigned int Write(const T &content)
Write the given content at the current position within the lob.
void Copy(Lob &dest, big_uint offset, big_uint offsetDest, big_uint length) const
Copy the given portion of the lob content to another one.
Lob()
Create an empty null Lob instance.
bool IsTemporary() const
Check if the given lob is a temporary lob.
big_uint GetOffset() const
Returns the current R/W offset within the lob.
void Flush()
Flush the lob content to the server (if applicable)
big_uint GetLength() const
Returns the number of characters or bytes contained in the lob.
bool operator!=(const Lob &other) const
Indicates if the current lob value is not equal the given lob value.
big_uint GetMaxSize() const
Returns the lob maximum possible size.
void Close()
Close explicitly a Lob.
bool IsRemote() const
Check if the given lob is a remote lob.
void EnableBuffering(bool value)
Enable / disable buffering mode on the given lob object.
LobType GetType() const
return the type of lob
bool operator==(const Lob &other) const
Indicates if the current lob value is equal to the given lob value.
Connection GetConnection() const
Return the lob parent connection.
unsigned int Append(const T &content)
Append the given content to the lob.
big_uint GetChunkSize() const
Returns the current lob chunk size.
T Read(unsigned int length)
Read a portion of a lob.
void Open(OpenMode mode)
Open explicitly a Lob.
big_uint Erase(big_uint offset, big_uint length)
Erase a portion of the lob at a given position.
bool Seek(SeekMode seekMode, big_uint offset)
Move the current position within the lob for read/write operations.
Lob & operator+=(const Lob &other)
Appending the given lob content to the current lob content.
Lob Clone() const
Clone the current instance to a new one performing deep copy.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
Internal usage. Interface for handling ownership and relationship of a C API handle.
struct OCI_Lob OCI_Lob
Oracle Internal Large objects:
OCI_SYM_PUBLIC boolean OCI_API OCI_LobTruncate(OCI_Lob *lob, big_uint size)
Truncate the given lob to a shorter length.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobEnableBuffering(OCI_Lob *lob, boolean value)
Enable / disable buffering mode on the given lob handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobOpen(OCI_Lob *lob, unsigned int mode)
Open explicitly a Lob.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobGetChunkSize(OCI_Lob *lob)
Returns the chunk size of a LOB.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobIsEqual(OCI_Lob *lob, OCI_Lob *lob2)
Compare two lob handles for equality.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobClose(OCI_Lob *lob)
Close explicitly a Lob.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobIsRemote(OCI_Lob *lob)
Indicates if the given lob belongs to a local or remote database table.
OCI_SYM_PUBLIC big_uint OCI_API OCI_LobGetMaxSize(OCI_Lob *lob)
Return the maximum size that the lob can contain.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobRead(OCI_Lob *lob, void *buffer, unsigned int len)
[OBSOLETE] Read a portion of a lob into the given buffer
OCI_SYM_PUBLIC big_uint OCI_API OCI_LobGetOffset(OCI_Lob *lob)
Return the current position in the Lob content buffer.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobWrite2(OCI_Lob *lob, void *buffer, unsigned int *char_count, unsigned int *byte_count)
Write a buffer into a LOB.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobAppendLob(OCI_Lob *lob, OCI_Lob *lob_src)
Append a source LOB at the end of a destination LOB.
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_LobCreate(OCI_Connection *con, unsigned int type)
Create a local temporary Lob instance.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobCopy(OCI_Lob *lob, OCI_Lob *lob_src, big_uint offset_dst, big_uint offset_src, big_uint count)
Copy a portion of a source LOB into a destination LOB.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobRead2(OCI_Lob *lob, void *buffer, unsigned int *char_count, unsigned int *byte_count)
Read a portion of a lob into the given buffer.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobFlush(OCI_Lob *lob)
Flush Lob content to the server.
OCI_SYM_PUBLIC big_uint OCI_API OCI_LobGetLength(OCI_Lob *lob)
Return the actual length of a lob.
OCI_SYM_PUBLIC big_uint OCI_API OCI_LobErase(OCI_Lob *lob, big_uint offset, big_uint len)
Erase a portion of the lob at a given position.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobSeek(OCI_Lob *lob, big_uint offset, unsigned int mode)
Perform a seek operation on the OCI_lob content buffer.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobAssign(OCI_Lob *lob, OCI_Lob *lob_src)
Assign a lob to another one.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobAppend(OCI_Lob *lob, void *buffer, unsigned int len)
Append a buffer at the end of a LOB.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobIsTemporary(OCI_Lob *lob)
Check if the given lob is a temporary lob.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobGetType(OCI_Lob *lob)
Return the type of the given Lob object.
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_LobGetConnection(OCI_Lob *lob)
Retrieve connection handle from the lob handle.
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so,...
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
Raw MakeRaw(AnyPointer result, unsigned int size)
Internal usage. Constructs a C++ Raw object from the given OCILIB raw buffer.
std::basic_string< otext, std::char_traits< otext >, std::allocator< otext > > ostring
string class wrapping the OCILIB otext * type and OTEXT() macros ( see Character sets )
core::Enum< LobTypeValues > LobType
Type of Lob.
std::vector< unsigned char > Raw
C++ counterpart of SQL RAW data type.
void * AnyPointer
Alias for the generic void pointer.