public string Run() { OCluster cluster; var defaultClusterId = _connection.Database.GetClusterIdFor(_className); if (defaultClusterId == -1) { CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = ToString(); Command operation = new Command(_connection.Database); operation.OperationMode = OperationMode.Synchronous; operation.CommandPayload = payload; var doc = _connection.ExecuteOperation(operation); OCommandResult result = new OCommandResult(doc); // var clusterId = short.Parse(result.ToDocument().GetField<string>("Content")); cluster = _connection.Database.AddCluster(new OCluster { Name = _className }); } else { cluster = _connection.Database.GetClusters().FirstOrDefault(c => c.Name == _className); } if (_autoProperties) { CreateAutoProperties(); } return(cluster.Name); }
private OCommandResult RunInternal() { try { if (_parameters == null) { throw new ArgumentNullException("_parameters"); } var paramsDocument = new ODocument(); paramsDocument.OClassName = ""; paramsDocument.SetField(OClient.ProtocolVersion < 22 ? "params" : "parameters", _parameters); var serializer = RecordSerializerFactory.GetSerializer(_connection.Database); CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = ToString(); payload.SimpleParams = serializer.Serialize(paramsDocument); Command operation = new Command(_connection.Database); operation.OperationMode = OperationMode.Synchronous; operation.CommandPayload = payload; ODocument document = _connection.ExecuteOperation(operation); return(new OCommandResult(document)); } finally { _parameters = null; } }
public OCommandResult Command(string sql) { CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = sql; OCommandQuery query = new OCommandQuery(GetConnection(), payload); return(query.Run()); }
public ODocument Run() { CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = ToString(); Command operation = new Command(_connection.Database); operation.OperationMode = OperationMode.Synchronous; operation.CommandPayload = payload; OCommandResult result = new OCommandResult(_connection.ExecuteOperation(operation)); return(result.ToSingle()); }
public int Run() { CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = ToString(); Command operation = new Command(_connection.Database); operation.OperationMode = OperationMode.Synchronous; operation.CommandPayload = payload; OCommandResult result = new OCommandResult(_connection.ExecuteOperation(operation)); return(int.Parse(result.ToDocument().GetField <string>("Content"))); }
public OCommandResult Command(string sql) { CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = sql; Command operation = new Command(_connection.Database); operation.OperationMode = OperationMode.Synchronous; operation.CommandPayload = payload; ODocument document = _connection.ExecuteOperation(operation); return(new OCommandResult(document)); }
public short Run() { if (string.IsNullOrEmpty(_class)) { throw new OException(OExceptionType.Query, "Class is empty"); } CommandPayloadCommand payload = new CommandPayloadCommand(); payload.Text = ToString(); Command operation = new Command(_connection.Database); operation.OperationMode = OperationMode.Synchronous; operation.CommandPayload = payload; OCommandResult result = new OCommandResult(_connection.ExecuteOperation(operation)); return(short.Parse(result.ToDocument().GetField <string>("Content"))); }