Avatar of davidcahan
davidcahan
Flag for United States of America asked on

FILESTREAM and Converted Video Files

My companies application requires a very strong tie between regular/traditional database data and files.  A file is useless without it's data and data is useless without the file.  They are tightly bound to each other.  So I'm thinking about using FileStream datatype.  

I've managed to answer most of my questions regarding how it would work, how to download files to the client machines that need them, etc., but I'm unable to determine one thing.

Often times users will be uploading files that need to be converted first before going into the DB.  The file is of course attached to traditional data, like the name the user gives it, a description, cloud tags attached to it, etc, so I want everything in a transaction that I can rollback if something goes wrong.  

So how the heck would I upload a file, then convert that file to say a swf and still insert it all into the DB?  Would I upload and insert first and then have a second process which selects the data out, converts it to swf and updates the record?

Thanks
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
DBAduck - Ben Miller

8/22/2022 - Mon
Aaron Shilo

hi

i would stage the process.

this means uplload the file to a stage area process(convert) and only then load it into the database.

this will give you the option of cancelling , error handling, without creating a problem in the prod env.
ASKER CERTIFIED SOLUTION
DBAduck - Ben Miller

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
davidcahan

ASKER
If you use Win32 API, how do you:
a)  update the row in the DB to flip the flag to "IsConverted = True"  and
b) Win32 API still needs to know the pointer to the file and that has to happen through the DB, correct?

Also

If a file takes 30 seconds to upload and I'm using Transactions am I locking the entire table during that process or does SQL take care of that part and only lock once the stream is up to the server?
SOLUTION
DBAduck - Ben Miller

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck