仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 707|回复: 8
打印 上一主题 下一主题

[学习教程] MSSQL网站制作之FORMS 6I OBJECT-BASED FEATURES (1)

[复制链接]
蒙在股里 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:30:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Mysql的存储引擎接口定义良好。有兴趣的开发者可以通过阅读文档编写自己的存储引擎。object


Forms6iObject-BasedFeatures

PeterKoletzke,Quovera

ObjectsinMirrorareCloserThanTheyAppear



Thiswarning―printedonautomobilemirrors―isparticularlyappropriatetothedevelopmentworld.Ifyouarenotthinkingaboutobjectstoday,yousurelyseethemloominginyourrear-viewmirror.Youruseofobjecttechnologyiscloserthanyouthink.Youwilluseitsoonastheindustrytrendtowardsobject-orientedanalysis,design,andprogrammingcontinues.

Thepopularityofobjectorientation(OO)isduetoitspotentialbenefits.Ifobjectorientationiscorrectlyimplementedinanyaspectofsystemdevelopment,thereisameasurablegainintheareasofstandardscreation,use,andenforcement.AnalysisanddesigniseasierbecausebusinessobjectsaremorecloselyrelatedtoprogrammingobjectsintheOOworld.Thedistinctionbetweenphysicalandlogicalmodelingisnolongerasstrongwithobjectorientationbecausetheuniverseisfilledwiththingsthataremorecloselyrelatedtoobjectsthantorelationaltablesandentities.Complex,easilymaintainable,andquicklyupgradeabledesignsareallpossiblebecauseoftheextensibilitythatOOprovides.

Onthedevelopmentside,thelong-toutedbutneverfullyrealizedbenefitsofreusebecomearealitywhenthedevelopmentteamemploysobject-orientedenvironmentsandtechniques.Commonlibrariesofgenericcodeandmasterobjectsthathavetrueinheritanceaffordcentralmaintenanceforbusiness-relatedprogrammingcomponents.Thisyieldsgreaterconsistencyamongapplicationsintheenterprise.Withproperknowledgeofthecontentsofthelibraries,developerscanbemuchmoreproductiveandcreateapplicationsfasterthanwithoutinheritanceandgenericcode.

ThebiggestdownsidetotheuseofOOisthelearningcurvethatcomeswiththeshiftinenvironments.Developersneedtothinkinanobjectorientedway―thatis,"Everythingisanobject."Theramificationsofthatsimplestatementarewidespreadandnotfullyrealizeduntilyouactuallydiveintocoding.Thiswayofthinkingisverydifferentfromthethinkingin"traditional"language.Youneedtoconsiderthatallnewcodeyouwritehasthepotentialtobeshared.Whilethisisnodifferentfromwritingsharedcodeinotherenvironments,suchasthosethatusethePL/SQLlanguage,whenobject-orientationisagoal,thecodemustbemorerigorouslytestedforallpossibleusesifitistobeatruemasterobject.Thesameconsiderationappliestonon-codeobjectssuchasvisualclasses.Inaddition,developersmustbefullyawareofthemasterobjectsclassesthattheenvironmentofferssotheydonotreinventanexistingobject.Developersmustalsoknowthefeatures,theinterfaces,andhowtobestusetheobjectsinthedevelopmentlibraries.Thereisnoeasyanswertothisotherthantrainingandclosecontactwithsomeoneontheteamwhohastherequiredknowledge.

Object-OrientationinForms?

AstechnologistswhouseForms(currentlycalled“OracleFormsDeveloper”),wewouldliketobeabletotakeadvantageofobjectorientation.However,FormsDeveloperwasnotarchitectedasatrueobject-orientedenvironment.Itdoes,however,containcertainaspectsofanobject-orientedlanguagesuchasSmalltalkorJava.YoucanbaseyouruseofFormsonaspectsofthetoolthatsupportthebenefitsofobjects.Therefore,theterm"object-based"accuratelydescribesastyleofdevelopmentthatyoucanfollowtoexploitobjectconceptsinForms.ThemainaspectsofFormsthatsupportobjectconceptsarethefollowing:

