Database>Quick Reference - Database
Introduction Installation Beginning Admin Quick Ref FTP Server SMTP Server Database Security
Statements Objects String Parsing Events Queues Samples Special names Error Handling Accessories   Back
Caravan Business Server>Help>Database>Quick Reference - Database
Syntax Compilation of Syntax
Text   Object:
      Var xyz
      table xyz=DatabaseName.Tablename

   Properties:
      xyz(recordno)
      xyz(nextrecord)
      xyz(selected)
      xyz(tableinfo);      // table structure saved in xml format. Read or write once to create a table dynamically
      xyz(insert)
      xyz(delete)
      xyz(modify)
      xyz(fields)      // fields of the table
      xyz(selectall)      // reset all previous selection

   Select Statements:

      select from [table-objname] where [[fieldname] [condition] [reference-value] and ....] order by [fieldname] [asc|desc]
      -----------multiple conditions are ANDed together

      select from [table-objname] where [[fieldname] [condition] [reference-value] or ....] order by [fieldname] [asc|desc]
       ---------- multiple conditions are ORed together

      select from [table-objname] order by [fieldname]
      ---------selects all and  orders by [fieldname]

        select from mytable where origin is unique;// only select where this field has unique values.

   Use fixed words to assign variables
            var sql   or form()
            sql(propertyname)
            select from [tableobject] where [fieldname] [condition] {propertyname}


   Search Statements
        select from mytable where subject like "urgent";// where value is a constant
        select from mytable where subject like "{mytoken}";// where value is variable
        select from mytable where subject like poly*;// search for substring (usually slow performance)
        select from mytable where subject like "my token"
        select from mytable where subject like "{token}"


   Creating a new Table

      <caravan>
            file mytablinfo="d:\directory\myfile.xml"      // existing xml file containing new table structure
            table newtable=xxxx.yyyy;                  // since its a new table this will create an empty table object.
            newtable(tableinfo)=mytableinfo(file);            // will create the db and table if they dont already exist
      </caravan>


   Can have search within a search. Just needs to give multiple select statements.

Sample
Quick Reference
Home       Back