STOREDPROCEDURES:GOODORBAD(存储过程:好还是坏)

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

Author

DateOfSubmission

UserLevel

SaikalyanPrasadRao

07/06/2004

Intermediate

作者

提交日期

用户级别

SaikalyanPrasadRao

07/06/2004

中级

 

Iamsurethisissuehasbeentakenupanddiscussedinlotsofarticlesonthenet.Thisarticleaimstolookatbothsidesofthecoin.FirstwewilldwellontheadvantagesofStoredProcedures.



我确信这个问题在网上已经被讨论多次了。这篇文章是从两方面讨论。首先我们先详细论述一下存储过程的优点。

StoredProceduresprovideperformancebenefitssuchaslocaltodatabase,pre-compilingandcaching,aprogrammingframeworkwithuseofinput/outputparameters,reuseofproceduresandsecurityfeaturesuchasencryptionandprivilegelimitstousers.Apartfromthatitoffersmodularizationofcodeandchangesareimmediatelyaffectedunlikebusinesscomponentswhichneedtoberecompiledanddeployed.Notforgettingthatwiththeadventof.Net,deploymentissueshavebeenreducedquitealot.Butneverthelesschangesmadetoanycomponentdoneedtoberebuilt.Theotherbenefitsincludesavingonroundtripstotheclientappsandreductionofnetworktraffic.



存储过程提供诸如数据本地化、预处理和缓冲等特点,一个使用输入输出参数的架构,可重复使用存储过程和特性作为加密手段和权限设定来限制用户。其中一部分来自它的代码模块化,数据变更的时候不必像商业组件那样需要重新编译和部署。别忘了自.Net的出现后,部署已经被大大简化了,但对任何组件的更改仍需重新编译。另一个好处就是节省了与客户端应用程序的交互时间和加快网络响应。

ButontheflipsideStoredProceduresdocomewithitsownshareofproblems.DebuggingandmaintenancehasalwaysbeenaknownissueanditmakesiteventhemoredifficultwhendeveloperslikemegetusedtoVS.Netdebugger.Onasidenote,IdothinkMicrosofthasalwaysbuiltaverygooddebuggerinVS/VS.Net.



但是,存储过程的另一个副作用则产生于它自身。调试与维护已成为一个众所周知的话题,对于像我这样已习惯了VS.Net的调试器的开发者来说,这个可能更为困难。从某个角度来说,我认为微软VS/VS.Net调试器并不总是表现得很好。

Managingchangesinstoredproceduresandapplyingservicepackreleasescanbeabitteethingattimes.Apartfromthisthereareissuespertainingtomigration.Whatifyourapplicationwhichwasbuiltwithneedstobeportedtooranyotherdatabase?Itwould/isanightmareconvertingallthosestoredproceduresandT-SQLspecificcodetoacompatible/ANSISQLcodeforthatdatabase.



有时存储过程中的变动和应用服务包应用可能有点不便。除了这点之外,还有一个移植方面的问题。如果你的应用程序是用SQLSever编写的,但现在要移植到Oracle或其他你该怎么办?把所有的存储过程和T-SQL代码转向一个与目标数据库相兼容的SQL代码简直就是个噩梦。

Personally,IwouldliketogoinforstoredproceduresandleveragemostofthedatabasecapabilitiesifIknewmyprojectwasgoingtouseaspecificdatabaseandwouldn’tchange.Iamsuremanymustbethinkingonthesamelines.AfteralloneofthecoolfeaturesthatIlikedaboutSQLServerwasitssupportfor.YoushouldtrydoingbulkupdatesthroughXML,workslikeacharmandthattoowithlessamountofcode.Infactin.Net,datasetshavethecapabilitytooutputoutXMLrepresentationofdatawhichsavesyoutheeffortofwritingcodetoformulatetheXML.PumpinginofBusinessLogicinStoredProcedureshavebeendoneandmakesalotofsenseforsmallprojects.Butifyouwanttoscaleupyourapplicationitposesaproblemsinceyourdatabaseandbusinesslogicgettiedtoyourdatabasetier.Iamsureforsmallprojectsitwouldn’tmattermuchbutforalargescaleenterpriselevelsolutionthiswouldatsomepointintimeposeahugeproblem.共3页  第1页  
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
个人分类: 数据库
想对作者说点什么? 我来说一句

OCR 图片识别.rar

2013年02月16日 1.5MB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