OCILIB (C and C++ Driver for Oracle)  4.6.3
ocilib::File Class Reference

Object identifying the SQL data type BFILE. More...

#include <ocilib.hpp>

Inherits ocilib::HandleHolder< OCI_File *>.

Public Member Functions

 File ()
 Create an empty null File instance.
 
 File (const Connection &connection)
 Parametrized constructor. More...
 
 File (const Connection &connection, const ostring &directory, const ostring &name)
 Parametrized constructor. More...
 
Raw Read (unsigned int size)
 Read a portion of a file. More...
 
bool Seek (SeekMode seekMode, big_uint offset)
 Move the current position within the file for read/write operations. More...
 
bool Exists () const
 Check if the given file exists on server. More...
 
big_uint GetOffset () const
 Returns the current R/W offset within the file.
 
big_uint GetLength () const
 Returns the number of bytes contained in the file.
 
Connection GetConnection () const
 Return the file parent connection.
 
void SetInfos (const ostring &directory, const ostring &name)
 Set the directory and file name of our file object. More...
 
ostring GetName () const
 Return the file name.
 
ostring GetDirectory () const
 Return the file directory.
 
void Open ()
 Open a file for reading on the server.
 
void Close ()
 Close the file on the server.
 
bool IsOpened () const
 Check if the specified file is currently opened on the server by our object.
 
File Clone () const
 Clone the current instance to a new one performing deep copy.
 
bool operator== (const File &other) const
 Indicates if the current file value is equal the given file value.
 
bool operator!= (const File &other) const
 Indicates if the current file value is not equal the given file value.
 

Detailed Description

Object identifying the SQL data type BFILE.

This class wraps the OCILIB object handle OCI_File and its related methods

Definition at line 4495 of file ocilib.hpp.

Constructor & Destructor Documentation

◆ File() [1/2]

ocilib::File::File ( const Connection connection)
inline

Parametrized constructor.

Parameters
connection- Parent connection
Note
the file object must not be accessed anymore once the parent connection object gets out of scope

Definition at line 3311 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_FileCreate(), and OCI_FileFree().

◆ File() [2/2]

ocilib::File::File ( const Connection connection,
const ostring directory,
const ostring name 
)
inline

Parametrized constructor.

Parameters
connection- Parent connection
directory- File directory
name- File name

this convenient constructor calls File::SetInfos()

Note
the file object must not be accessed anymore once the parent connection object gets out of scope

Definition at line 3316 of file ocilib_impl.hpp.

References ocilib::Check(), File(), OCI_FileCreate(), and OCI_FileFree().

Member Function Documentation

◆ Read()

Raw ocilib::File::Read ( unsigned int  size)
inline

Read a portion of a file.

Parameters
size- Maximum number of bytes to read
Returns
The content read from the file

Definition at line 3328 of file ocilib_impl.hpp.

References ocilib::Check(), ocilib::MakeRaw(), and OCI_FileRead().

◆ Seek()

bool ocilib::File::Seek ( SeekMode  seekMode,
big_uint  offset 
)
inline

Move the current position within the file for read/write operations.

Parameters
seekMode- Seek mode
offset- offset from current position
Note
Positions start at 0.
Returns
true on success otherwise false

Definition at line 3337 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_FileSeek().

◆ Exists()

bool ocilib::File::Exists ( ) const
inline

Check if the given file exists on server.

Note
For local FILEs object, SetInfos() must be called before calling Exists()

Definition at line 3371 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_FileExists().

◆ SetInfos()

void ocilib::File::SetInfos ( const ostring directory,
const ostring name 
)
inline

Set the directory and file name of our file object.

Parameters
directory- File directory
name- File name
Note
  • For local FILEs only
  • Files fetched from resultset can't be assigned a new directory and name

Definition at line 3376 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_FileSetName().