This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
admin:basics:environments:deploy [2011/01/13 21:18] els created |
admin:basics:environments:deploy [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOTOC~~ | ||
+ | |||
{{page>:top_add&nofooter&noeditbtn}} | {{page>:top_add&nofooter&noeditbtn}} | ||
- | ====== Administration: Omnidex Basics ====== | + | ====== Administration: Omnidex Fundamentals ====== |
===== Omnidex Environments ===== | ===== Omnidex Environments ===== | ||
Line 18: | Line 20: | ||
Omnidex Environments usually include file locations, such as the Index Directory and the Physical location of data files. To allow Omnidex Environments to be as portable as possible, they should contain relative paths rather than absolute paths, or should reference environment variables. | Omnidex Environments usually include file locations, such as the Index Directory and the Physical location of data files. To allow Omnidex Environments to be as portable as possible, they should contain relative paths rather than absolute paths, or should reference environment variables. | ||
+ | |||
+ | === Using Relative Paths === | ||
+ | |||
+ | The following example uses relative paths, meaning that all file locations will be relative to the "current working directory". This allows the environment to be easily copied to different locations. | ||
+ | |||
+ | <code> | ||
+ | > create environment | ||
+ | >> in "simple.xml" | ||
+ | >> with delete; | ||
+ | Environment created in simple.xml | ||
+ | > | ||
+ | > | ||
+ | > create database "SIMPLE" | ||
+ | >> type FILE | ||
+ | >> index_directory "idx" | ||
+ | >> in "simple.xml"; | ||
+ | Database SIMPLE created in simple.xml | ||
+ | > | ||
+ | > | ||
+ | > create table "HOUSEHOLDS" | ||
+ | >> physical "dat/households.dat" | ||
+ | >> ( | ||
+ | >> "HOUSEHOLD" CHARACTER(12) omnidex, | ||
+ | >> "ADDRESS" CHARACTER(50) quicktext, | ||
+ | >> "CITY" CHARACTER(28) quicktext, | ||
+ | >> "STATE" CHARACTER(2) omnidex, | ||
+ | >> "ZIP" CHARACTER(5) omnidex, | ||
+ | >> "COUNTRY" CHARACTER(2) omnidex, | ||
+ | >> constraint HOUSEHOLDS_HOUSEHOLD_PK primary ("HOUSEHOLD") | ||
+ | >> ) | ||
+ | >> in "simple.xml"; | ||
+ | Table HOUSEHOLDS created in simple.xml | ||
+ | > | ||
+ | > | ||
+ | > create table "INDIVIDUALS" | ||
+ | >> physical "dat/individuals.dat" | ||
+ | >> ( | ||
+ | >> "INDIVIDUAL" CHARACTER(12) omnidex, | ||
+ | >> "HOUSEHOLD" CHARACTER(12) omnidex, | ||
+ | >> "NAME" CHARACTER(50) quicktext, | ||
+ | >> "GENDER" CHARACTER(1) omnidex bitmap, | ||
+ | >> "BIRTHDATE" ANSI DATE omnidex, | ||
+ | >> "PHONE" CHARACTER(14) omnidex, | ||
+ | >> "EMAIL" CHARACTER(60) quicktext, | ||
+ | >> constraint INDIVIDUALS_INDIVIDUAL_PK primary ("INDIVIDUAL"), | ||
+ | >> constraint INDIVIDUALS_HOUSEHOLD_FK foreign ("HOUSEHOLD") references "HOUSEHOLDS" | ||
+ | >> ) | ||
+ | >> in "simple.xml"; | ||
+ | Table INDIVIDUALS created in simple.xml | ||
+ | </code> | ||
+ | |||
+ | === Using Environment Variables === | ||
+ | |||
+ | The following example uses an environment variable called "APPLICATION_HOME", meaning that all file locations will be relative to the directory contained in that environment variable. This also allows the environment to be easily copied to different locations and only requires that the environment variable be changed. | ||
+ | |||
+ | <code> | ||
+ | > create environment | ||
+ | >> in "{$APPLICATION_HOME/simple.xml}" | ||
+ | >> with delete; | ||
+ | Environment created in simple.xml | ||
+ | > | ||
+ | > | ||
+ | > create database "SIMPLE" | ||
+ | >> type FILE | ||
+ | >> index_directory "{$APPLICATION_HOME/idx}" | ||
+ | >> in "{$APPLICATION_HOME/simple.xml}"; | ||
+ | Database SIMPLE created in simple.xml | ||
+ | > | ||
+ | > | ||
+ | > create table "HOUSEHOLDS" | ||
+ | >> physical "{$APPLICATION_HOME/dat/households.dat}" | ||
+ | >> ( | ||
+ | >> "HOUSEHOLD" CHARACTER(12) omnidex, | ||
+ | >> "ADDRESS" CHARACTER(50) quicktext, | ||
+ | >> "CITY" CHARACTER(28) quicktext, | ||
+ | >> "STATE" CHARACTER(2) omnidex, | ||
+ | >> "ZIP" CHARACTER(5) omnidex, | ||
+ | >> "COUNTRY" CHARACTER(2) omnidex, | ||
+ | >> constraint HOUSEHOLDS_HOUSEHOLD_PK primary ("HOUSEHOLD") | ||
+ | >> ) | ||
+ | >> in "{$APPLICATION_HOME/simple.xml}"; | ||
+ | Table HOUSEHOLDS created in simple.xml | ||
+ | > | ||
+ | > | ||
+ | > create table "INDIVIDUALS" | ||
+ | >> physical "{$APPLICATION_HOME/dat/individuals.dat}" | ||
+ | >> ( | ||
+ | >> "INDIVIDUAL" CHARACTER(12) omnidex, | ||
+ | >> "HOUSEHOLD" CHARACTER(12) omnidex, | ||
+ | >> "NAME" CHARACTER(50) quicktext, | ||
+ | >> "GENDER" CHARACTER(1) omnidex bitmap, | ||
+ | >> "BIRTHDATE" ANSI DATE omnidex, | ||
+ | >> "PHONE" CHARACTER(14) omnidex, | ||
+ | >> "EMAIL" CHARACTER(60) quicktext, | ||
+ | >> constraint INDIVIDUALS_INDIVIDUAL_PK primary ("INDIVIDUAL"), | ||
+ | >> constraint INDIVIDUALS_HOUSEHOLD_FK foreign ("HOUSEHOLD") references "HOUSEHOLDS" | ||
+ | >> ) | ||
+ | >> in "{$APPLICATION_HOME/simple.xml}"; | ||
+ | Table INDIVIDUALS created in simple.xml | ||
+ | </code> | ||