| Getting Started |
Welcome the Quasardb API for .NET.
Connecting to the database
Interfacing with a quasardb database from a .NET program is extremely straightforward, just create a QdbCluster and perform the operations.
var cluster = new QdbCluster("qdb://127.0.0.1:2836");
Dim cluster = New QdbCluster("qdb://127.0.0.1:2836")
Blobs
OK, now that we have a connection to the database, let's store some binary data:
byte[] a, b, c;
QdbBlob myBlob = cluster.Blob("Bob the blob");
myBlob.Put(a);
myBlob.Update(b);
c = myBlob.Get();
Dim a, b, c As Byte()
Dim myBlob = cluster.Blob("Bob the blob")
myBlob.Put(a)
myBlob.Update(b)
c = myBlob.Get()
Integers
quasardb comes out of the box with server-side atomic integers:
long a, b, c;
QdbInteger myInt = cluster.Integer("Roger the integer");
myInt.Put(a);
c = myInt.Add(b);
Dim a, b, c As Long
Dim myInt = cluster.Integer("Roger the integer")
myInt.Put(a)
c = myInt.Add(b)
Tags
Here's how you can easily find your data, using tags:
cluster.Blob("Bob the blob").AttachTag("Male");
cluster.Integer("Roger the integer").AttachTag("Male");
IEnumerable<QdbEntry> males = cluster.Tag("Male").GetEntries();
cluster.Blob("Bob the blob").AttachTag("Male");
cluster.Integer("Roger the integer").AttachTag("Male");
Dim males = cluster.Tag("Males").GetEntries()
Search by prefix or suffix
And here, you can find your data searching by prefix or suffix:
cluster.Blob("Hey! Bob the blob. Bye.");
cluster.Integer("Hey! Roger the integer. Bye.");
IEnumerable<QdbEntry> heys = cluster.Entries(new QdbPrefixSelector("Hey!", 10));
IEnumerable<QdbEntry> byes = cluster.Entries(new QdbSuffixSelector("Bye.", 10));
cluster.Blob("Hey! Bob the blob");
cluster.Integer("Hey! Roger the integer");
Dim heys = cluster.Entries(New QdbPrefixSelector("Hey!", 10))
Dim byes = cluster.Entries(New QdbSuffixSelector("Bye.", 10))
Instead of getting the entries as the result, one can ask only for a collection of strings using
Keys() method instead of Entries().
cluster.Blob("Hey! Bob the blob. Bye.");
cluster.Integer("Hey! Roger the integer. Bye.");
IEnumerable<String> heys = cluster.Keys(new QdbPrefixSelector("Hey!", 10));
IEnumerable<String> byes = cluster.Keys(new QdbSuffixSelector("Bye.", 10));
cluster.Blob("Hey! Bob the blob");
cluster.Integer("Hey! Roger the integer");
Dim heys = cluster.Keys(New QdbPrefixSelector("Hey!", 10))
Dim byes = cluster.Keys(New QdbSuffixSelector("Bye.", 10))
See Also