예제 #1
0
        public void MoveToNextRow()
        {
            using (var cursor = DatabaseWrapper.ExecuteSingleResultQuery($"SELECT boolNullable FROM {TableName} WHERE boolNullable IS NOT NULL;"))
            {
                Assert.IsFalse(cursor.IsEmpty);
                Assert.IsTrue(cursor.IsFirstRow());
                Assert.IsFalse(cursor.MoveToNextRow());
            }

            using (var cursor = DatabaseWrapper.ExecuteQuery($"SELECT boolNullable FROM {TableName} WHERE boolNullable IS NOT NULL;"))
            {
                Assert.IsFalse(cursor.IsEmpty);
                Assert.IsTrue(cursor.IsFirstRow());

                var lastRowPosition = cursor.GetRowPosition();
                while (cursor.MoveToNextRow())
                {
                    var currentRowPosition = cursor.GetRowPosition();
                    Assert.AreEqual(lastRowPosition + 1, currentRowPosition);

                    lastRowPosition = currentRowPosition;
                }

                cursor.MoveToNextRow();
                Assert.AreEqual(lastRowPosition, cursor.GetRowPosition());
            }
        }
예제 #2
0
 public void GetByteBufferLengthTest()
 {
     using (var cursor = DatabaseWrapper.ExecuteQuery($"SELECT boolTrue FROM {TableName};"))
     {
         Assert.IsTrue(cursor.GetByteBufferLength() == 1024);
     }
 }
예제 #3
0
 public void GetColumnNameTest()
 {
     using (var cursor = DatabaseWrapper.ExecuteQuery($"SELECT boolFalse FROM {TableName};"))
     {
         Assert.IsTrue(cursor.GetColumnName(0) == "boolFalse");
     }
 }
예제 #4
0
 public void GetBooleanTrueTest()
 {
     using (var cursor = DatabaseWrapper.ExecuteQuery($"SELECT boolTrue FROM {TableName};"))
     {
         Assert.IsFalse(cursor.IsEmpty);
         Assert.IsTrue(cursor.GetBoolean(cursor.GetFirstFieldIndex()));
         Assert.IsTrue(cursor.MoveToNextRow());
         Assert.IsTrue(cursor.GetBoolean(cursor.GetFirstFieldIndex()));
     }
 }
예제 #5
0
        public void ExecuteQueryTest()
        {
            var tableName = "testingTable" + HelperObjectFactory.GetRandomInt(0);

            DatabaseWrapper.ExecuteSql($"CREATE TABLE {tableName}(a,b);");
            DatabaseWrapper.ExecuteSql($"INSERT INTO {tableName}(a,b) VALUES ('test0', 'test1');");

            using (var cursor = DatabaseWrapper.ExecuteQuery($"SELECT * FROM {tableName};"))
            {
                Assert.IsNotNull(cursor);
                Assert.IsNotNull(cursor.GetString(cursor.GetColumnIndex("a")));
                Assert.IsNotNull(cursor.GetString(cursor.GetColumnIndex("b")));
            }

            DatabaseWrapper.ExecuteSql($"DROP TABLE {tableName};");
        }