public void RemoveItem(IContext context, string path, bool recurse) { var factory = new DynamicParametersFactory(_context, _record.Table.TableName); var sql = factory.ToDeleteRecord( PrimaryKey ); context.WriteVerbose("DELETE SQL: " + sql); _context.Execute(sql); }
public void RemoveItem(IContext context, string path, bool recurse) { var factory = new DynamicParametersFactory(_context, _record.Table.TableName); var sql = factory.ToDeleteRecord(PrimaryKey); context.WriteVerbose("DELETE SQL: " + sql); _context.Execute(sql); }
public IPathNode SetItem(IContext context, string path, object value) { var factory = new DynamicParametersFactory(_context, _record.Table.TableName); //TODO: invert sql generation and parameter snooping to update only specified fields var cmd = factory.ToUpdate(); context.WriteVerbose("UPDATE SQL: " + cmd.CommandText); factory.Parameterize(cmd, PrimaryKey, value, context.DynamicParameters as RuntimeDefinedParameterDictionary); cmd.ExecuteNonQuery(); return GetNodeValue(); }
public IPathNode SetItem(IContext context, string path, object value) { var factory = new DynamicParametersFactory(_context, _record.Table.TableName); //TODO: invert sql generation and parameter snooping to update only specified fields var cmd = factory.ToUpdate(); context.WriteVerbose("UPDATE SQL: " + cmd.CommandText); factory.Parameterize(cmd, PrimaryKey, value, context.DynamicParameters as RuntimeDefinedParameterDictionary); cmd.ExecuteNonQuery(); return(GetNodeValue()); }
public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue) { var parameterDictionary = context.DynamicParameters as RuntimeDefinedParameterDictionary; var value = newItemValue.ToPSObject(); var factory = new DynamicParametersFactory(_context, Name); var command = factory.ToInsert(); context.WriteVerbose("INSERT SQL: " + command.CommandText); factory.Parameterize(command, value, parameterDictionary); foreach (SqliteParameter param in command.Parameters) { context.WriteVerbose("PARAMETERS: @" + param.ParameterName + " = [" + param.Value + "]"); } var id = command.ExecuteScalar(); return(Resolve(context, id.ToString()).First().GetNodeValue()); }
public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue) { var parameterDictionary = context.DynamicParameters as RuntimeDefinedParameterDictionary; var value = newItemValue.ToPSObject(); var factory = new DynamicParametersFactory(_context, Name); var command = factory.ToInsert(); context.WriteVerbose( "INSERT SQL: " + command.CommandText ); factory.Parameterize(command, value, parameterDictionary); foreach (SqliteParameter param in command.Parameters) { context.WriteVerbose("PARAMETERS: @" + param.ParameterName + " = [" + param.Value + "]"); } var id = command.ExecuteScalar(); return Resolve(context, id.ToString()).First().GetNodeValue(); }