示例#1
0
        public void BeginTransaction(TransactionParameterBuffer tpb)
        {
            lock (this.db)
            {
                if (this.state != TransactionState.NoTransaction)
                {
                    throw new IscException(
                              IscCodes.isc_arg_gds,
                              IscCodes.isc_tra_state,
                              this.handle,
                              "no valid");
                }

                this.state = TransactionState.TrasactionStarting;

                try
                {
                    this.db.Send.Write(IscCodes.op_transaction);
                    this.db.Send.Write(this.db.Handle);
                    this.db.Send.WriteBuffer(tpb.ToArray());
                    this.db.Send.Flush();

                    this.handle = db.ReadGenericResponse().ObjectHandle;
                    this.state  = TransactionState.TransactionStarted;

                    this.db.TransactionCount++;
                }
                catch (IOException)
                {
                    throw new IscException(IscCodes.isc_net_read_err);
                }
            }
        }
示例#2
0
        protected override void Seek(int position)
        {
            lock (this.db)
            {
                try
                {
                    this.db.Send.Write(IscCodes.op_seek_blob);
                    this.db.Send.Write(this.blobHandle);
                    this.db.Send.Write(0);                                              // Seek	mode
                    this.db.Send.Write(position);                                       // Seek	offset
                    this.db.Send.Flush();

                    GdsResponse r = db.ReadGenericResponse();

                    this.position = r.ObjectHandle;
                }
                catch (IOException)
                {
                    throw new IscException(IscCodes.isc_network_error);
                }
            }
        }