2013-01-18 15:55:50 +00:00
|
|
|
using System;
|
2014-01-08 14:16:39 +00:00
|
|
|
namespace AsterNET.FastAGI.Command
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Adds or updates an entry in the Asterisk database for a given family, key, and value.<br/>
|
|
|
|
/// Returns 1 if successful, 0 otherwise.
|
|
|
|
/// </summary>
|
|
|
|
public class DatabasePutCommand : AGICommand
|
|
|
|
{
|
|
|
|
/// <summary> The family of the key to set.</summary>
|
|
|
|
private string family;
|
|
|
|
/// <summary> The key to set.</summary>
|
|
|
|
private string varKey;
|
|
|
|
/// <summary> The value to set.</summary>
|
|
|
|
private string varValue;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the family of the key to set.
|
|
|
|
/// </summary>
|
|
|
|
public string Family
|
|
|
|
{
|
|
|
|
get { return family; }
|
|
|
|
set { this.family = value; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the the key to set.
|
|
|
|
/// </summary>
|
|
|
|
public string Key
|
|
|
|
{
|
|
|
|
get { return varKey; }
|
|
|
|
set { this.varKey = value; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the value to set.
|
|
|
|
/// </summary>
|
|
|
|
public string Value
|
|
|
|
{
|
|
|
|
get { return varValue; }
|
|
|
|
set { this.varValue = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new DatabasePutCommand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="family">the family of the key to set.</param>
|
|
|
|
/// <param name="key">the key to set.</param>
|
|
|
|
/// <param name="value">the value to set.</param>
|
|
|
|
public DatabasePutCommand(string family, string key, string value)
|
|
|
|
{
|
|
|
|
this.family = family;
|
|
|
|
this.varKey = key;
|
|
|
|
this.varValue = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string BuildCommand()
|
|
|
|
{
|
|
|
|
return "DATABASE PUT " + EscapeAndQuote(family) + " " + EscapeAndQuote(varKey) + " " + EscapeAndQuote(varValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|