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 void AddToRequest(Request request)
        {
            request.AddDataItem((byte)1); // undocumented but the java code does this
            request.AddDataItem((byte)RecordType);
            request.AddDataItem(ORID.ClusterId);
            request.AddDataItem(ORID.ClusterPosition);
            request.AddDataItem((byte)ORecordType.Document);

            var serializedDocument = RecordSerializerFactory.GetSerializer(request.Connection.Database).Serialize(GetDocument());

            switch (RecordType)
            {
            case RecordType.Create:
                request.AddDataItem(serializedDocument);
                break;

            case RecordType.Delete:
                request.AddDataItem(Version);
                break;

            case RecordType.Update:
                request.AddDataItem(Version);
                //request.AddDataItem((byte)1);
                request.AddDataItem(serializedDocument);
                if (OClient.ProtocolVersion >= 23)
                {
                    request.AddDataItem((byte)1);     // updateContent flag
                }
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Exemple #3
0
        public void Init()
        {
            context    = new TestDatabaseContext();
            database   = new ODatabase(TestConnection.GlobalTestDatabaseAlias);
            serializer = RecordSerializerFactory.GetSerializer(database);

            // database.Create.Class<Person>().Extends<OVertex>().Run();
            database.Create.Class <Person>().Extends <OVertex>().CreateProperties().Run();
            database.Create.Class <Address>().Extends <OVertex>().CreateProperties().Run();
            database.Create.Class <Dependent>().Extends <Person>().CreateProperties().Run();
        }
        public RecordBinaryDeserializationTest()
        {
            context    = new TestDatabaseContext();
            database   = new ODatabase(TestConnection.GlobalTestDatabaseAlias);
            serializer = RecordSerializerFactory.GetSerializer(database);

            database
            .Create
            .Class("TestClass")
            .Run();

            database
            .Create
            .Property("_date", OType.Date)
            .Class("TestClass")
            .Run();
        }
        public OCommandResult Run()
        {
            if (_simpleParams != null)
            {
                var paramsDocument = new ODocument();
                paramsDocument.OClassName = "";
                paramsDocument.SetField(OClient.ProtocolVersion < 22 ? "params" : "parameters", _simpleParams);
                ((CommandPayloadCommand)_payload).SimpleParams = RecordSerializerFactory.GetSerializer(_connection.Database).Serialize(paramsDocument);
            }

            Command operation = new Command(_connection.Database);

            operation.OperationMode  = OperationMode.Synchronous;
            operation.CommandPayload = _payload;

            ODocument document = _connection.ExecuteOperation(operation);

            return(new OCommandResult(document));
        }
Exemple #6
0
        private List <ODocument> RunInternal()
        {
            try
            {
                if (_parameters == null)
                {
                    throw new ArgumentNullException("_parameters");
                }

                var paramsDocument = new ODocument();
                paramsDocument.OClassName = "";
                paramsDocument.SetField("params", _parameters);

                var serializer = RecordSerializerFactory.GetSerializer(_connection.Database);


                CommandPayloadQuery payload = new CommandPayloadQuery();
                payload.Text = ToString();

                payload.NonTextLimit     = -1;
                payload.FetchPlan        = _fetchPlan;
                payload.SerializedParams = serializer.Serialize(paramsDocument);

                Command operation = new Command(_connection.Database);
                operation.OperationMode  = OperationMode.Synchronous;
                operation.CommandPayload = payload;

                ODocument document = _connection.ExecuteOperation(operation);

                return(document.GetField <List <ODocument> >("Content"));
            }
            finally
            {
                _parameters = null;
            }
        }
Exemple #7
0
 public RecordDocumentSerializationTests()
 {
     serializer = RecordSerializerFactory.GetSerializer(ORecordFormat.ORecordDocument2csv);
 }
 public void Init()
 {
     serializer = RecordSerializerFactory.GetSerializer(ORecordFormat.ORecordDocument2csv);
 }
 public RecordBinarySerializationTest()
 {
     context    = new TestDatabaseContext();
     database   = new ODatabase(TestConnection.GlobalTestDatabaseAlias);
     serializer = RecordSerializerFactory.GetSerializer(database);
 }