private bool _bindAsUCS2; // true whenever we're binding character data as Unicode... //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // // Constructors // //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // Construct by getting the specified describe handle from the specified statement handle internal OracleColumn( OciHandle statementHandle, int ordinal, OciHandle errorHandle, OracleConnection connection ) { _ordinal = ordinal; _describeHandle = statementHandle.GetDescriptor(_ordinal, errorHandle);; _connection = connection; _connectionCloseCount = connection.CloseCount; }
override protected DBSqlParserColumnCollection GatherTableColumns( DBSqlParserTable table ) { // Called to get a column list for the table specified. OciHandle statementHandle = _connection.EnvironmentHandle.CreateOciHandle(OCI.HTYPE.OCI_HTYPE_STMT); OciHandle errorHandle = _connection.ErrorHandle; StringBuilder sb = new StringBuilder(); string schemaName = table.SchemaName; string tableName = table.TableName; string columnName; int tableColumnCount; int rc; string tempStatement; DBSqlParserColumnCollection columns = new DBSqlParserColumnCollection(); Debug.Assert(string.Empty == table.DatabaseName, "oracle doesn't support 4 part names!"); sb.Append("select * from "); if (String.Empty != schemaName) { sb.Append(schemaName); sb.Append("."); } sb.Append(tableName); tempStatement = sb.ToString(); rc = TracedNativeMethods.OCIStmtPrepare( statementHandle, errorHandle, tempStatement, tempStatement.Length, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, _connection ); if (0 == rc) { rc = TracedNativeMethods.OCIStmtExecute( _connection.ServiceContextHandle, statementHandle, errorHandle, 0, // iters 0, // rowoff ADP.NullHandleRef, // snap_in ADP.NullHandleRef, // snap_out OCI.MODE.OCI_DESCRIBE_ONLY // mode ); if (0 == rc) { // Build the column list for the table statementHandle.GetAttribute(OCI.ATTR.OCI_ATTR_PARAM_COUNT, out tableColumnCount, errorHandle); for (int j = 0; j < tableColumnCount; j++) { OciHandle describeHandle = statementHandle.GetDescriptor(j, errorHandle); describeHandle.GetAttribute(OCI.ATTR.OCI_ATTR_NAME, out columnName, errorHandle, _connection); OciHandle.SafeDispose(ref describeHandle); columnName = QuotePrefixCharacter + columnName + QuoteSuffixCharacter; columns.Add(null, schemaName, tableName, columnName, null); } // Now, derive the key information for the statement and update the column list // with it. } } // Clean up and return; OciHandle.SafeDispose(ref statementHandle); return(columns); }