MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ext_fopen

Function ext_fopen

src/jrd/ext.cpp:126–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124 static const char* const FOPEN_READ_ONLY = "rb";
125
126 FILE* ext_fopen(Database* dbb, ExternalFile* ext_file)
127 {
128 const char* file_name = ext_file->ext_filename;
129
130 ExternalFileDirectoryList::create(dbb);
131 if (!dbb->dbb_external_file_directory_list->isPathInList(file_name))
132 {
133 ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("external file") <<
134 Arg::Str(file_name));
135 }
136
137 // If the database is updateable, then try opening the external files in
138 // RW mode. If the DB is ReadOnly, then open the external files only in
139 // ReadOnly mode, thus being consistent.
140 if (!dbb->readOnly())
141 ext_file->ext_ifi = os_utils::fopen(file_name, FOPEN_TYPE);
142
143 if (!ext_file->ext_ifi)
144 {
145 // could not open the file as read write attempt as read only
146 if (!(ext_file->ext_ifi = os_utils::fopen(file_name, FOPEN_READ_ONLY)))
147 {
148 ERR_post(Arg::Gds(isc_io_error) << Arg::Str("fopen") << Arg::Str(file_name) <<
149 Arg::Gds(isc_io_open_err) << SYS_ERR(errno));
150 }
151 else {
152 ext_file->ext_flags |= EXT_readonly;
153 }
154 }
155
156 return ext_file->ext_ifi;
157 }
158} // namespace
159
160

Callers 3

EXT_cardinalityFunction · 0.85
EXT_openFunction · 0.85
EXT_storeFunction · 0.85

Calls 7

createFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
isPathInListMethod · 0.80
readOnlyMethod · 0.80
ERR_postFunction · 0.70
fopenFunction · 0.50

Tested by

no test coverage detected