/// <summary>Set a parameter-less option on this database</summary>
        /// <param name="option">Option to set</param>
        public void SetOption(FdbDatabaseOption option)
        {
            ThrowIfDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", String.Format("Setting database option {0}", option.ToString()));
            }

            m_handler.SetOption(option, Slice.Nil);
        }
Beispiel #2
0
        /// <summary>Set a parameter-less option on this database</summary>
        /// <param name="option">Option to set</param>
        public void SetOption(FdbDatabaseOption option)
        {
            ThrowIfDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", $"Setting database option {option}");
            }

            m_handler.SetOption(option, Slice.Nil);
        }
        public void SetOption(FdbDatabaseOption option, Slice data)
        {
            Fdb.EnsureNotOnNetworkThread();

            unsafe
            {
                fixed(byte *ptr = data)
                {
                    Fdb.DieOnError(FdbNative.DatabaseSetOption(m_handle, option, ptr, data.Count));
                }
            }
        }
        public void SetOption(FdbDatabaseOption option, ReadOnlySpan <byte> data)
        {
            Fdb.EnsureNotOnNetworkThread();

            unsafe
            {
                fixed(byte *ptr = data)
                {
                    Fdb.DieOnError(FdbNative.DatabaseSetOption(m_handle, option, ptr, data.Length));
                }
            }
        }
Beispiel #5
0
        /// <summary>Set an option on this database that takes a string value</summary>
        /// <param name="option">Option to set</param>
        /// <param name="value">Value of the parameter (can be null)</param>
        public void SetOption(FdbDatabaseOption option, string value)
        {
            ThrowIfDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", $"Setting database option {option} to '{value ?? "<null>"}'");
            }

            var data = FdbNative.ToNativeString(value, nullTerminated: true);

            m_handler.SetOption(option, data);
        }
Beispiel #6
0
        /// <summary>Set an option on this database that takes an integer value</summary>
        /// <param name="option">Option to set</param>
        /// <param name="value">Value of the parameter</param>
        public void SetOption(FdbDatabaseOption option, long value)
        {
            ThrowIfDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", $"Setting database option {option} to {value}");
            }

            // Spec says: "If the option is documented as taking an Int parameter, value must point to a signed 64-bit integer (little-endian), and value_length must be 8."
            var data = Slice.FromFixed64(value);

            m_handler.SetOption(option, data);
        }
        /// <summary>Set an option on this database that takes an integer value</summary>
        /// <param name="option">Option to set</param>
        /// <param name="value">Value of the parameter</param>
        public void SetOption(FdbDatabaseOption option, long value)
        {
            ThrowIfDisposed();

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "SetOption", $"Setting database option {option} to {value}");
            }

            // Spec says: "If the option is documented as taking an Int parameter, value must point to a signed 64-bit integer (little-endian), and value_length must be 8."
            Span <byte> tmp = stackalloc byte[8];

            UnsafeHelpers.WriteFixed64(tmp, (ulong)value);
            m_handler.SetOption(option, tmp);
        }
		public void SetOption(FdbDatabaseOption option, Slice data)
		{
			Fdb.EnsureNotOnNetworkThread();

			unsafe
			{
				if (data.IsNull)
				{
					Fdb.DieOnError(FdbNative.DatabaseSetOption(m_handle, option, null, 0));
				}
				else
				{
					fixed (byte* ptr = data.Array)
					{
						Fdb.DieOnError(FdbNative.DatabaseSetOption(m_handle, option, ptr + data.Offset, data.Count));
					}
				}
			}
		}
        public void SetOption(FdbDatabaseOption option, Slice data)
        {
            Fdb.EnsureNotOnNetworkThread();

            unsafe
            {
                if (data.IsNull)
                {
                    Fdb.DieOnError(FdbNative.DatabaseSetOption(m_handle, option, null, 0));
                }
                else
                {
                    fixed(byte *ptr = data.Array)
                    {
                        Fdb.DieOnError(FdbNative.DatabaseSetOption(m_handle, option, ptr + data.Offset, data.Count));
                    }
                }
            }
        }
Beispiel #10
0
 public static FdbError DatabaseSetOption(DatabaseHandle database, FdbDatabaseOption option, byte *value, int valueLength)
 {
     return(NativeMethods.fdb_database_set_option(database, option, value, valueLength));
 }
Beispiel #11
0
 public static extern FdbError fdb_database_set_option(DatabaseHandle handle, FdbDatabaseOption option, byte *value, int valueLength);
 public virtual void SetOption(FdbDatabaseOption option, long value)
 {
     ThrowIfDisposed();
     m_database.SetOption(option, value);
 }
 public virtual void SetOption(FdbDatabaseOption option)
 {
     ThrowIfDisposed();
     m_database.SetOption(option);
 }
		public static FdbError DatabaseSetOption(DatabaseHandle database, FdbDatabaseOption option, byte* value, int valueLength)
		{
			return NativeMethods.fdb_database_set_option(database, option, value, valueLength);
		}
			public static extern FdbError fdb_database_set_option(DatabaseHandle handle, FdbDatabaseOption option, byte* value, int valueLength);