Codecore Logo
Quick Search
»
Advanced Search »

Log To Database

RSS
Allows logging device property value(s) to database table at timed intervals.

Manufacturer: N/A


Configuration Settings

  • First LogEntry Delay : (optional) The time duration to wait after the driver starts to log the first entry. This gives other drivers time to start up and initialize their property values. The default in 60 seconds. Format: [days.]hours:minutes[:seconds] Days and seconds are optional, denoted by the square brackets. Example: 00:01:30 represents 1 minute and 30 seconds.
  • Logging Interval : The time duration between logging entries. Format: [days.]hours:minutes[:seconds] Days and seconds are optional, denoted by the square brackets. Specify 00:00 to disable logging at timed intervals. Example: 00:01:30 represents 1 minute and 30 seconds.
  • Database Connection String : The ODBC connection string to the database.

Example MySQL: Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;
  • Table Name : The database table name to insert the log records into.
  • Date Column Name : The column name in the table to store the date/time in.
    IMPORTANT: The date column must be a CHAR or VARCHAR compatible data type and must have a size large enough to fit the Date Format setting.
  • Date Format : (optional) The date format to use when storing date values.
  • Columns : The column names and values / scripts.

String values are written to CHAR/VARCHAR compatible columns. Number values are written to numeric compatible columns. Boolean values are written to numeric compatible columns, 1=True, 0=False DateTime values are written to CHAR/VARCHAR compatible columns using the specified date/time format. MySQL DateTime columns support auto-converting the default date format to a date.

Events

Ready State Changed

The device's running and ready state changed.

Whenever Filter:

none

EventArgs:

  • Number NewValue : The new property value.
  • Number PreviousValue : The previous property value.

Instance Properties

SuccessfulLogEntryCount

The number of times the driver has successfully inserted log records into the database during this session.

Accessibility : Read Only

Type: Number

FailedfulLogEntryCount

The number of times the driver has failed to insert log records into the database during this session.

Accessibility : Read Only

Type: Number

MostRecentInsertSql

The most recently attempted sql insert statement. This is helpful when debugging logging issues.

Accessibility : Read Only

Type: String

DeviceDisplayName

The display name for this device.

Accessibility : Read Only

Type: String

DeviceStartTime

The date and time when this device was started.

Accessibility : Read Only

Type: DateTime

DeviceLifecycleStage

The current lifecycle stage of the device. The stages in order are: Pending Start, Starting, Running, Stopping

Accessibility : Read Only

Type: Number

DeviceIsRunningAndReady

Indicates if the device is ready for use, ie it is in the Running lifecycle stage and all properties are valid and all methods are ready to be used.

Accessibility : Read Only

Type: Boolean

Instance Methods

LogNow

Forces the driver to log now.

Syntax

void LogNow( )

Parameters

none

SetPropertyForDuration ( String, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.

SetPropertyForDuration ( String, Number, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, Number arrayIndex, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
arrayIndex : The property's array index to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.

Privacy Policy | Conditions Of Use

Copyright ©2014 Codecore Technologies, All rights reserved.