Gossamer Forum
Home : Products : DBMan : Installation :

Creating and attaching text files.

Quote Reply
Creating and attaching text files.
I'm creating an interactive story-creating site. The stories sometimes get quite large, say 10 pages of text, 20-30 k.

Q1. I get the feeling that it's a bad idea to have database fields that big in DBMan. Am I right?

Q2. If large records is a bad idea: Has anyone tried connecting seperate textfiles to records i DBMan? Users should be able to enter text i a textfield defined in an html.pl file. Then that text should be stored in a file. Finally, that file should be displayed among the other info in the record (that's the easy part, and I've also seen other entries in the BB that show how to do it). In other words, a little akin to using memo-files. Any ideas?

Torbjörn Hedberg
Sweden
Quote Reply
Re: Creating and attaching text files. In reply to
You could probably add something to the add_record and modify_record subroutines in db.cgi that would do this. It would take a bit of pondering to work it out, but I'm sure it could be done.

Just as a starting point, you would want to check to make sure there was something in the field:
if ( $in{'Story'} )

Then you would save the contents of $in{'Story'} to a text file, probably with the name
$db_key.txt
Be sure to use the entire path (not URL) to the directory where you want the .txt files saved.

I would probably make this into a subroutine, which I would call from the add_record and modify_record subroutines.

You wouldn't need to have a field for the story defined in your .cfg file, or even the name of the .txt file, if you used the $db_key as the name of the file.

I hope this is enough to get you started.



------------------
JPD
Quote Reply
Re: Creating and attaching text files. In reply to
Thanks a lot, your answer gave me a good clue as to how I should go about it.

I gather fromo your response that you think records as large as 20k are too large.

Torbjörn
Quote Reply
Re: Creating and attaching text files. In reply to
 
Quote:
I gather from your response that you think records as large as 20k are too large.

Probably. If you have very many records, your database will be pretty big pretty fast. I understand that textarea fields can only hold 32K, although I'm not sure where I heard it.

Good luck! I'd love to see it when it's done.


------------------
JPD
Quote Reply
Re: Creating and attaching text files. In reply to
 
Quote:
Probably. If you have very many records, your database will be pretty big pretty fast. I understand that textarea fields can only hold 32K, although I'm not sure where I heard it.

I've found this too. Using FileMan to edit html files that are over 30k ish, it won't let you edit the files properly. Frown

Cheers,

Alex