Index  Up  <<  


Importing from an ASCII file

When importing a file for SQL, MiniVend by default uses the first column of the ASCII file as the primary key, with a char(16) type, and assigns all other columns a char (128) definition. These definitions can be changed by placing the proper definitions in COLUMN_DEF Database directive attribute:

  Database  products  COLUMN_DEF  price=char(20), nontaxable=char(3)

You can set this as many times as desired if it will not fit on the line nicely.

  Database  products  COLUMN_DEF  price=char(20), nontaxable=char(3)
  Database  products  COLUMN_DEF  description=char(254)

To create an index automatically, you can append information when the value is in quotes:

  Database  products  COLUMN_DEF  "code=char(14) primary key"

The field delimiter to use is TAB by default, but can be changed with the Database DELIMITER directive:

  Database  products products.csv dbi:mSQL:minivend:localhost:1114
  Database  products DELIMITER  CSV

If you wish to create other secondary keys to speed sorts and searches you can do so in the COLUMN_DEF:

  Database  products COLUMN_DEF  "author=char(64) secondary key"

or use external database tools. Careful! Not all SQL databases use the same index commands.

If you wish to use an existing SQL database instead of importing, set the NoImport directive in catalog.cfg to include any database identifiers you never wish to import:

    NoImport  products inventory

WARNING: If MiniVend has write permission on the products database, you must be careful to set the NoImport directive or create the proper .sql file. If that is not done, and the database source file is changed, the SQL database could be overwritten. In any case, always back up your database before enabling it for use by MiniVend.


Index  Up  <<