GetBoolean() public méthode

Retrieves the column as a boolean value
public GetBoolean ( int i ) : bool
i int The index of the column to retrieve
Résultat bool
Exemple #1
0
 static int GetBoolean(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Mono.Data.Sqlite.SqliteDataReader obj = (Mono.Data.Sqlite.SqliteDataReader)ToLua.CheckObject(L, 1, typeof(Mono.Data.Sqlite.SqliteDataReader));
         int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         bool o    = obj.GetBoolean(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
		/// <summary>
		/// A helper function that takes the current row from the SqliteDataReader
		/// and hydrates a MembershipUser from the values. Called by the 
		/// MembershipUser.GetUser implementation.
		/// </summary>
		/// <param name="reader">SqliteDataReader object</param>
		/// <returns>MembershipUser object</returns>
		MembershipUser GetUserFromReader(SqliteDataReader reader)
		{
			object providerUserKey = reader.GetValue(0);
			string username = reader.GetString(1);
			string email = string.Empty;
			if (!reader.IsDBNull(2))
				email = reader.GetString(2);

			string passwordQuestion = string.Empty;
			if (!reader.IsDBNull(3))
				passwordQuestion = reader.GetString(3);
			
			string comment = string.Empty;
			if (!reader.IsDBNull(4))
				comment = reader.GetString(4);

			bool isApproved = reader.GetBoolean(5);
			bool isLockedOut = reader.GetBoolean(6);
			DateTime creationDate = reader.GetDateTime(7);

			DateTime lastLoginDate = new DateTime();
			if (!reader.IsDBNull(8))
				lastLoginDate = reader.GetDateTime(8);

			DateTime lastActivityDate = reader.GetDateTime(9);
			DateTime lastPasswordChangedDate = reader.GetDateTime(10);

			DateTime lastLockedOutDate = new DateTime();
			if (!reader.IsDBNull(11))
				lastLockedOutDate = reader.GetDateTime(11);

			MembershipUser u = new MembershipUser(this.Name,
												  username,
												  providerUserKey,
												  email,
												  passwordQuestion,
												  comment,
												  isApproved,
												  isLockedOut,
												  creationDate,
												  lastLoginDate,
												  lastActivityDate,
												  lastPasswordChangedDate,
												  lastLockedOutDate);
			
			return u;
		}
        X509CrlRecord LoadCrlRecord(SqliteDataReader reader, X509CrlParser parser, ref byte[] buffer)
        {
            var record = new X509CrlRecord ();

            for (int i = 0; i < reader.FieldCount; i++) {
                switch (reader.GetName (i)) {
                case "CRL":
                    record.Crl = DecodeX509Crl (reader, parser, i, ref buffer);
                    break;
                case "THISUPDATE":
                    record.ThisUpdate = reader.GetDateTime (i);
                    break;
                case "NEXTUPDATE":
                    record.NextUpdate = reader.GetDateTime (i);
                    break;
                case "DELTA":
                    record.IsDelta = reader.GetBoolean (i);
                    break;
                case "ID":
                    record.Id = reader.GetInt32 (i);
                    break;
                }
            }

            return record;
        }
        //
        // GetUserFromReader
        //    A helper function that takes the current row from the SQLiteDataReader
        // and hydrates a MembershipUser from the values. Called by the
        // MembershipUser.GetUser implementation.
        //
        private MembershipUser GetUserFromReader(SqliteDataReader reader)
        {
            if (reader.GetString(1)=="") return null;
            object providerUserKey=null;
            string strGooid=Guid.NewGuid().ToString();
            if (reader.GetValue(0).ToString().Length > 0)
                providerUserKey = new Guid(reader.GetValue(0).ToString());
            else
                providerUserKey = new Guid(strGooid);
            string username = reader.GetString(1);
            string email = reader.GetString(2);

            string passwordQuestion = "";
            if (reader.GetValue(3) != DBNull.Value)
                passwordQuestion = reader.GetString(3);

            string comment = "";
            if (reader.GetValue(4) != DBNull.Value)
                comment = reader.GetString(4);

            bool tmpApproved = (reader.GetValue(5) == null);
             bool isApproved=false;
            if(tmpApproved)
            isApproved = reader.GetBoolean(5);

            bool tmpLockedOut = (reader.GetValue(6) == null);
            bool isLockedOut = false;
            if(tmpLockedOut)
            isLockedOut = reader.GetBoolean(6);

            DateTime creationDate = DateTime.Now;
            try
            {
                if (reader.GetValue(6) != DBNull.Value)
                    creationDate = reader.GetDateTime(7);
            }
            catch { }

            DateTime lastLoginDate = DateTime.Now;
            try
            {
                if (reader.GetValue(8) != DBNull.Value)
                    lastLoginDate = reader.GetDateTime(8);
            }
            catch { }

            DateTime lastActivityDate = DateTime.Now;
            try
            {
                if (reader.GetValue(9) != DBNull.Value)
                    lastActivityDate = reader.GetDateTime(9);
            }
            catch { }
            DateTime lastPasswordChangedDate = DateTime.Now;
            try
            {
                if (reader.GetValue(10) != DBNull.Value)
                    lastPasswordChangedDate = reader.GetDateTime(10);
            }
            catch { }

            DateTime lastLockedOutDate = DateTime.Now;
            try
            {
                if (reader.GetValue(11) != DBNull.Value)
                    lastLockedOutDate = reader.GetDateTime(11);
            }
            catch { }

            MembershipUser u = new MembershipUser(this.Name,
                                                  username,
                                                  providerUserKey,
                                                  email,
                                                  passwordQuestion,
                                                  comment,
                                                  isApproved,
                                                  isLockedOut,
                                                  creationDate,
                                                  lastLoginDate,
                                                  lastActivityDate,
                                                  lastPasswordChangedDate,
                                                  lastLockedOutDate);

            return u;
        }
        X509CertificateRecord LoadCertificateRecord(SqliteDataReader reader, X509CertificateParser parser, ref byte[] buffer)
        {
            var record = new X509CertificateRecord ();

            for (int i = 0; i < reader.FieldCount; i++) {
                switch (reader.GetName (i)) {
                case "CERTIFICATE":
                    record.Certificate = DecodeCertificate (reader, parser, i, ref buffer);
                    break;
                case "PRIVATEKEY":
                    record.PrivateKey = DecodePrivateKey (reader, i, ref buffer);
                    break;
                case "ALGORITHMS":
                    record.Algorithms = DecodeEncryptionAlgorithms (reader, i);
                    break;
                case "ALGORITHMSUPDATED":
                    record.AlgorithmsUpdated = reader.GetDateTime (i);
                    break;
                case "TRUSTED":
                    record.IsTrusted = reader.GetBoolean (i);
                    break;
                case "ID":
                    record.Id = reader.GetInt32 (i);
                    break;
                }
            }

            return record;
        }