Exemplo n.º 1
0
        private string ExecuteQuery(string query, Func <IRecordSet, string> formatLambda, params QlParameter[] parameters)
        {
            Utils.ClearJournal <Quote>(FOLDER_PATH);
            string location;

            using (var qj = OpenJournal(EFileAccess.ReadWrite))
            {
                location = qj.Metadata.Settings.DefaultPath;
                AppendRecords(qj, 0, 1);
            }

            using (var qj = new JournalBuilder()
                            .WithAccess(EFileAccess.Read)
                            .WithLocation(location)
                            .ToJournal())
            {
                using (var rdr = qj.OpenRecordReadTx())
                {
                    var qts = rdr.Execute(query, parameters);

                    // Act.
                    var result = formatLambda(qts);

                    // Verify.
                    return(string.Join(",", result));
                }
            }
        }
Exemplo n.º 2
0
        private string ExecuteQuery(string query, Func <IRecordSet, string> formatLambda, params QlParameter[] parameters)
        {
            Utils.ClearJournal <Quote>();
            var config = Utils.ReadConfig <Quote>();

            using (var qj = Utils.CreateJournal <Quote>(config, EFileAccess.ReadWrite))
            {
                AppendRecords(qj, 0, 1);
            }

            using (var qj = new JournalBuilder()
                            .WithAccess(EFileAccess.Read)
                            .WithLocation(config.DefaultPath)
                            .ToJournal())
            {
                using (var rdr = qj.OpenRecordReadTx())
                {
                    var qts = rdr.Execute(query, parameters);

                    // Act.
                    var result = formatLambda(qts);

                    // Verify.
                    return(string.Join(",", result));
                }
            }
        }
Exemplo n.º 3
0
        public void OpenWrite()
        {
            var j = new JournalBuilder()
                    .WithLocation(@"C:\temp\QueryMonitor\VdbAlloc")
                    .ToJournal();

            using (var r = j.OpenRecordReadTx())
            {
                var records   = r.Execute("Select status from VdbAlloc latest by correlationId");
                var allStatus = records.RecordIDs().Select(rid => records.Get <string>(rid, 0)).ToArray();
                int i         = 0;
            }
        }