I'm developing an application in which files could be stored in the SQL-database tables and that raised the question if the user could get feedback when he transfers a huge file (>20mb) over e.g. a 2048/512 kbit line to a record in the table.
Is this possible in any way? Could chunks be transfered to the SQL-server so it could be shown on a percentagebar or something like that?
I don't know if this approach:
Table.FieldByName('Content').AsString:=FileContent;
or creating a SQL-statement with the MSSQL-component is a way.
Thanks in advance,
Lasse Laegteskov
Very large posts
-
- Posts: 15
- Joined: Tue 21 Aug 2007 22:14
I wasn't sure if this was something that should be done by SDAC (if possible) or by some other way. I think I found a solution to the problem:
I could create a large dummy value and insert it into the field like in this code I found on the net:
where 10000 is the filesize and then use the .WRITE operation in UPDATE-queries:
to write chunks into the field.
It's all in theory right now - I haven't tested it yet.
Thank you for the answer (and I guess the MySQL answer is for another forum?)
I could create a large dummy value and insert it into the field like in this code I found on the net:
Code: Select all
set nocount on
create table demo (ID int identity, LargeString varchar(max))
insert into demo (LargeString) values ( 'abc' + replicate(cast('d' as varchar(max)), 10000) + 'efg')
select ID, len(LargeString) Length from demo
drop table demo
Code: Select all
.WRITE ( expression, @Offset , @Length )
It's all in theory right now - I haven't tested it yet.
Thank you for the answer (and I guess the MySQL answer is for another forum?)
I checked your solution with Management Studio, and it works fine. I modified your example in this way:
Note, this approach may decrease performace of your application.
Code: Select all
SET NOCOUNT ON
CREATE TABLE demo (ID INT IDENTITY, LargeString VARCHAR(MAX))
INSERT INTO demo (LargeString) VALUES ( 'abc' + REPLICATE(CAST('d' as VARCHAR(MAX)), 10) + 'efg')
SELECT LargeString, ID, len(LargeString) Length FROM demo
UPDATE demo set LargeString .WRITE('1234567890', 16 , 10)
SELECT LargeString, ID, len(LargeString) Length FROM demo
UPDATE demo SET LargeString .WRITE('1234567890', 26 , 10)
SELECT LargeString, ID, len(LargeString) Length FROM demo
DROP TABLE demo