• Iguana 6
  • Previous Versions
  • API
  • Sample Code
  • Training
  • Create a Ticket
iNTERFACEWARE Help Center
  • Iguana 6
  • Previous Versions
  • API
  • Sample Code
  • Training
  • Create a Ticket

Code Repository

Home›Code Repository›store2.lua
Modules

store2.lua

Verified Featured
Added by iNTERFACEWARE

Provides a simple interface to store key/value pairs in a persistent storage mechanism.

Source Code

https://github.com/interfaceware/iguana-tools/blob/master/shared/store2.lua

Description
Provides a simple interface to store key/value pairs in a persistent storage mechanism.
Usage Details

The store2.lua module contains a simple interface to store key/value pairs in a persistent storage mechanism. Simply put, if you want to store and/or retrieve information across interfaces cross-message; this might be the module to do it.

Under the hood this module creates a SQLite database called ‘store.db’ in the Iguana working directory, which has a table called “store”, which has the name=value pairs. However you don’t need to know this, just create a store module (using the code above) and it will all work automatically.

How to use store.lua:

  • Add it to your shared modules in any Translator project.
  • Add store2 = require 'store.lua' at the top of your script.
  • Use store.connect() to specify the database to use to store data.
  • Use store.put() and store.get() to store and get information respectively.
-- This is the new version of store which allows one translator to have multiple stores
-- iNTERFACEWARE recommends this for newer interface code.  It is convenient to be able to
-- have independent stores for different purposes.

-- This module stores the data in SQLite data base file given in the store2.connect function.
-- By default this goes into the working directory of the Iguana instance.

store2 = require 'store2'

