If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Inserting a File into a table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-19-10, 10:44
bolivartech bolivartech is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
Question Inserting a File into a table

I am fairly new to database design so correct me if the entire way I am wanting to do this is flawed.
I am working on a very specific cms for meeting managment. The main table consists looks like this:


Code:
CREATE TABLE `meetings` (
`ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the meeting',
`date` date NOT NULL COMMENT 'The date of the meeting',
`agenda` text NOT NULL COMMENT 'The meeting agenda',
PRIMARY KEY (`ID`)
);
I am also needing to upload minutes for each meeting but I cannot figure out which way would be best.

Code:
CREATE TABLE `meetings` (
`ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the meeting',
`date` date NOT NULL COMMENT 'The date of the meeting',
`agenda` text NOT NULL COMMENT 'The meeting agenda',
`open_minutes` MEDIUMBLOB NULL COMMENT 'The open meeting minutes'
PRIMARY KEY (`ID`)
);
or use the first table and have a second table

Code:
CREATE TABLE `open_minutes` (
`ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID',
`date` date NOT NULL COMMENT 'The date of the meeting',
`open_minutes` MEDIUMBLOB NULL COMMENT 'The open meeting minutes',
PRIMARY KEY (`ID`)
FOREIGN KEY (`date`) REFERENCE meetings(date)
);
Reply With Quote
  #2 (permalink)  
Old 02-19-10, 11:03
bolivartech bolivartech is offline
Registered User
 
Join Date: Feb 2010
Posts: 2
I've been doing some more research and I'm not sure if this is at all what I want to do now. Is it safer/faster/better to upload the file to the server and just store the location in the database?
In the end I am wanting to have certain files be protected from users that are not authenticated and that is more important than any other requirement.
Thanks!
Reply With Quote
  #3 (permalink)  
Old 02-19-10, 11:47
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
Do you need to search the minutes themselves? If not then store them in your protected data directory and only the path to them in the database itself.

you can use a VIEW to show off all non-secure documents for those that should see them and still have full access for those users who need to see all documents. You might want a column to indicate secure/non-secure items and base the VIEW on that column.
Reply With Quote
Reply

Tags
foreign key, pdf, php, sql, upload

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On