Exemplo n.º 1
0
        void CreateInstanceInternal()
        {
            if (!HasResult)
            {
                Result = new ExecuteResult();
            }

            string sql =
                $@"insert into {Fields.TableName}
(
    {Fields.Name}
    ,{Fields.ReqNum}
    ,{Fields.LogPath}
    ,{Fields.PId}
    ,{Fields.Status}
    ,{Fields.StatusMsg}
    ,{Fields.Dttm}
)
values
(
    '{Name}'
    ,'{StartInfo.RequestNumber}'
    ,'{"plan.LogPath"}'
    ,{Result.PId}
    ,{(int)Result.Status}
    ,'{Result.Status.ToString()}'
    ,{_dal.GetEpoch()}
)
";

            using (SQLiteConnection c = new SQLiteConnection(SynapseDal.ConnectionString))
            {
                c.Open();

                _dal.ExecuteNonQuery(sql, c);
                _instanceId = _dal.GetLastRowId(c).Value;
            }

            if (InstanceId == 0)
            {
                InstanceId = _instanceId;
            }
        }
Exemplo n.º 2
0
        internal void CreateInstance(long? parentId)
        {
            if( !HasResult )
                Result = new ExecuteResult();

            string parIdFld = parentId.HasValue ? $",{Fields.ParentId}" : "";
            string parIdVal = parentId.HasValue ? $",{parentId.Value}" : "";

            string sql =
$@"insert into {Fields.TableName}
(
    {Fields.Name}
    ,{Fields.PlanId}
    ,{Fields.PId}
    ,{Fields.Status}
    ,{Fields.StatusMsg}
    ,{Fields.StatusSeq}
    ,{Fields.Dttm}
    {parIdFld}
)
values
(
    '{Name}'
    ,{PlanInstanceId}
    ,{Result.PId}
    ,{(int)Result.Status}
    ,'{Result.Status.ToString()}'
    ,{-100}
    ,{_dal.GetEpoch()}
    {parIdVal}
)
";

            using( SQLiteConnection c = new SQLiteConnection( SynapseDal.ConnectionString ) )
            {
                c.Open();

                _dal.ExecuteNonQuery( sql, c );
                InstanceId = _dal.GetLastRowId( c ).Value;
            }
        }