コード例 #1
0
 protected virtual void SendAttachToBuffer(DatabaseParameterBuffer dpb, string database)
 {
     XdrStream.Write(IscCodes.op_attach);
     XdrStream.Write(0);
     if (!string.IsNullOrEmpty(Password))
     {
         dpb.Append(IscCodes.isc_dpb_password, Password);
     }
     XdrStream.WriteBuffer(Encoding2.Default.GetBytes(database));
     XdrStream.WriteBuffer(dpb.ToArray());
 }
コード例 #2
0
        protected virtual void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database)
        {
            XdrStream.Write(IscCodes.op_create);
#warning Some constant for default database object ID
            XdrStream.Write(0);
            if (!string.IsNullOrEmpty(Password))
            {
                dpb.Append(IscCodes.isc_dpb_password, Password);
            }
            XdrStream.WriteBuffer(Encoding.Default.GetBytes(database));
            XdrStream.WriteBuffer(dpb.ToArray());
        }
コード例 #3
0
 protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database)
 {
     XdrStream.Write(IscCodes.op_create);
     XdrStream.Write(0);
     if (AuthData != null)
     {
         dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthData);
     }
     dpb.Append(IscCodes.isc_dpb_utf8_filename, 0);
     XdrStream.WriteBuffer(Encoding.UTF8.GetBytes(database));
     XdrStream.WriteBuffer(dpb.ToArray());
 }
コード例 #4
0
 protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database)
 {
     Xdr.Write(IscCodes.op_create);
     Xdr.Write(0);
     if (!string.IsNullOrEmpty(Password))
     {
         dpb.Append(IscCodes.isc_dpb_password, Password);
     }
     dpb.Append(IscCodes.isc_dpb_utf8_filename, 0);
     Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database));
     Xdr.WriteBuffer(dpb.ToArray());
 }
コード例 #5
0
        public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
            byte[] databaseBuffer = Encoding.UTF8.GetBytes(database);

            ClearStatusVector();

            _fbClient.isc_attach_database(
                _statusVector,
                (short)databaseBuffer.Length,
                databaseBuffer,
                ref _handle,
                dpb.Length,
                dpb.ToArray());

            ProcessStatusVector(_statusVector);

            _serverVersion = GetServerVersion();
        }
コード例 #6
0
        public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
            byte[] databaseBuffer = Encoding.UTF8.GetBytes(database);

            ClearStatusVector();

            _fbClient.isc_create_database(
                _statusVector,
                (short)databaseBuffer.Length,
                databaseBuffer,
                ref _handle,
                dpb.Length,
                dpb.ToArray(),
                0);

            ProcessStatusVector(_statusVector);

            Detach();
        }
コード例 #7
0
ファイル: GdsDatabase.cs プロジェクト: raj581/Marvin
        public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
            lock (this)
            {
                try
                {
                    this.connection.Connect(dataSource, port, this.packetSize, this.charset);

                    this.Identify(database);

                    this.Send.Write(IscCodes.op_attach);
                    this.Send.Write((int)0);                                    // Database	object ID
                    this.Send.Write(database);                                  // Database	PATH
                    this.Send.WriteBuffer(dpb.ToArray());                       // DPB Parameter buffer
                    this.Send.Flush();

                    try
                    {
                        this.handle = this.ReadGenericResponse().ObjectHandle;
                    }
                    catch (IscException)
                    {
                        try
                        {
                            this.connection.Disconnect();
                        }
                        catch
                        {
                        }
                        throw;
                    }
                }
                catch (IOException)
                {
                    this.connection.Disconnect();

                    throw new IscException(IscCodes.isc_net_write_err);
                }

                // Get server version
                this.serverVersion = this.GetServerVersion();
            }
        }
コード例 #8
0
        public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database, byte[] cryptKey)
        {
            CheckCryptKeyForSupport(cryptKey);

            var databaseBuffer = Encoding2.Default.GetBytes(database);

            ClearStatusVector();

            _fbClient.isc_create_database(
                _statusVector,
                (short)databaseBuffer.Length,
                databaseBuffer,
                ref _handle,
                dpb.Length,
                dpb.ToArray(),
                0);

            ProcessStatusVector(_statusVector);
        }
コード例 #9
0
        public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database, byte[] cryptKey)
        {
            CheckCryptKeyForSupport(cryptKey);

            var databaseBuffer = Encoding.Default.GetBytes(database);

            ClearStatusVector();

            _fbClient.isc_attach_database(
                _statusVector,
                (short)databaseBuffer.Length,
                databaseBuffer,
                ref _handle,
                dpb.Length,
                dpb.ToArray());

            ProcessStatusVector(_statusVector);

            _serverVersion = GetServerVersion();
        }
コード例 #10
0
ファイル: FesDatabase.cs プロジェクト: raj581/Marvin
        public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
            lock (this)
            {
                int[] statusVector = FesConnection.GetNewStatusVector();
                int   dbHandle     = 0;

                FbClient.isc_attach_database(
                    statusVector,
                    (short)database.Length,
                    database,
                    ref dbHandle,
                    (short)dpb.Length,
                    dpb.ToArray());

                this.handle = dbHandle;

                this.ParseStatusVector(statusVector);

                // Get server version
                this.serverVersion = this.GetServerVersion();
            }
        }
コード例 #11
0
ファイル: FesDatabase.cs プロジェクト: raj581/Marvin
        public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
            lock (this)
            {
                int[] statusVector = FesConnection.GetNewStatusVector();
                int   dbHandle     = this.Handle;

                FbClient.isc_create_database(
                    statusVector,
                    (short)database.Length,
                    database,
                    ref dbHandle,
                    (short)dpb.Length,
                    dpb.ToArray(),
                    0);

                this.ParseStatusVector(statusVector);

                this.handle = dbHandle;

                this.Detach();
            }
        }
コード例 #12
0
ファイル: GdsDatabase.cs プロジェクト: raj581/Marvin
        public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int port, string database)
        {
            lock (this)
            {
                try
                {
                    this.connection.Connect(dataSource, port, this.packetSize, this.charset);
                    this.Send.Write(IscCodes.op_create);
                    this.Send.Write((int)0);
                    this.Send.Write(database);
                    this.Send.WriteBuffer(dpb.ToArray());
                    this.Send.Flush();

                    try
                    {
                        this.handle = this.ReadGenericResponse().ObjectHandle;
                        this.Detach();
                    }
                    catch (IscException)
                    {
                        try
                        {
                            this.connection.Disconnect();
                        }
                        catch (Exception)
                        {
                        }

                        throw;
                    }
                }
                catch (IOException)
                {
                    throw new IscException(IscCodes.isc_net_write_err);
                }
            }
        }
コード例 #13
0
ファイル: FesDatabase.cs プロジェクト: stevedrake/NETProvider
        public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, string database, byte[] cryptKey)
        {
            // ICryptKeyCallbackImpl would have to be passed from C# for 'cryptKey' passing
            if (cryptKey?.Length > 0)
            {
                throw new NotSupportedException("Passing Encryption Key isn't, yet, supported on Firebird Embedded.");
            }

            byte[] databaseBuffer = Encoding2.Default.GetBytes(database);

            ClearStatusVector();

            _fbClient.isc_attach_database(
                _statusVector,
                (short)databaseBuffer.Length,
                databaseBuffer,
                ref _handle,
                dpb.Length,
                dpb.ToArray());

            ProcessStatusVector(_statusVector);

            _serverVersion = GetServerVersion();
        }