MSSQL网站制作之FORMS 6I OBJECT-BASED FEATURES (1)
Mysql的存储引擎接口定义良好。有兴趣的开发者可以通过阅读文档编写自己的存储引擎。objectForms6iObject-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才会按照字符集去做转义。 SP4是一个累积性的ServicePack,包含自以前的ServicePack发布以来所有的修补程序(包括MS03-031安全公告)。 原理很简单,对要求长时间计算某一时间点的报表生成和防用户操作错误很有帮助。但是比起Oracle10g的闪回技术还是细粒度不够。可惜! 然后最好有实践机会,能够把实践到的和实践结合起来,其实理论思考是个非常困扰和痛苦的事情 groupby子句可以将查询结果分组,并返回行的汇总信息Oracle按照groupby子句中指定的表达式的值分组查询结果。 代替了原来VB式的错误判断。比Oracle高级不少。 而SQLServer如果能像Oracle一样可以为登陆分配如:5%的cpu,10%的内存。就可以解决这个漏洞。 可能有的朋友会抱怨集成的orderby,其实如果使用ranking函数,Orderby是少不了的。如果担心Orderby会影响效率,可以为orderby的字段建立聚集索引,查询计划会忽略orderby操作(因为本来就是排序的嘛)。 如果处理少量数据,比如几百条记录的数据,我不知道这两种情况哪个效率更高,如果处理大量数据呢?比如有表中有20万条记录.
页:
[1]