Ngugi1 / sqlite-net

Automatically exported from code.google.com/p/sqlite-net
0 stars 0 forks source link

Patch: Support for byte[] #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Attached is a patch so that byte[] types can be stored and recalled.

Here is some code from my manual test to start a real test with:

    public class TestClass
    {
        [PrimaryKey, AutoIncrement]
        public int TestClassID { get; set; }
        public byte[] SomeBytes { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            if (File.Exists("test.db"))
                File.Delete("test.db");

            SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection("test.db");

            conn.CreateTable<TestClass>();

            TestClass t = new TestClass() { SomeBytes = new byte[] { 1, 2, 4, 0, 6, 7 }};
            TestClass t2 = new TestClass() { SomeBytes = new byte[] { 64, 63 } };
            TestClass t3 = new TestClass() { SomeBytes = null };
            TestClass t4 = new TestClass() { SomeBytes = new byte[] {} };
            TestClass t5 = new TestClass() { SomeBytes = new byte[] { 0 } };
            conn.Insert(t);
            conn.Insert(t2);
            conn.Insert(t3);
            conn.Insert(t4);
            conn.Insert(t5);

            List<TestClass> results = conn.Table<TestClass>().ToList();

            conn.Close();
        }
    }

Original issue reported on code.google.com by elite.da...@gmail.com on 27 Oct 2010 at 8:25

Attachments:

GoogleCodeExporter commented 9 years ago
Patch Committed in r63.

Original comment by elite.da...@gmail.com on 28 Oct 2010 at 7:06