Third param is unused.
| 236 | |
| 237 | // Third param is unused. |
| 238 | ExternalFile* EXT_file(jrd_rel* relation, const TEXT* file_name) //, bid* description) |
| 239 | { |
| 240 | /************************************** |
| 241 | * |
| 242 | * E X T _ f i l e |
| 243 | * |
| 244 | ************************************** |
| 245 | * |
| 246 | * Functional description |
| 247 | * Create a file block for external file access. |
| 248 | * |
| 249 | **************************************/ |
| 250 | Database* dbb = GET_DBB(); |
| 251 | CHECK_DBB(dbb); |
| 252 | |
| 253 | // if we already have a external file associated with this relation just |
| 254 | // return the file structure |
| 255 | if (relation->rel_file) { |
| 256 | EXT_fini(relation, false); |
| 257 | } |
| 258 | |
| 259 | #ifdef WIN_NT |
| 260 | // Default number of file handles stdio.h on Windows is 512, use this |
| 261 | // call to increase and set to the maximum |
| 262 | _setmaxstdio(2048); |
| 263 | #endif |
| 264 | |
| 265 | // If file_name is relative expand it in ExternalFilesPath. |
| 266 | PathName newName, name(file_name); |
| 267 | if (PathUtils::isRelative(name)) |
| 268 | { |
| 269 | ExternalFileDirectoryList::create(dbb); |
| 270 | if (!(dbb->dbb_external_file_directory_list->expandFileName(newName, name))) |
| 271 | { |
| 272 | if (!dbb->dbb_external_file_directory_list->defaultName(newName, name)) |
| 273 | { |
| 274 | ISC_expand_filename(newName, false); |
| 275 | } |
| 276 | } |
| 277 | file_name = newName.c_str(); |
| 278 | name = newName; |
| 279 | } |
| 280 | |
| 281 | // Create missing path components |
| 282 | ObjectsArray<PathName> paths; |
| 283 | |
| 284 | for (;;) |
| 285 | { |
| 286 | PathName path, file; |
| 287 | PathUtils::splitLastComponent(path, file, name); |
| 288 | if (path.isEmpty()) |
| 289 | break; |
| 290 | |
| 291 | int rc = PathUtils::makeDir(path.c_str()); |
| 292 | if (rc == 0 || rc == EEXIST) |
| 293 | break; |
| 294 | paths.push(path); |
| 295 | name = path; |
nothing calls this directly
no test coverage detected