public static char? GetChar(DbDataReader reader, int index)
 {
     if (reader.IsDBNull(index))
         return null;
     else
         return reader.GetChar(index);
 }
Exemple #2
0
 static int GetChar(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Data.Common.DbDataReader obj = (System.Data.Common.DbDataReader)ToLua.CheckObject(L, 1, typeof(System.Data.Common.DbDataReader));
         int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         char o    = obj.GetChar(arg0);
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        private void mapValues(DbDataReader reader, object record)
        {
            foreach (var accessor in this.accessors) {
                var index = reader.GetOrdinal(accessor.Name);

                if (reader.IsDBNull(index)) {
                    continue;
                }

                if (accessor.PropertyType == typeof(string)) {
                    accessor.Set(record, reader.GetString(index));
                } else if (accessor.PropertyType == typeof(int) || accessor.PropertyType == typeof(int?)) {
                    accessor.Set(record, reader.GetInt32(index));
                } else if (accessor.PropertyType == typeof(long) || accessor.PropertyType == typeof(long?)) {
                    accessor.Set(record, reader.GetInt64(index));
                } else if (accessor.PropertyType == typeof(DateTime) || accessor.PropertyType == typeof(DateTime?)) {
                    accessor.Set(record, reader.GetDateTime(index));
                } else if (accessor.PropertyType == typeof(char) || accessor.PropertyType == typeof(char?)) {
                    accessor.Set(record, reader.GetChar(index));
                }
            }
        }