예제 #1
0
        public static GTARun StartRunImpl(int sessionid)
        {
            var run = new GTARun();

            run.guid       = Guid.NewGuid();
            run.archiveKey = Path.Combine("images", run.guid + ".zip");
            var conn       = OpenConnection();
            int instanceid = InsertInstanceData(conn);

            InsertSystemData(conn);
            using (var cmd = new NpgsqlCommand()) {
                cmd.Connection  = conn;
                cmd.CommandText =
                    "INSERT INTO runs (runguid, archivepath, session_id, instance_id) VALUES (@guid, @archivekey, @session, @instance);";
                cmd.Parameters.AddWithValue("@guid", run.guid);
                cmd.Parameters.AddWithValue("@archivekey", run.archiveKey);
                cmd.Parameters.AddWithValue("@session", sessionid);
                cmd.Parameters.AddWithValue("@instance", instanceid);
                cmd.ExecuteNonQuery();
            }

            conn.Close();

            return(run);
        }
예제 #2
0
        public static GTARun StartRunImpl(int sessionid)
        {
            var run = new GTARun();

            run.guid = Guid.NewGuid();
            var conn = OpenConnection();

            using (var cmd = new NpgsqlCommand())
            {
                cmd.Connection  = conn;
                cmd.CommandText =
                    "INSERT INTO runs (runguid, session_id) VALUES (@guid, @session);";
                cmd.Parameters.AddWithValue("@guid", run.guid);
                cmd.Parameters.AddWithValue("@session", sessionid);
                cmd.ExecuteNonQuery();
                cmd.CommandText = "SELECT run_id FROM runs WHERE runguid = @guid";
                run.Id          = (int)cmd.ExecuteScalar();
            }

            conn.Close();

            return(run);
        }
예제 #3
0
 public static void StopRun(GTARun run)
 {
 }