public override void DescribeParameters() { lock (this.db) { // Marshal structures to pointer XsqldaMarshaler marshaler = XsqldaMarshaler.GetInstance(); this.parameters = new Descriptor(1); IntPtr sqlda = marshaler.MarshalManagedToNative(this.db.Charset, parameters); int[] statusVector = FesConnection.GetNewStatusVector(); int stmtHandle = this.handle; FbClient.isc_dsql_describe_bind( statusVector, ref stmtHandle, IscCodes.SQLDA_VERSION1, sqlda); Descriptor descriptor = marshaler.MarshalNativeToManaged(this.db.Charset, sqlda); // Parse status vector this.db.ParseStatusVector(statusVector); if (descriptor.ActualCount != 0 && descriptor.Count != descriptor.ActualCount) { short n = descriptor.ActualCount; descriptor = new Descriptor(n); // Fre memory marshaler.CleanUpNativeData(ref sqlda); // Marshal new structure sqlda = marshaler.MarshalManagedToNative(this.db.Charset, descriptor); FbClient.isc_dsql_describe_bind( statusVector, ref stmtHandle, IscCodes.SQLDA_VERSION1, sqlda); descriptor = marshaler.MarshalNativeToManaged(this.db.Charset, sqlda); // Free memory marshaler.CleanUpNativeData(ref sqlda); // Parse status vector this.db.ParseStatusVector(statusVector); } else { if (descriptor.ActualCount == 0) { descriptor = new Descriptor(0); } } // Free memory if (sqlda != IntPtr.Zero) { marshaler.CleanUpNativeData(ref sqlda); } // Update parameter descriptor this.parameters = descriptor; } }