DotNetNuke Wiki

Page History: Script Component

Compare Page Revisions



Older Revision - Back to Page History - Newer Revision


Page Revision: 2010/10/09 05:50 AM


The script component is used execute SQL scripts on the database. It is usually used by modules to install and/or upgrade the tables and stored procedures required for their data storage needs.

The Script Component inherits from the File Component and uses a similar sintax.

All SQL scripts must be named by using a format like "version.dataprovidertype", where:
  • version is the sequential version number of the script (this will be used to execute the scripts in the correct order), for example "00.00.01"
  • dataprovidertype identifies the dataprovider being used. By default DNN uses the SQL Server DataProvider identified by "SqlDataProvider" (for example: "00.00.01.SqlDataProvicer"). Other data providers might use other prefixes. The data provider definition can be found on the web.config file on the "data" section group.

Elements and attributes»

<component type="Script">
  &lt;scripts]
    <basePath />
    [script [type="Install | UnInstall"]]
      <path/>
      <name/>
      <version/>
    [/script]
  [/scripts]
</component>

  • type: identifies if the script will be used when installing or uninstalling the package. An uninstall script must be named explicitely "uninstall.*" otherwise will not be executed when uninstalling the package.
  • basePath: where the scripts will be saved after installation
  • path: the folder where the script will be copied (relative to basePath)
  • name: the name of the script file
  • version: sequential version of the script file, used to correctly execute the scripts in the right order

The Script component supports two special names for scripts that will be considered in a different way than usual scripts:
  • install.SqlDataProvider: if the package is being installed for the first time, this script will be executed before all other scripts
  • upgrade.SqlDataProvider: after all regular scripts have been executed, DNN will process this script if present. If there is an "upgrade" script on the package it will be executed ALWAYS as the final script

Sample»

<component type="Script">
  [scripts]
    <basePath>DesktopModules\MyModule</basePath>
    [script type="Install"]
      <path>providers\dataproviders\sqldataprovider</path>
      <name>03.01.00.sqldataprovider</name>
      <version>03.01.00</version>
    [/script]
    [script type="UnInstall"]
      <path>providers\dataproviders\sqldataprovider</path>
      <name>uninstall.sqldataprovider</name>
      <version>05.01.01</version>
    [/script]
  [/scripts]
</component>

References»


Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.