Results 1 to 1 of 1
  1. #1
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh

    Introduction to NoSQL data storage.

    Quote Originally Posted by Wikipedia
    A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. Motivations for this approach include simplicity of design, horizontal scaling and finer control over availability. NoSQL databases are often highly optimized key–value stores intended primarily for simple retrieval and appending operations, whereas an RDBMS is intended as a general purpose data store. There will thus be some operations where NoSQL is faster and some where an RDBMS is faster. NoSQL databases are finding significant and growing industry use in big data and real-time web applications.[1] NoSQL systems are also referred to as "Not only SQL" to emphasize that they may in fact allow SQL-like query languages to be used.
    Recently I've developed my own NoSQL data storage engine so in this tutorial I'll be using mine (which is available in my sig). First of all include the namespace for the database.
    Code:
    using eGamers;
    In this example I'll be creating a database to store each company employee information.

    Now to create a new database we'll be using a random file in our PC to store the data. (If the file doesn't exist it will be created automatically) To do so just initialize a new instance of the EGNoSqlDatabase class.
    Code:
    EGNoSqlDatabase testDB = new EGNoSqlDatabase(@"D:\testDB.db", "The Database Name");
    Alright, so we have a file that holds our database, now we need to fill that database with concrete data. To do so we must first of all understand its data model which is very understandable...
    [IMG]https://egnosql.******.com/uploads/5/4/7/1/5471987/4539705_orig.jpg[/IMG]

    So this is the data model. Now we have to add some rows to store our data.

    There will be 4 employees, which means that we'll have to store 4 different rows. (This can be also done in a single row tho)
    The good thing about all this is that a row can have different columns. Let's take an example:
    Code:
    ________________________________________________________
    |ROW #1
    ________________________________________________________
    Name     Role     Picture     Salary     Contract Expiration Date
    ------    -----   --------   -------    ------------------------
    Ted       Coder   <PIC>      $10000    05/01/2013
    ________________________________________________________
    
    ________________________________________________________
    |ROW #2
    ________________________________________________________
    Name     Salary
    ------    -------
    John       $500
    ________________________________________________________
    As the model above shows there's no strict schema for the table. You can add as many columns per row as you wish.

    Now let's create the rows:
    Code:
    List<EGNoSqlVirtualCell> cells = new List<EGNoSqlVirtualCell>();
    
    // Create a new row for the employee Ted.
    cells.Add(new EGNoSqlVirtualCell("Name", Encoding.ASCII.GetString("Ted")));
    Add the rest of the info as in the example above...
    
    EGNoSqlVirtualRow ted = new EGNoSqlVirtualRow(cells);
    cells.Clear();
    
    // Create a new row for the employee John.
    cells.Add(new EGNoSqlVirtualCell("Name", Encoding.ASCII.GetString("John")));
    Add the rest of the info as in the example above...
    
    EGNoSqlVirtualRow john = new EGNoSqlVirtualRow(cells);
    cells.Clear();
    
    // Add each row to the database.
    testDB.AddRow(ted);
    testDB.AddRow(john);
    
    // Store the database to the file.
    testDB.SaveToFile();

    So this was just a short intro into the NoSQL world! Expect it coming guys!

  2. The Following User Says Thank You to ♪~ ᕕ(ᐛ)ᕗ For This Useful Post:

    Geometrical (12-21-2013)

Similar Threads

  1. Replies: 17
    Last Post: 06-19-2013, 05:14 PM
  2. Noob Introduction Thread
    By Dave84311 in forum General
    Replies: 396
    Last Post: 06-03-2009, 11:58 AM
  3. iets introduction post
    By EleMentX in forum Spammers Corner
    Replies: 21
    Last Post: 12-11-2006, 04:40 PM
  4. [request] Introduction to game hacking
    By Unf4mili4r in forum Suggestions, Requests & General Help
    Replies: 8
    Last Post: 07-27-2006, 03:28 PM
  5. Forum Data Loss
    By Dave84311 in forum News & Announcements
    Replies: 9
    Last Post: 01-22-2006, 05:44 PM