OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
ocilib::File Class Reference

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

#include <types.hpp>

Inherits ocilib::core::HandleHolder< OCI_File * >.

Public Member Functions

 File ()
 Create an empty null File instance.
 
 File (const Connection &connection)
 Parametrized constructor.
 
 File (const Connection &connection, const ostring &directory, const ostring &name)
 Parametrized constructor.
 
Raw Read (unsigned int size)
 Read a portion of a file.
 
bool Seek (SeekMode seekMode, big_uint offset)
 Move the current position within the file for read/write operations.
 
bool Exists () const
 Check if the given file exists on server.
 
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.
 
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 4338 of file types.hpp.

Constructor & Destructor Documentation

◆ File() [1/3]

ocilib::File::File ( )
inline

Create an empty null File instance.

Definition at line 31 of file File.hpp.

◆ File() [2/3]

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 35 of file File.hpp.

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

◆ File() [3/3]

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 44 of file File.hpp.

References ocilib::core::Check(), OCI_FileCreate(), and SetInfos().

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 60 of file File.hpp.

References ocilib::core::Check(), ocilib::core::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 69 of file File.hpp.

References ocilib::core::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 107 of file File.hpp.

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

◆ GetOffset()

big_uint ocilib::File::GetOffset ( ) const
inline

Returns the current R/W offset within the file.

Definition at line 88 of file File.hpp.

References ocilib::core::Check(), and OCI_FileGetOffset().

◆ GetLength()

big_uint ocilib::File::GetLength ( ) const
inline

Returns the number of bytes contained in the file.

Definition at line 93 of file File.hpp.

References ocilib::core::Check(), and OCI_FileGetSize().

◆ GetConnection()

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

Return the file parent connection.

Definition at line 98 of file File.hpp.

References ocilib::core::Check(), and OCI_FileGetConnection().

Referenced by Clone().

◆ 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 112 of file File.hpp.

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

Referenced by File().

◆ GetName()

ostring ocilib::File::GetName ( ) const
inline

Return the file name.

Definition at line 117 of file File.hpp.

References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_FileGetName().

◆ GetDirectory()

ostring ocilib::File::GetDirectory ( ) const
inline

Return the file directory.

Definition at line 122 of file File.hpp.

References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_FileGetDirectory().

◆ Open()

void ocilib::File::Open ( )
inline

Open a file for reading on the server.

Definition at line 127 of file File.hpp.

References ocilib::core::Check(), and OCI_FileOpen().

◆ Close()

void ocilib::File::Close ( )
inline

Close the file on the server.

Definition at line 137 of file File.hpp.

References ocilib::core::Check(), and OCI_FileClose().

◆ IsOpened()

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

Check if the specified file is currently opened on the server by our object.

Definition at line 132 of file File.hpp.

References ocilib::core::Check(), and OCI_FileIsOpen().

◆ Clone()

File ocilib::File::Clone ( ) const
inline

Clone the current instance to a new one performing deep copy.

Definition at line 74 of file File.hpp.

References ocilib::core::Check(), GetConnection(), and OCI_FileAssign().

◆ operator==()

bool ocilib::File::operator== ( const File other) const
inline

Indicates if the current file value is equal the given file value.

Definition at line 142 of file File.hpp.

◆ operator!=()

bool ocilib::File::operator!= ( const File other) const
inline

Indicates if the current file value is not equal the given file value.

Definition at line 147 of file File.hpp.