public virtual string CreateDirectoryStructure(string table, Stack <string> dirsToCreate, string pathId, SqlConnection conn) { while (dirsToCreate.Count > 0) { pathId = FileTableRepo.CreateDirectory(table, dirsToCreate.Pop(), pathId, conn); } return(pathId); }
public virtual SqlHierarchyId CreateDirectoryStructure(string table, Stack <string> dirsToCreate, SqlHierarchyId pathId, SqlConnection conn, bool pipeToOutput) { while (dirsToCreate.Count > 0) { var dir = dirsToCreate.Pop(); pathId = FileTableRepo.CreateDirectory(table, dir, pathId, conn, pipeToOutput); } return(pathId); }
public void BuildGetFilesQuery_RecursiveTrue_ExcludeDataTrue_ExcludeDirectoriesTrue_Test() { // Arrange var repo = new FileTableRepo(); var expected = "SELECT [stream_id], null as [file_stream],[name],[path_locator],[parent_path_locator],[file_type],[cached_file_size],[creation_time],[last_write_time],[last_access_time],[is_directory],[is_offline],[is_hidden],[is_readonly],[is_archive],[is_system],[is_temporary] FROM Table1 WHERE path_locator.IsDescendantOf(@dirId) = 1 AND is_directory = 0"; // Act var actual = repo.BuildGetFilesQuery("Table1", true, true, true); // Assert Assert.AreEqual(expected, actual); }
public string CreateFile(string table, string path, byte[] data, SqlConnection conn) { var file = Path.GetFileName(path); var dir = Path.GetDirectoryName(path); var pathId = DirectoryExists(table, dir, conn); if (string.IsNullOrWhiteSpace(pathId)) { pathId = CreateDirectory(table, dir, conn); } var hierarchyId = FileTableRepo.CreateFile(table, file, HierarchyBuilder.NewChildHierarchyId(pathId), data, conn); return(hierarchyId); }
public void IsTableRootTest() { // Arrange var server = @"\\server"; var serverFQDN = @"\\server.domain.tld"; var inst = "instdir"; var db = "dbdir"; var table = "tdir"; var tableRoot = Path.Combine(server, inst, db, table); var tableRootFqdn = Path.Combine(serverFQDN, inst, db, table); var repo = new FileTableRepo(); var testDir = TestContext.DataRow[0].ToString(); var expected = Convert.ToBoolean(TestContext.DataRow[1]); // Act var actual = repo.IsTableRoot(testDir, tableRoot, tableRootFqdn); // Assert Assert.AreEqual(expected, actual); }
public virtual string FileExists(string table, string path, SqlConnection conn) { return(FileTableRepo.FindPath(table, path, false, conn)); }
public virtual string DirectoryExists(string table, string path, SqlConnection conn) { return(FileTableRepo.FindPath(table, path, true, conn)); }
public int RenameFile(string table, SqlHierarchyId hierarchyid, string filename, SqlConnection conn) { return(FileTableRepo.RenameFile(table, hierarchyid, filename, conn)); }
public int RenameFile(string table, Guid stream_id, string filename, SqlConnection conn) { return(FileTableRepo.RenameFile(table, stream_id, filename, conn)); }
public int DeleteFile(string table, SqlHierarchyId hierarchyid, SqlConnection conn) { return(FileTableRepo.DeleteFile(table, hierarchyid, conn)); }
public int DeleteFile(string table, Guid stream_id, SqlConnection conn) { return(FileTableRepo.DeleteFile(table, stream_id, conn)); }
public IEnumerable <File> ListFiles(string table, string directory, SqlConnection conn, bool recursive, bool excludeData, bool excludeDirectories) { return(FileTableRepo.ListFiles(table, directory, conn, recursive, excludeData, excludeDirectories)); }