・CodeLibraries

・Subclasses

・ObjectGroups

・ObjectLibraries

・Templates

Eachofthesefeatureswillbediscussedinthispaper.Inadditiontothesefeatures,thearchitectureofFormsisbuiltuponthefollowingaspectsthathaveacounterpartintheobject-orientedworldinlanguagessuchasJava:

・PropertiesofFormsobjectsThesecorrespondtoobjectandmethodattributes.SettingthevalueofapropertyinFormsmodifiesanaspectofhowtheobjectworks.

・AricheventmodelFormshasalwaysprovidedevent-drivenexecution.EverythingthathappensinaFormsruntimesessionisasaresultofcodeattachedtoaneventtrigger.

・ObjecthierarchiesFormsobjectsareorganizedinahierarchicalwaythatsuggestsinheritance.Forexample,althoughthereislittleactualinheritancebetweenblocksanditems,thoseobjectsarearrangedasparentandchildbothinconceptandinthedevelopmentenvironment.

・ObjectinterfacesFormsobjectscanbemodifiedprogrammaticallythroughaninterfacetotheirfunctionality.Formsbuilt-inssuchasSET_ITEM_PROPERTYandSET_WINDOW_PROPERTYallowthecodetomanipulatetheobjectatruntime.

・PrivateimplementationsSincenotallpropertiesareexposedtotheprogrammaticinterface,thismodelcorrespondssomewhattotheideaofprivateorprotectedimplementationsinJava.Inaddition,PL/SQLsfacilitytohidethepackagebodyfromuserssuggeststhisobject-orientedfeature.

・OverridinginheritedpropertiesAkeyfeatureofobject-orientedlanguagesisthatachildobjectcansetpropertieslocallyandoverridethesettingsandbehavioroftheparentobject.Formssubclassingallowslocaloverridesalthoughitdoesnothavethecapabilityforthedevelopertopreventinheritedpropertiesfrombeingoverridden.

Inaway,thereisalowerlearningcurvewithobject-basedfeaturesofFormsDeveloperthanwithothertrueobject-orientedenvironments.Sincetheproductisnotfullyobject-oriented,thedeveloperwhowantstouseobjectfeaturesasmuchaspossiblecandoso,butcanalsoleveragecommonknowledgeofstandardFormsconcepts.Inaddition,Formsisa4GLdevelopmenttoolandis,forthemostpart,quickerandeasiertousethana3GLprogramminglanguage.

InsteadofexplainingwhatOOconceptsFormssupports,thispapertakesthepragmaticapproachofexplainingthetoolsfeaturesthatsupportobject-baseddevelopmentaslistedabove.Italsodiscusseshowyoucanapplythesefeaturestoatemplatethatenablesstandardsenforcement,codereuse,andobjectsharing.Thetemplateisattheheartofobject-basedprogramminginFormsanditsusewillprovidemanyofthesamebenefitsofatrueobject-orienteddevelopmentlanguage.WhilethediscussionfocusesonFormsRelease6(6.0and6i),allconceptsapplyequallytorelease2(Forms5.0).Thesamplecodeusedinthispaperisdownloadablefromtheauthorswebsitesmentionedattheendofthispaper.

CodeLibraries

ThewaythatcodelibrariesworkinFormsisnotmuchdifferentfromthewaythattheyworkinmostothertoolsthatprovidecodesharing.AForms.PLLlibraryisattachedtoaformintheObjectNavigatorandallcodeinthatlibraryisthenavailabletotheform.Otherformscanattachthesamelibraryandthisishowthecodereusemanifests.ToputthisinOOterms,thecodeis"inherited"intothelibrary.Ifthecodeinthelibrarychanges,thebehavioroftheformthathasattachedthelibrarywillalsochange.Whileyoucanoverrideinheritedbehaviorinanobject-orientedlanguage,overridesinPL/SQLarenotasstraightforward.

