Re: Storing HTML code in a MS sql database
If storing all Web site content in a single column within a single database table is a specific requirement of the client then you should do what they want, especially if you are getting paid by the hour. I wouldn't question it unless this is a site that has a lot of content and gets a lot of traffic. -Mike Chabot On Sun, Jan 18, 2009 at 8:48 PM, Torrent Girl torrentg...@gmail.com wrote: Why would you not so it this way. This is actually the requirement from my client. it's a simple call to the database with each page request. Why would that be an issue? I am an experienced CF programmer but never built a completely database-driven site. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318169 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Storing HTML code in a MS sql database
Thanks I am creating a content management system so I don't want to strip the HTML. I am also creating a one page site and got the suggestion to add it as plain text from this tut: http://www.easycfm.com/coldfusion/forums/viewmessages.cfm?Forum=10Topic=12469 HTML is just text, so you store it in any of the text column types (varchar, nvarchar, text, ntext). I have a comment form in a site that lets people add HTML markup to the comment. I take this text, clean up the HTML, and put it into two columns, a comment_html column and a comment_plaintext column that has the HTML markup removed. Both columns are of type varchar(max). The reason to store one comment twice is that not everything supports HTML, such as SQL Server Reporting Services and third-party grid controls. Storing a plain text version also allows for a left(comment,100) type of function to show a preview of a lengthy comment and could help with a text search feature. Instead of stripping out the HTML tags for every data retrieval, I strip them out once during the insert, which increases the size of the database but speeds up data retrieval. The next most common method of storing HTML I believe is to store it as XML. SQL Server 2005 introduced powerful and fast XML support, although I would suspect this is overkill for what you are trying to accomplish. I hope that helps, Mike Chabot tGirl ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318143 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Storing HTML code in a MS sql database
tGirl, I realize that I have no idea what your experience level is or what the requirements of your project are, but I would caution that the idea of a single page site where all the HTML is stored in a database seems like a very bad idea on the surface for the majority of Web sites. I've done a lot of work with content management systems, including extensive work with Macromedia Spectra, and I can tell you that going down this path is filled with problems that few developers anticipate unless they have prior experience developing CMSs. The author of that article suggests that storing the HTML in a database somehow increases the speed and security of the site, but I would disagree with that assertion. The author doesn't back up those claims in any way. It is obvious from reading the article that the person who wrote it does not have significant experience coding so I would discourage anyone from following any of the advice in it. -Mike Chabot On Sun, Jan 18, 2009 at 10:05 AM, Torrent Girl torrentg...@gmail.com wrote: Thanks I am creating a content management system so I don't want to strip the HTML. I am also creating a one page site and got the suggestion to add it as plain text from this tut: http://www.easycfm.com/coldfusion/forums/viewmessages.cfm?Forum=10Topic=12469 HTML is just text, so you store it in any of the text column types (varchar, nvarchar, text, ntext). I have a comment form in a site that lets people add HTML markup to the comment. I take this text, clean up the HTML, and put it into two columns, a comment_html column and a comment_plaintext column that has the HTML markup removed. Both columns are of type varchar(max). The reason to store one comment twice is that not everything supports HTML, such as SQL Server Reporting Services and third-party grid controls. Storing a plain text version also allows for a left(comment,100) type of function to show a preview of a lengthy comment and could help with a text search feature. Instead of stripping out the HTML tags for every data retrieval, I strip them out once during the insert, which increases the size of the database but speeds up data retrieval. The next most common method of storing HTML I believe is to store it as XML. SQL Server 2005 introduced powerful and fast XML support, although I would suspect this is overkill for what you are trying to accomplish. I hope that helps, Mike Chabot tGirl ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318144 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Storing HTML code in a MS sql database
Why would you not so it this way. This is actually the requirement from my client. it's a simple call to the database with each page request. Why would that be an issue? I am an experienced CF programmer but never built a completely database-driven site. tGirl, I realize that I have no idea what your experience level is or what the requirements of your project are, but I would caution that the idea of a single page site where all the HTML is stored in a database seems like a very bad idea on the surface for the majority of Web sites. I've done a lot of work with content management systems, including extensive work with Macromedia Spectra, and I can tell you that going down this path is filled with problems that few developers anticipate unless they have prior experience developing CMSs. The author of that article suggests that storing the HTML in a database somehow increases the speed and security of the site, but I would disagree with that assertion. The author doesn't back up those claims in any way. It is obvious from reading the article that the person who wrote it does not have significant experience coding so I would discourage anyone from following any of the advice in it. -Mike Chabot ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318148 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Storing HTML code in a MS sql database
The next most common method of storing HTML I believe is to store it as XML. SQL Server 2005 introduced powerful and fast XML support, although I would suspect this is overkill for what you are trying to accomplish. And of course, this requires that you use XHTML and ensure that your XHTML is well-formed. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318149 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Storing HTML code in a MS sql database
Hello All Does anyone know the best practice for storing HTML in a MS sql database? I did sme research and found one reference that recommended saving it as plain text but I am not sure of what that means. Do I make the column that will hold the data a text column? Thnx tGirl ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318137 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Storing HTML code in a MS sql database
HTML is just text, so you store it in any of the text column types (varchar, nvarchar, text, ntext). I have a comment form in a site that lets people add HTML markup to the comment. I take this text, clean up the HTML, and put it into two columns, a comment_html column and a comment_plaintext column that has the HTML markup removed. Both columns are of type varchar(max). The reason to store one comment twice is that not everything supports HTML, such as SQL Server Reporting Services and third-party grid controls. Storing a plain text version also allows for a left(comment,100) type of function to show a preview of a lengthy comment and could help with a text search feature. Instead of stripping out the HTML tags for every data retrieval, I strip them out once during the insert, which increases the size of the database but speeds up data retrieval. The next most common method of storing HTML I believe is to store it as XML. SQL Server 2005 introduced powerful and fast XML support, although I would suspect this is overkill for what you are trying to accomplish. I hope that helps, Mike Chabot On Sat, Jan 17, 2009 at 11:21 PM, Torrent Girl torrentg...@gmail.com wrote: Hello All Does anyone know the best practice for storing HTML in a MS sql database? I did sme research and found one reference that recommended saving it as plain text but I am not sure of what that means. Do I make the column that will hold the data a text column? Thnx tGirl ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318139 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4