23 #include "ocilibcpp/types.hpp" 34 template<
class T,
int U>
39 template<
class T,
int U>
45 template<
class T,
int U>
48 Acquire(pLob,
nullptr,
nullptr, parent);
56 unsigned int charCount = length;
57 unsigned int byteCount = 0;
61 length = byteCount /
sizeof(otext);
64 return core::MakeString(static_cast<const otext *>(buffer), static_cast<int>(length));
72 unsigned int charCount = length;
73 unsigned int byteCount = 0;
77 length = byteCount /
sizeof(otext);
80 return core::MakeString(static_cast<const otext *>(buffer), static_cast<int>(length));
94 template<
class T,
int U>
102 unsigned int res = 0;
103 unsigned int charCount = 0;
104 unsigned int byteCount =
static_cast<unsigned int>(content.size() *
sizeof(
typename T::value_type));
105 const AnyPointer buffer =
static_cast<AnyPointer>(
const_cast<typename T::value_type *
>(&content[0]));
109 res = U == LobBinary ? byteCount : charCount;
115 template<
class T,
int U>
121 template<
class T,
int U>
129 const AnyPointer data =
static_cast<AnyPointer>(
const_cast<typename T::value_type*
>(&content[0]));
134 template<
class T,
int U>
140 template<
class T,
int U>
143 Lob result(GetConnection());
150 template<
class T,
int U>
156 template<
class T,
int U>
162 template<
class T,
int U>
168 template<
class T,
int U>
174 template<
class T,
int U>
180 template<
class T,
int U>
186 template<
class T,
int U>
192 template<
class T,
int U>
198 template<
class T,
int U>
204 template<
class T,
int U>
210 template<
class T,
int U>
216 template<
class T,
int U>
222 template<
class T,
int U>
228 template<
class T,
int U>
234 template<
class T,
int U>
240 template<
class T,
int U>
246 template<
class T,
int U>
253 template<
class T,
int U>
256 return Equals(other);
259 template<
class T,
int U>
262 return !(*
this == other);
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobGetChunkSize(OCI_Lob *lob)
Returns the chunk size of a LOB.
Internal usage. Interface for handling ownership and relationship of a C API handle.
bool IsRemote() const
Check if the given lob is a remote lob.
Connection GetConnection() const
Return the lob parent connection.
Lob & operator+=(const Lob &other)
Appending the given lob content to the current lob content.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobIsEqual(OCI_Lob *lob, OCI_Lob *lob2)
Compare two lob handles for equality.
Raw MakeRaw(AnyPointer result, unsigned int size)
Internal usage. Constructs a C++ Raw object from the given OCILIB raw buffer.
bool IsTemporary() const
Check if the given lob is a temporary lob.
big_uint GetChunkSize() const
Returns the current lob chunk size.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobGetType(OCI_Lob *lob)
Return the type of the given Lob object.
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.
A connection or session with a specific database.
Lob()
Create an empty null Lob instance.
core::Enum< LobTypeValues > LobType
Type of Lob.
T Read(unsigned int length)
Read a portion of a lob.
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
static T Check(T result)
Internal usage. Checks if the last OCILIB function call has raised an error. If so, it raises a C++ exception using the retrieved error handle.
void Close()
Close explicitly a Lob.
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_LobIsRemote(OCI_Lob *lob)
Indicates if the given lob belongs to a local or remote database table.
bool operator==(const Lob &other) const
Indicates if the current lob value is equal to the given lob value.
void Flush()
Flush the lob content to the server (if applicable)
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_LobSeek(OCI_Lob *lob, big_uint offset, unsigned int mode)
Perform a seek operation on the OCI_lob content buffer.
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_LobCreate(OCI_Connection *con, unsigned int type)
Create a local temporary Lob instance.
ostring MakeString(const otext *result, int size=-1)
Internal usage. Constructs a C++ string object from the given OCILIB string pointer.
unsigned int Write(const T &content)
Write the given content at the current position within the lob.
void * AnyPointer
Alias for the generic void pointer.
Template Enumeration template class providing some type safety to some extends for manipulating enume...
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.
Lob Clone() const
Clone the current instance to a new one performing deep copy.
Internal usage. Provide a buffer class with RAII capabilities.
LobType GetType() const
return the type of lob
OCI_SYM_PUBLIC big_uint OCI_API OCI_LobGetLength(OCI_Lob *lob)
Return the actual length 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 big_uint OCI_API OCI_LobGetMaxSize(OCI_Lob *lob)
Return the maximum size that the lob can contain.
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.
big_uint GetLength() const
Returns the number of characters or bytes contained in the lob.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobEnableBuffering(OCI_Lob *lob, boolean value)
Enable / disable buffering mode on the given lob handle.
static unsigned int GetCharMaxSize()
Return maximum size for a character.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobAssign(OCI_Lob *lob, OCI_Lob *lob_src)
Assign a lob to another one.
big_uint GetOffset() const
Returns the current R/W offset within the lob.
std::vector< unsigned char > Raw
C++ counterpart of SQL RAW data type.
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_LobGetConnection(OCI_Lob *lob)
Retrieve connection handle from the lob handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobFree(OCI_Lob *lob)
Free a local temporary lob.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobOpen(OCI_Lob *lob, unsigned int mode)
Open explicitly 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.
Object identifying the SQL data type LOB (CLOB, NCLOB and BLOB)
unsigned int Append(const T &content)
Append the given content to the lob.
void Open(OpenMode mode)
Open explicitly a Lob.
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.
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 ) ...
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.
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.
void Truncate(big_uint length)
Truncate the lob to a shorter length.
bool Seek(SeekMode seekMode, big_uint offset)
Move the current position within the lob for read/write operations.
void EnableBuffering(bool value)
Enable / disable buffering mode on the given lob object.
struct OCI_Lob OCI_Lob
Oracle Internal Large objects:
OCI_SYM_PUBLIC boolean OCI_API OCI_LobClose(OCI_Lob *lob)
Close explicitly a Lob.
big_uint Erase(big_uint offset, big_uint length)
Erase a portion of the lob at a given position.
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_LobFlush(OCI_Lob *lob)
Flush Lob content to the server.