Sincethecodeinalibrarycanbeshared,itshouldnotbewrittenforjustoneformorapplication.Youhavetothinkintermsofmakingthecodegeneric.Therearetwomaincategoriesofgenericcode:utilitiesandobjectsupportandreusablecomponentmethods.Areusablecomponentisasetofobjectsthatyouhavepackagedtogetherusinganobjectgroup(alsodiscussedlaterinthispaper).

UtilitiesandObjectSupport

UtilitiescanprovideacommoninterfacetotheuserforcommonFormsfunctionssuchascommittingachange.Youcanorganizethepackagesinyourlibrarybyfeatureorreusablecomponent.Forexample,youcancreatealibrarypackagecalledF_ALERTpackage(theF_prefixdenotingaform-specificpackage)tosupportanalertsystem,andF_HELPtosupportahelpsystem.YoucanalsocreategenericcodetosupportandfacilitateusingFormsobjects.Therefore,youcancodeanF_ITEMpackagetosupporttheitemobjectinFormsandanF_BLOCKpackagetosupportthemanipulationofblocks.ApackagelikeF_ITEMwouldcontainprocedurestoaccomplishtaskssuchasdisablingitems,enablingitems,hidingordisplayingitems,andloadingpoplistitemsfromaquery.Theseproceduresmakethetaskseasiertocodeastheyrequireasinglelineofcodeinsteadofanumberoflinesofcode.Forexample,theproceduretoloadapoplistfromaqueryisabout60linesofcodeifitiswrittencorrectlywithsufficientexceptionhandling.Thecalltoagenericprocedureisonlyoneline.Thissavesthedevelopertimebecausethereisnoneedtocodeanddebugthiscommonoperation.

ThefollowingisanexcerptfromtheF_ITEMpackagespecificationinthesamplecodelibrarythatcontainstheprocedurejustmentioned.
mysql的prepare其实是本地PHP客户端模拟的,并没有根据你mysql的设置做字符集的调整。应该交与mysqlserver端做prepare,同时得调用mysql_set_character_set去操作,server才会按照字符集去做转义。
不帅 该用户已被删除
沙发
发表于 2015-1-19 13:27:51 | 只看该作者
SP4是一个累积性的ServicePack,包含自以前的ServicePack发布以来所有的修补程序(包括MS03-031安全公告)。
活着的死人 该用户已被删除
板凳
发表于 2015-1-24 13:13:13 | 只看该作者
原理很简单,对要求长时间计算某一时间点的报表生成和防用户操作错误很有帮助。但是比起Oracle10g的闪回技术还是细粒度不够。可惜!
若天明 该用户已被删除
地板
发表于 2015-2-1 15:31:35 | 只看该作者
然后最好有实践机会,能够把实践到的和实践结合起来,其实理论思考是个非常困扰和痛苦的事情
老尸 该用户已被删除
5#
发表于 2015-2-7 07:12:48 | 只看该作者
groupby子句可以将查询结果分组,并返回行的汇总信息Oracle按照groupby子句中指定的表达式的值分组查询结果。
因胸联盟 该用户已被删除
6#
发表于 2015-2-21 00:07:57 | 只看该作者
代替了原来VB式的错误判断。比Oracle高级不少。
蒙在股里 该用户已被删除
7#
 楼主| 发表于 2015-3-6 19:23:14 | 只看该作者
而SQLServer如果能像Oracle一样可以为登陆分配如:5%的cpu,10%的内存。就可以解决这个漏洞。
再现理想 该用户已被删除
8#
发表于 2015-3-13 06:11:46 | 只看该作者
可能有的朋友会抱怨集成的orderby,其实如果使用ranking函数,Orderby是少不了的。如果担心Orderby会影响效率,可以为orderby的字段建立聚集索引,查询计划会忽略orderby操作(因为本来就是排序的嘛)。
若相依 该用户已被删除
9#
发表于 2015-3-20 14:58:24 | 只看该作者
如果处理少量数据,比如几百条记录的数据,我不知道这两种情况哪个效率更高,如果处理大量数据呢?比如有表中有20万条记录.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-12-23 03:37

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表