Used to create the TMSFileStream object for working with FILESTREAM data.
Class
TCustomMSDataSet
Syntax
function GetFileStreamForField(const FieldName: string; const DesiredAccess: TMSSqlFilestreamDesiredAccess = daReadWrite; const OpenOptions: TMSSqlFilestreamOpenOptions = []; const AllocationSize: Int64 = 0): TMSFileStream;
Parameters
FieldName
Contains the existing field name of a VARBINARY(MAX) column.
DesiredAccess
Determines the mode that is used to access FILESTREAM data.
The following values can be used:
-
daRead
- data can be read from the file.
-
daWrite
- data can be written to the file.
-
daReadWrite
- data can be read and written from the file.
OpenOptions
Determines file attributes and flags. By default, the file is being opened or created with no special options. The following values can be used:
-
ooAsync
- The file is being opened or created for asynchronous I/O.
-
ooNoBuffering
- The system opens the file without system caching.
-
ooNoWriteThrough
- The system does not write through an intermediate cache. Writes go directly to disk.
-
ooSequentialScan
- The file is being accessed sequentially from beginning to end. The system can use this as a hint to optimize file caching. If an application moves the file pointer for random access, optimal caching may not occur.
-
ooRandomAccess
- The file is being accessed randomly. The system can use this as a hint to optimize file caching.
AllocationSize
Determines the initial allocation size of the data file in bytes. It is ignored in read mode. If this parameter is 0, the default file system behavior is used.
Return Value
The TMSFileStream object for working with FILESTREAM data.
Remarks
Creates the TMSFileStream object for working with FILESTREAM data of specified column. Transaction must be started before calling this method.
Note that this method requests server to obtain the Win32 compatible file handle for a FILESTREAM data.
To obtain the file handle, the following steps are performed:
-
getting the current transaction context of a session by calling the GET_FILESTREAM_TRANSACTION_CONTEXT Transact-SQL function. (
http://msdn.microsoft.com/en-us/library/bb934014.aspx
)
-
obtaining the Win32 file handle by executing the OpenSqlFilestream API. (
http://msdn.microsoft.com/en-us/library/bb933972.aspx
)
Note:
You can find more information about working with FILESTREAM data in MSDN at
http://msdn.microsoft.com/en-us/library/cc949109(v=sql.100).aspx
See Also