internal OracleColumn(OciStatementHandle statementHandle, int ordinal, OciErrorHandle errorHandle, OracleConnection connection) { this._ordinal = ordinal; this._describeHandle = statementHandle.GetDescriptor(this._ordinal, errorHandle); this._connection = connection; this._connectionCloseCount = connection.CloseCount; }
protected override DbSqlParserColumnCollection GatherTableColumns(DbSqlParserTable table) { OciStatementHandle stmtp = new OciStatementHandle(this._connection.ServiceContextHandle); OciErrorHandle errorHandle = this._connection.ErrorHandle; StringBuilder builder = new StringBuilder(); string schemaName = table.SchemaName; string tableName = table.TableName; DbSqlParserColumnCollection columns = new DbSqlParserColumnCollection(); builder.Append("select * from "); if (!System.Data.Common.ADP.IsEmpty(schemaName)) { builder.Append(schemaName); builder.Append("."); } builder.Append(tableName); string stmt = builder.ToString(); if ((TracedNativeMethods.OCIStmtPrepare(stmtp, errorHandle, stmt, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, this._connection) == 0) && (TracedNativeMethods.OCIStmtExecute(this._connection.ServiceContextHandle, stmtp, errorHandle, 0, OCI.MODE.OCI_DESCRIBE_ONLY) == 0)) { int num3; stmtp.GetAttribute(OCI.ATTR.OCI_ATTR_PARAM_COUNT, out num3, errorHandle); for (int i = 0; i < num3; i++) { string str; OciParameterDescriptor handle = stmtp.GetDescriptor(i, errorHandle); handle.GetAttribute(OCI.ATTR.OCI_ATTR_SQLCODE, out str, errorHandle, this._connection); OciHandle.SafeDispose(ref handle); str = this.QuotePrefixCharacter + str + this.QuoteSuffixCharacter; columns.Add(null, schemaName, tableName, str, null); } } OciHandle.SafeDispose(ref stmtp); return(columns); }