コード例 #1
0
 public List <List <KeyValuePair <string, string> > > ReadData(string statement)
 {
     try
     {
         IQldbDriver driver = this.GetDriver();
         new AmazonQLDBSessionConfig().RegionEndpoint = Global.Region;
         using (IQldbSession session = driver.GetSession())
             return(this.BuildData(session.Execute(statement, (List <IIonValue>)null, (Action <int>)null)));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
コード例 #2
0
        public List <List <KeyValuePair <string, string> > > WriteData(
            string tableName,
            string statement)
        {
            string documentID = string.Empty;

            try
            {
                IQldbDriver driver = this.GetDriver();
                new AmazonQLDBSessionConfig().RegionEndpoint = Global.Region;
                List <List <KeyValuePair <string, string> > > keyValuePairListList;
                using (IQldbSession session = driver.GetSession())
                {
                    keyValuePairListList = this.BuildData(session.Execute(statement, (List <IIonValue>)null, (Action <int>)null));
                    keyValuePairListList[0].ForEach((Action <KeyValuePair <string, string> >)(x =>
                    {
                        if (string.IsNullOrEmpty(x.Key) || !(x.Key.ToLower() == "documentid"))
                        {
                            return;
                        }
                        documentID = x.Value;
                    }));
                }
                if (!string.IsNullOrEmpty(documentID))
                {
                    string[] strArray = new string[9];
                    strArray[0] = "SELECT * from history(";
                    strArray[1] = tableName;
                    strArray[2] = ", `";
                    DateTime dateTime1 = DateTime.UtcNow;
                    dateTime1   = dateTime1.AddMinutes(-1.0);
                    strArray[3] = dateTime1.ToString("o");
                    strArray[4] = "`, `";
                    DateTime dateTime2 = DateTime.UtcNow;
                    dateTime2   = dateTime2.AddSeconds(0.7);
                    strArray[5] = dateTime2.ToString("o");
                    strArray[6] = "`) AS h WHERE h.metadata.id = '";
                    strArray[7] = documentID;
                    strArray[8] = "'";
                    string statement1 = string.Concat(strArray);
                    keyValuePairListList.AddRange((IEnumerable <List <KeyValuePair <string, string> > >) this.ReadData(statement1));
                }
                return(keyValuePairListList);
            }
            catch (Exception ex)
            {
                throw;
            }
        }