Hi Neil
once the table mutator have been created you invoke one of the Set method
(see also http://ht4n.softdev.ch/index.php/documentation/insert-data) in
order to insert cells into the table. Basically the cell is composed of a
cell key and cell value (untyped columns, byte array), where the key
includes the full row and column identifier (see also
http://ht4n.softdev.ch/index.php/documentation/keys-and-cells). Let's add a
few cells into your table, all for the same row:
var key = new Key { Row = "row-identifier", ColumnFamily = "TimeStamp" };
mutator.Set(key, BitConverter.GetBytes(DateTime.UtcNow.Ticks));
key.ColumnFamily = "TagId";
mutator.Set(key, Guid.NewGuid().ToByteArray());
key.ColumnFamily = "ParameterId";
mutator.Set(key, Guid.NewGuid().ToByteArray());
key.ColumnFamily = "Description";
mutator.Set(key,
System.Text.Encoding.UTF8.GetBytes("something-helpful"));
btw if you change the provider to Provider=Trift the library will use the
thrift API
-Andy
On Thursday, February 20, 2014 8:44:57 PM UTC+1, Neil Varnas wrote:
>
> Please treat the following as newbie.
> I know these groups might be to a bit more experienced developers but Im
> trying to get there so please ignore my ignorance.
> Could anyone please help me out with my issue: I have created a namespace
> and a table wit HT4N in C# as follows:
>
>
> static void Main(string[] args)
> {
> string hql =
> "CREATE TABLE AlarmTable ("
> + "TimeStamp,"
> + "TagId,"
> + "ParameterId,"
> + "Description,"
> + "ACCESS GROUP default (TimeStamp, TagId, ParameterId),"
> + "ACCESS GROUP profile (Description)"
> + ");";
>
> var cell = new Cell
> {
> Key = key,
> Value = value,
> Flag = CellFlag.Default // optional, CellFlag.Default is the
> default cell flag
> };
>
>
>
> var connectionString = "Provider=Hyper;Uri=net.tcp://localhost";
> using (var context = Context.Create(connectionString))
> using (var client = context.CreateClient())
> {
> if (!client.NamespaceExists("/IPAA"))
> client.CreateNamespace("/IPAA");
>
> using (var ns = client.OpenNamespace("IPAA"))
> {
> ns.Exec(hql);
> using (var table = ns.OpenTable("AlarmTable"))
> {
> using (var mutator = table.CreateMutator())
> {
> //some code here
> }
> }
> }
> }
> }
>
> Could someone please tell me how do I use the mutator now to create a
> simple entry in my newly create table (using the columns), some simple code
> snippet which makes sense to a newbie would be much appreciated ! Im not
> entirely sure what supposed to be the Key and what should be the value.
> Thanks, Neil
>
--
You received this message because you are subscribed to the Google Groups
"Hypertable Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hypertable-dev.
For more options, visit https://groups.google.com/d/optout.