Ejemplo n.º 1
0
 public void DeleteEngineItem(EngineItem item)
 {
     try
     {
         session = cluster.Connect(KEYSPACE);
         session.Execute(string.Format("delete from engineitems where id = '{0}';", item.id.ToString()));
     }
     catch (Exception ex)
     {
         ErrorHandler.Publish(LogLevel.Error, "CassandraProvider Error:" + ex.Message, ex);
     }
 }
Ejemplo n.º 2
0
 public void UpdateEngineItem(EngineItem item)
 {
     try
     {
         session = cluster.Connect(KEYSPACE);
         session.Execute(string.Format("update engineitems set name = '{1}', engineid = '{2}', locationurl = '{3}', type = '{4}', collectionname = '{5}', indexpath = '{6}' where id = '{0}';",
                                       item.id.ToString(), item.name, item.engineid.ToString(), item.locationurl, item.type, item.collectionname, item.indexpath));
     }
     catch (Exception ex)
     {
         ErrorHandler.Publish(LogLevel.Error, "CassandraProvider Error:" + ex.Message, ex);
     }
 }
Ejemplo n.º 3
0
        public Guid AddNewEngineItem(EngineItem item)
        {
            try
            {
                var newId = Guid.NewGuid();
                session = cluster.Connect(KEYSPACE);
                session.Execute(string.Format("insert into engineitems (id, name, engineid, locationurl, type, collectionname, indexpath) values ('{0}','{1}', '{2}', '{3}', '{4}', '{5}', '{6}');",
                                              newId.ToString(), item.name, item.engineid.ToString(), item.locationurl, item.type, item.collectionname, item.indexpath));

                return(newId);
            }
            catch (Exception ex)
            {
                ErrorHandler.Publish(LogLevel.Error, "CassandraProvider Error:" + ex.Message, ex);
            }

            return(Guid.Empty);
        }
Ejemplo n.º 4
0
        public EngineItem GetEngineItem(Guid engineItemId)
        {
            EngineItem engine = new EngineItem();

            try
            {
                session = cluster.Connect(KEYSPACE);
                RowSet rows = session.Execute("select * from engineitems where id = '" + engineItemId.ToString() + "';");
                foreach (Row item in rows)
                {
                    return(new EngineItem()
                    {
                        id = Guid.Parse(item["id"].ToString()), name = item["name"].ToString(), engineid = Guid.Parse(item["engineid"].ToString()), collectionname = item["collectionname"].ToString(), indexpath = item["indexpath"].ToString(), locationurl = item["locationurl"].ToString(), type = item["type"].ToString()
                    });
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Publish(LogLevel.Error, "CassandraProvider Error:" + ex.Message, ex);
            }

            return(null);
        }