function main()
   local MyStore = store2.connect("store2.db")
   MyStore:put("life", "can be fun")
   MyStore:get("life")
   -- Query all the stored keys
   MyStore:info()
   
   -- Store multiple values
   MyStore:reset() -- clear the store first
   MyStore:put('Larry', 'The ')
   MyStore:put('Curly', 'three')
   MyStore:put('Moe', 'Stooges')
   
   -- check state - returns all stored data
   MyStore:info() --> table node tree with 3 rows 
   
      
   -- Here we create a store which is unique to this translator
   -- by naming it after the GUID of this translator.
   local LocalChannelStore = store2.connect(iguana.project.guid())   
   LocalChannelStore:put("life", "can be interesting")
   
   -- See two independent stores?
   LocalChannelStore:get("life")
   MyStore:get("life")
   
   -- We can reset stores which clears them
   trace(#MyStore:info())
   MyStore:reset()
   trace(#MyStore:info())
   -- Or we can delete them entirely.
   -- os.fs.stat allows us to test for the existance of the
   -- underlying database file.
   local DbFile = iguana.workingDir()..MyStore.name
   os.fs.stat(DbFile)
   MyStore:delete()
   os.fs.stat(DbFile)
   LocalChannelStore:delete()
end
More Information
Store Name=Value Keys
Bookmark
  • Reviews
  • Related Listings
Filter
Sort by: Newest First
  • Oldest First
  • Rating
  • Helpfulness
Write a Review
Rating
Keyword
Filter
Sort by: Title
  • Newest First
  • Oldest First
  • Most Reviews
  • Highest Rated
Rating
iNTERFACEWARE
age.lua
Added by iNTERFACEWARE
Modules
This module calculates age from DOB, it returns years, months and partial years (i.e., 17, 3, 17.296272)
auth.lua
Added by iNTERFACEWARE
Modules
A module that does basic authentication for incoming web requests
batch.lua
Added by iNTERFACEWARE
Modules
A module to help processing batched HL7 messages
codemap.lua
Added by iNTERFACEWARE
Modules
This module is used to map one set of codes to another set of codes, or to validate code membership in a set
csv_parse.lua
Added by iNTERFACEWARE
Modules
A module for parsing well-formed CSV files.
custom_merge.lua
Added by iNTERFACEWARE
Modules
A customizable database merge method for Iguana 5.5.1 and up.
dateparse.lua
Added by iNTERFACEWARE
Modules
A fuzzy date/time parser that is very useful for automatically translating a wide variety of date/time formats.
dup.lua
Added by iNTERFACEWARE
Modules
Duplicate message filter.
edifact.lua
Added by iNTERFACEWARE
Modules
Convert EDI messages to HL7 format so you can process them like an HL7 message (and convert them back to EDI afterwards)
hl7.findSegment.lua
Added by iNTERFACEWARE
Modules
A utility for finding any HL7 segment in a parsed HL7 message node tree.
hl7.serialize.lua
Added by iNTERFACEWARE
Modules
Serializes an HL7 message using specified non-standard delimiters and/or escape characters
hl7.zsegment.lua
Added by iNTERFACEWARE
Modules
Generic Z segment parser. Parses Z segments without needing grammar definitions in the VMD file.
iguanaServer.lua
Added by iNTERFACEWARE
Modules
Provides programmatic access to various operations that can be performed on Iguana channels.
llp.lua
Added by iNTERFACEWARE
Modules
Allows you to use LLP connections from a Translator script
mime.lua
Added by iNTERFACEWARE
Modules
Sends MIME-encoded email attachments using the SMTP protocol. A wrapper around net.smtp.send.
resubmit.lua
Added by iNTERFACEWARE
Modules
Resubmit a logged message to an Iguana channel using the unique reference number (refmsgid).
retry.lua
Added by iNTERFACEWARE
Modules
A module for retrying operations which might periodically fail like database operations.
rtf.lua
Added by iNTERFACEWARE
Modules
A module for converting a RTF file to plain text.
scheduler.lua
Added by iNTERFACEWARE
Modules
Schedule jobs to run at a specified time of day, very useful for batch processing
scrub.lua
Added by iNTERFACEWARE
Modules
The “scrub” module given below redacts sensitive information from HL7 messages.
Showing 1 - 20 of 31 results
«12»

Topics

  • expandGetting Started
  • expandAdministration
    • expandInstallation
    • expandLicensing
    • expandUpgrades
    • expandDeployment
    • expandConfiguration Management
      • expandCustom Configuration
    • expandBackup and Restore
    • expandSecurity
      • expandHIPAA Compliance
    • expandTroubleshooting
  • expandDeveloping Interfaces
    • expandArchitecture
    • expandInterfaces
      • expandHL7
      • expandDatabase
        • expandConnect
      • expandWeb Services
      • expandCDA
      • expandX12
      • expandOther Interfaces
      • expandUtilities
    • expandRepositories
      • expandBuiltin Repositories
        • expandIguana Upgrade
        • expandIguana Tutorials
        • expandIguana Tools
        • expandIguana Protocols
        • expandIguana Files
        • expandIguana Date/Time
        • expandIguana Webservices
        • expandIguana Excel
      • expandRemote Repositories
      • expandCS Team Repositories
        • expandIguana Channels
    • expandSample Code
      • expandModules
      • expandUsing built-in functions
      • expandWorking with XML
    • expandLua Programming
    • expandPerformance
  • expandFAQs and TIPs
    • expandFrequently Asked Questions
      • expandInstalls and Upgrades
      • expandWeb Services
      • expandConfiguration
      • expandChannels
      • expandTranslator
      • expandOther
      • expandDatabase
      • expandAdministration
      • expandLogs
      • expandChameleon
    • expandTips
      • expandChannels
      • expandChameleon
      • expandWeb Services
      • expandSecurity
      • expandProgramming
      • expandOther
      • expandAdministration
  • expandReference
    • expandIguana Enterprise and Professional
    • expandProgram Settings
    • expandChannel Settings
    • expandDashboard
    • expandChannels
    • expandTranslator
    • expandLogs
      • expandLog Encryption
    • expandHTTP API
    • expandCDA API
    • expandError Messages
    • expandChameleon
    • expandIguana Change Log

Other Links

  • Training Center
  • News & Announcements
  • iNTERFACEWARE Blog
  • Older Documention (IGUANA v4 & Chameleon)
Copyright © iNTERFACEWARE Inc.