static OracleTestDatabaseModel() { #region object synonyms var synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, TableNameDual), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, TableNameDual) && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); /*synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "SYNONYM_TO_HQ_PDB_LOOPBACK"), SchemaObject = DatabaseLinksInternal.Single(o => String.Equals(o.Name, "\"HQ_PDB_LOOPBACK\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym);*/ AllObjectsInternal.Add(synonym); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "V$SESSION"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"V_$SESSION\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "XMLTYPE"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"XMLTYPE\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(InitialSchema, "SYNONYM_TO_TEST_SEQ"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"TEST_SEQ\"") && String.Equals(o.Owner, InitialSchema)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(InitialSchema, "SYNONYM_TO_SELECTION"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"SELECTION\"") && String.Equals(o.Owner, InitialSchema)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "PUBLIC_SYNONYM_TO_SELECTION"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"SELECTION\"") && String.Equals(o.Owner, InitialSchema)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(InitialSchema, "RAWLIST"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"ODCIRAWLIST\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region SYS.DBMS_RANDOM var dbmsRandom = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, OracleObjectIdentifier.PackageDbmsRandom) && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)); var randomStringFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierDbmsRandomString, false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); randomStringFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); randomStringFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"OPT\"", 1, 1, 0, ParameterDirection.Input, "CHAR", OracleObjectIdentifier.Empty, false)); randomStringFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LEN\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); randomStringFunctionMetadata.Owner = dbmsRandom; dbmsRandom.Programs.Add(randomStringFunctionMetadata); var randomNormalFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(OracleObjectIdentifier.SchemaSys, OracleObjectIdentifier.PackageDbmsRandom, "NORMAL"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); randomNormalFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); randomNormalFunctionMetadata.Owner = dbmsRandom; dbmsRandom.Programs.Add(randomNormalFunctionMetadata); var randomValueFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(OracleObjectIdentifier.SchemaSys, OracleObjectIdentifier.PackageDbmsRandom, "VALUE"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); randomValueFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); randomValueFunctionMetadata.Owner = dbmsRandom; dbmsRandom.Programs.Add(randomValueFunctionMetadata); var randomValueTwoParameterFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(OracleObjectIdentifier.SchemaSys, OracleObjectIdentifier.PackageDbmsRandom, "VALUE"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); randomValueTwoParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); randomValueTwoParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LOW\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); randomValueTwoParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"HIGH\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); randomValueTwoParameterFunctionMetadata.Owner = dbmsRandom; dbmsRandom.Programs.Add(randomValueTwoParameterFunctionMetadata); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "DBMS_RANDOM"), SchemaObject = dbmsRandom, IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region SYS.DBMS_XPLAN var dbmsXPlan = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"DBMS_XPLAN\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)); var displayCursorFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "DBMS_XPLAN", "DISPLAY_CURSOR"), false, false, true, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, false); displayCursorFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, OracleTypeCollection.OracleCollectionTypeNestedTable, OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaSys, "DBMS_XPLAN_TYPE_TABLE"), false)); displayCursorFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 1, 1, 1, ParameterDirection.ReturnValue, OracleTypeBase.TypeCodeObject, OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaSys, "DBMS_XPLAN_TYPE"), false)); displayCursorFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"SQL_ID\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, true)); displayCursorFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"CURSOR_CHILD_NUMBER\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, true)); displayCursorFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"FORMAT\"", 3, 3, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, true)); displayCursorFunctionMetadata.Owner = dbmsXPlan; dbmsXPlan.Programs.Add(displayCursorFunctionMetadata); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "DBMS_XPLAN"), SchemaObject = dbmsXPlan, IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region SYS.DBMS_CRYPTO var dbmsCrypto = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"DBMS_CRYPTO\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)); var randomBytesFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "DBMS_CRYPTO", "RANDOMBYTES"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); randomBytesFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Raw, OracleObjectIdentifier.Empty, false)); randomBytesFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"NUMBER_BYTES\"", 1, 1, 0, ParameterDirection.Input, "BINARY_INTEGER", OracleObjectIdentifier.Empty, false)); randomBytesFunctionMetadata.Owner = dbmsCrypto; dbmsCrypto.Programs.Add(randomBytesFunctionMetadata); var dbmsCryptoHashMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "DBMS_CRYPTO", "HASH"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); dbmsCryptoHashMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Raw, OracleObjectIdentifier.Empty, false)); dbmsCryptoHashMetadata.AddParameter(new OracleProgramParameterMetadata("\"SRC\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Raw, OracleObjectIdentifier.Empty, false)); dbmsCryptoHashMetadata.AddParameter(new OracleProgramParameterMetadata("\"TYP\"", 2, 2, 0, ParameterDirection.Input, "BINARY_INTEGER", OracleObjectIdentifier.Empty, false)); dbmsCryptoHashMetadata.Owner = dbmsCrypto; dbmsCrypto.Programs.Add(dbmsCryptoHashMetadata); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "DBMS_CRYPTO"), SchemaObject = dbmsCrypto, IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region SYS.DBMS_OUTPUT var dbmsOutput = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"DBMS_OUTPUT\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)); var putLineProcedureMetadata = new OracleProgramMetadata(ProgramType.Procedure, OracleProgramIdentifier.CreateFromValues("SYS", "DBMS_OUTPUT", "PUT_LINE"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); putLineProcedureMetadata.AddParameter(new OracleProgramParameterMetadata("\"A\"", 1, 1, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, false)); putLineProcedureMetadata.Owner = dbmsOutput; dbmsOutput.Programs.Add(putLineProcedureMetadata); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "DBMS_OUTPUT"), SchemaObject = dbmsOutput, IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region SYS.DBMS_METADATA var dbmsMetadata = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"DBMS_METADATA\"") && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)); var getDdlFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "DBMS_METADATA", "GET_DDL"), false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, false); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 1, 0, ParameterDirection.ReturnValue, "CLOB", OracleObjectIdentifier.Empty, false)); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"OBJECT_TYPE\"", 1, 2, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, false)); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"NAME\"", 2, 3, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, false)); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"SCHEMA\"", 3, 4, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, true)); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"VERSION\"", 4, 5, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, true)); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"MODEL\"", 5, 6, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, true)); getDdlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"TRANSFORM\"", 6, 7, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, true)); getDdlFunctionMetadata.Owner = dbmsMetadata; dbmsMetadata.Programs.Add(getDdlFunctionMetadata); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, "DBMS_METADATA"), SchemaObject = dbmsMetadata, IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region SYS.STANDARD var builtInFunctionPackage = (OraclePackage)AllObjectsInternal.Single(o => o.FullyQualifiedName == OracleObjectIdentifier.IdentifierBuiltInFunctionPackage); var truncFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramTrunc, false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); truncFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); truncFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); truncFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"RIGHT\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); truncFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(truncFunctionMetadata); var toCharFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramToChar, false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); toCharFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toCharFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); toCharFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(toCharFunctionMetadata); var sysContextFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramSysContext, false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); sysContextFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); sysContextFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"NAMESPACE\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); sysContextFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"ATTRIBUTE\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); sysContextFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(sysContextFunctionMetadata); var toCharWithNlsParameterFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(OracleObjectIdentifier.SchemaSys, OracleObjectIdentifier.PackageBuiltInFunction, "TO_CHAR", 1), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); toCharWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toCharWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); toCharWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"FORMAT\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toCharWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"PARMS\"", 3, 3, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toCharWithNlsParameterFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(toCharWithNlsParameterFunctionMetadata); var toDateWithNlsParameterFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(OracleObjectIdentifier.SchemaSys, OracleObjectIdentifier.PackageBuiltInFunction, "TO_DATE", 1), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); toDateWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); toDateWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toDateWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"FORMAT\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toDateWithNlsParameterFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"PARMS\"", 3, 3, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); toDateWithNlsParameterFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(toDateWithNlsParameterFunctionMetadata); var roundFunctionOverload1Metadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramRound, false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); roundFunctionOverload1Metadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); roundFunctionOverload1Metadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); roundFunctionOverload1Metadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(roundFunctionOverload1Metadata); var roundFunctionOverload2Metadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "ROUND", 2), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); roundFunctionOverload2Metadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); roundFunctionOverload2Metadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); roundFunctionOverload2Metadata.AddParameter(new OracleProgramParameterMetadata("\"RIGHT\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); roundFunctionOverload2Metadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(roundFunctionOverload2Metadata); var convertFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramConvert, false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); convertFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); convertFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"SRC\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); convertFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"DESTCSET\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); convertFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"SRCCSET\"", 3, 3, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); convertFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(convertFunctionMetadata); var dumpFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "DUMP"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); dumpFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(dumpFunctionMetadata); var coalesceFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "COALESCE"), false, false, false, true, false, false, 2, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); coalesceFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(coalesceFunctionMetadata); var greatestFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "GREATEST"), false, false, false, true, false, false, 2, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); greatestFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(greatestFunctionMetadata); var noParenthesisFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "SESSIONTIMEZONE"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNoParenthesis, true); noParenthesisFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(noParenthesisFunctionMetadata); var reservedWordFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "ROWNUM"), false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); reservedWordFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); reservedWordFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(reservedWordFunctionMetadata); var levelFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramLevel, false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); levelFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); levelFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(levelFunctionMetadata); var nvlFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "NVL"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); nvlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); nvlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"B1\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); nvlFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"B2\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); nvlFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(nvlFunctionMetadata); var hexToRawFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "HEXTORAW"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); hexToRawFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Raw, OracleObjectIdentifier.Empty, false)); hexToRawFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"C\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); hexToRawFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(hexToRawFunctionMetadata); var upperFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "UPPER"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); upperFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); upperFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"CH\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); upperFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(upperFunctionMetadata); var sysGuidFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "SYS_GUID"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeParenthesis, true); sysGuidFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Raw, OracleObjectIdentifier.Empty, false)); sysGuidFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(sysGuidFunctionMetadata); var nextDayFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "STANDARD", "NEXT_DAY"), false, false, false, true, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeParenthesis, true); nextDayFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); nextDayFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"LEFT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); nextDayFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"RIGHT\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); nextDayFunctionMetadata.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(nextDayFunctionMetadata); var numberToYearToMonthInterval = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramNumberToYearToMonthInterval, false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeParenthesis, true); numberToYearToMonthInterval.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, BuiltInDataTypeIntervalYearToMonth, OracleObjectIdentifier.Empty, false)); numberToYearToMonthInterval.AddParameter(new OracleProgramParameterMetadata("\"NUMERATOR\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); numberToYearToMonthInterval.AddParameter(new OracleProgramParameterMetadata("\"UNITS\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); numberToYearToMonthInterval.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(numberToYearToMonthInterval); var numberToDayToSecondInterval = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramNumberToDayToSecondInterval, false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeParenthesis, true); numberToDayToSecondInterval.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, BuiltInDataTypeIntervalYearToMonth, OracleObjectIdentifier.Empty, false)); numberToDayToSecondInterval.AddParameter(new OracleProgramParameterMetadata("\"NUMERATOR\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); numberToDayToSecondInterval.AddParameter(new OracleProgramParameterMetadata("\"UNITS\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); numberToDayToSecondInterval.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(numberToDayToSecondInterval); var exists = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramExists, false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeParenthesis, true); exists.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, OracleDataType.PlSqlBooleanType.FullyQualifiedName.Name, OracleObjectIdentifier.Empty, false)); exists.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(exists); var regexReplace = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramRegularExpressionReplace, false, false, false, true, false, false, 2, 6, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); regexReplace.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); regexReplace.AddParameter(new OracleProgramParameterMetadata("\"SRCSTR\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); regexReplace.AddParameter(new OracleProgramParameterMetadata("\"PATTERN\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); regexReplace.AddParameter(new OracleProgramParameterMetadata("\"REPLACESTR\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); regexReplace.AddParameter(new OracleProgramParameterMetadata("\"POSITION\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.BinaryInteger, OracleObjectIdentifier.Empty, false)); regexReplace.AddParameter(new OracleProgramParameterMetadata("\"OCCURENCE\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.BinaryInteger, OracleObjectIdentifier.Empty, false)); regexReplace.AddParameter(new OracleProgramParameterMetadata("\"MODIFIER\"", 2, 2, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); regexReplace.Owner = builtInFunctionPackage; builtInFunctionPackage.Programs.Add(regexReplace); #endregion #region SYS.UTL_HTTP var utlHttp = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, OracleObjectIdentifier.PackageUtlHttp) && String.Equals(o.Owner, OracleObjectIdentifier.SchemaSys)); var beginRequestFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues("SYS", "UTL_HTTP", "BEGIN_REQUEST"), false, false, false, false, false, false, null, null, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, false); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 1, 0, ParameterDirection.ReturnValue, null, OracleObjectIdentifier.Empty, false)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"URL\"", 1, 2, 1, ParameterDirection.Output, "VARCHAR2", OracleObjectIdentifier.Empty, false)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"METHOD\"", 2, 3, 1, ParameterDirection.Output, "VARCHAR2", OracleObjectIdentifier.Empty, false)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"HTTP_VERSION\"", 3, 4, 1, ParameterDirection.Output, "VARCHAR2", OracleObjectIdentifier.Empty, false)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"PRIVATE_HNDL\"", 4, 5, 1, ParameterDirection.Output, "BINARY_INTEGER", OracleObjectIdentifier.Empty, false)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"URL\"", 1, 6, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, false)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"METHOD\"", 2, 7, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, true)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"HTTP_VERSION\"", 3, 8, 0, ParameterDirection.Input, "VARCHAR2", OracleObjectIdentifier.Empty, true)); beginRequestFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"REQUEST_CONTEXT\"", 4, 9, 0, ParameterDirection.Input, "BINARY_INTEGER", OracleObjectIdentifier.Empty, true)); beginRequestFunctionMetadata.Owner = utlHttp; utlHttp.Programs.Add(beginRequestFunctionMetadata); synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaPublic, OracleObjectIdentifier.PackageUtlHttp), SchemaObject = utlHttp, IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); #endregion #region user functions var uncompilableFunction = (OracleFunction)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"UNCOMPILABLE_FUNCTION\"") && String.Equals(o.Owner, InitialSchema)); uncompilableFunction.Metadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), null, "UNCOMPILABLE_FUNCTION"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); uncompilableFunction.Metadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); uncompilableFunction.Metadata.Owner = uncompilableFunction; var uncompilablePackage = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"UNCOMPILABLE_PACKAGE\"") && String.Equals(o.Owner, InitialSchema)); var uncompilablePackageFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), "UNCOMPILABLE_PACKAGE", "FUNCTION"), false, false, false, false, true, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); uncompilablePackageFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); uncompilablePackage.Programs.Add(uncompilablePackageFunctionMetadata); uncompilablePackageFunctionMetadata.Owner = uncompilablePackage; var userCountFunction = (OracleFunction)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"COUNT\"") && String.Equals(o.Owner, InitialSchema)); userCountFunction.Metadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), null, "COUNT"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); userCountFunction.Metadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); userCountFunction.Metadata.Owner = userCountFunction; var sqlPadProcedure = (OracleProcedure)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"SQLPAD_PROCEDURE\"") && String.Equals(o.Owner, InitialSchema)); sqlPadProcedure.Metadata = new OracleProgramMetadata(ProgramType.Procedure, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), null, "SQLPAD_PROCEDURE"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); sqlPadProcedure.Metadata.Owner = sqlPadProcedure; var sqlPadFunction = (OracleFunction)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"SQLPAD_FUNCTION\"") && String.Equals(o.Owner, InitialSchema)); sqlPadFunction.Metadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), null, "SQLPAD_FUNCTION"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); sqlPadFunction.Metadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); sqlPadFunction.Metadata.Owner = sqlPadFunction; synonym = new OracleSynonym { FullyQualifiedName = OracleObjectIdentifier.Create(InitialSchema, "SYNONYM_TO_SQLPAD_FUNCTION"), SchemaObject = AllObjectsInternal.Single(o => String.Equals(o.Name, "\"SQLPAD_FUNCTION\"") && String.Equals(o.Owner, InitialSchema)), IsValid = true }; synonym.SchemaObject.Synonyms.Add(synonym); AllObjectsInternal.Add(synonym); var testFunction = (OracleFunction)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"TESTFUNC\"") && String.Equals(o.Owner, InitialSchema)); testFunction.Metadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), null, "TESTFUNC"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); testFunction.Metadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); testFunction.Metadata.AddParameter(new OracleProgramParameterMetadata("\"PARAM\"", 1, 1, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); testFunction.Metadata.Owner = testFunction; var sqlPadPackage = (OraclePackage)AllObjectsInternal.Single(o => String.Equals(o.Name, "\"SQLPAD\"") && String.Equals(o.Owner, InitialSchema)); var packageSqlPadFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), "SQLPAD", "SQLPAD_FUNCTION"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); packageSqlPadFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); packageSqlPadFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"P\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); packageSqlPadFunctionMetadata.Owner = sqlPadPackage; sqlPadPackage.Programs.Add(packageSqlPadFunctionMetadata); var packageSqlPadPipelinedFunctionWithCursorParameterMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), "SQLPAD", "CURSOR_FUNCTION"), false, false, true, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); packageSqlPadPipelinedFunctionWithCursorParameterMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 1, 0, ParameterDirection.ReturnValue, OracleTypeCollection.OracleCollectionTypeNestedTable, OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaSys, "DBMS_XPLAN_TYPE_TABLE"), false)); packageSqlPadPipelinedFunctionWithCursorParameterMetadata.AddParameter(new OracleProgramParameterMetadata(null, 1, 2, 1, ParameterDirection.ReturnValue, OracleTypeBase.TypeCodeObject, OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaSys, "DBMS_XPLAN_TYPE"), false)); packageSqlPadPipelinedFunctionWithCursorParameterMetadata.AddParameter(new OracleProgramParameterMetadata("\"I\"", 1, 3, 0, ParameterDirection.Input, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); packageSqlPadPipelinedFunctionWithCursorParameterMetadata.AddParameter(new OracleProgramParameterMetadata("\"C1\"", 2, 4, 0, ParameterDirection.Input, "REF CURSOR", OracleObjectIdentifier.Empty, false)); packageSqlPadPipelinedFunctionWithCursorParameterMetadata.AddParameter(new OracleProgramParameterMetadata("\"C2\"", 3, 28, 0, ParameterDirection.Input, "REF CURSOR", OracleObjectIdentifier.Empty, false)); packageSqlPadPipelinedFunctionWithCursorParameterMetadata.Owner = sqlPadPackage; sqlPadPackage.Programs.Add(packageSqlPadPipelinedFunctionWithCursorParameterMetadata); var packageSqlPadPipelinedFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), "SQLPAD", "PIPELINED_FUNCTION"), false, false, true, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); packageSqlPadPipelinedFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, OracleTypeCollection.OracleCollectionTypeNestedTable, OracleObjectIdentifier.Create(OracleObjectIdentifier.SchemaSys, "ODCIDATELIST"), false)); packageSqlPadPipelinedFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 1, 1, 1, ParameterDirection.ReturnValue, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); packageSqlPadPipelinedFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"DATE_FROM\"", 1, 2, 0, ParameterDirection.Input, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); packageSqlPadPipelinedFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"DATE_TO\"", 2, 3, 0, ParameterDirection.Input, TerminalValues.Date, OracleObjectIdentifier.Empty, false)); packageSqlPadPipelinedFunctionMetadata.Owner = sqlPadPackage; sqlPadPackage.Programs.Add(packageSqlPadPipelinedFunctionMetadata); var sqlPadProcedureMetadata = new OracleProgramMetadata(ProgramType.Procedure, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), null, "SQLPAD_PROCEDURE"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); sqlPadProcedureMetadata.Owner = sqlPadPackage; sqlPadPackage.Programs.Add(sqlPadProcedureMetadata); var asPdfPackage = (OraclePackage)AllObjectsInternal.Single(o => o.Name == "\"AS_PDF3\"" && o.Owner == InitialSchema); var asPdfPackageFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(InitialSchema.ToSimpleIdentifier(), "AS_PDF3", "STR_LEN"), false, false, false, false, false, false, null, null, AuthId.Definer, OracleProgramMetadata.DisplayTypeNormal, false); asPdfPackageFunctionMetadata.AddParameter(new OracleProgramParameterMetadata(null, 0, 0, 0, ParameterDirection.ReturnValue, TerminalValues.Number, OracleObjectIdentifier.Empty, false)); asPdfPackageFunctionMetadata.AddParameter(new OracleProgramParameterMetadata("\"P_TXT\"", 1, 1, 0, ParameterDirection.Input, TerminalValues.Varchar2, OracleObjectIdentifier.Empty, false)); asPdfPackage.Programs.Add(asPdfPackageFunctionMetadata); asPdfPackageFunctionMetadata.Owner = asPdfPackage; #endregion AllObjectDictionary = AllObjectsInternal.ToDictionary(o => o.FullyQualifiedName, o => o); ObjectsInternal = AllObjectDictionary .Values.Where(o => o.Owner == OracleObjectIdentifier.SchemaPublic || o.Owner == InitialSchema) .ToDictionary(o => OracleObjectIdentifier.Create(o.Owner, o.Name), o => o); AddConstraints(); #region non-schema built-in functions var allProgramMetadata = AllObjectsInternal.OfType<IProgramCollection>().SelectMany(c => c.Programs).ToList(); var countFunctionAggregateMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(null, null, "COUNT"), false, true, false, false, false, false, 1, 1, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); countFunctionAggregateMetadata.AddParameter(new OracleProgramParameterMetadata(null, 1, 1, 0, ParameterDirection.Input, "EXPR", OracleObjectIdentifier.Empty, false)); allProgramMetadata.Add(countFunctionAggregateMetadata); var countFunctionAnalyticMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(null, null, "COUNT"), true, false, false, false, false, false, 1, 1, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); countFunctionAnalyticMetadata.AddParameter(new OracleProgramParameterMetadata(null, 1, 1, 0, ParameterDirection.Input, "EXPR", OracleObjectIdentifier.Empty, false)); allProgramMetadata.Add(countFunctionAnalyticMetadata); var maxFunctionAnalyticMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(null, null, "MAX"), true, false, false, false, false, false, 1, 1, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); allProgramMetadata.Add(maxFunctionAnalyticMetadata); var castFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramCast, false, false, false, true, false, false, 1, 0, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); allProgramMetadata.Add(castFunctionMetadata); var maxFunctionAggregateMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(null, null, "MAX"), false, true, false, false, false, false, 1, 1, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); maxFunctionAggregateMetadata.AddParameter(new OracleProgramParameterMetadata(null, 1, 1, 0, ParameterDirection.Input, "EXPR", OracleObjectIdentifier.Empty, false)); allProgramMetadata.Add(maxFunctionAggregateMetadata); var lastValueFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(null, null, "LAST_VALUE"), true, false, false, false, false, false, 1, 1, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); allProgramMetadata.Add(lastValueFunctionMetadata); var sysDateFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.CreateFromValues(null, null, "SYSDATE"), false, false, false, false, false, false, 0, 0, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNoParenthesis, true); allProgramMetadata.Add(sysDateFunctionMetadata); var lnNvlFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramLnNvl, false, false, false, true, false, false, 1, 0, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNoParenthesis, true); allProgramMetadata.Add(lnNvlFunctionMetadata); var extractFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramExtract, false, false, false, false, false, false, 1, 0, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); allProgramMetadata.Add(extractFunctionMetadata); var ratioToReportFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramRatioToReport, true, false, false, false, false, false, 1, 1, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); allProgramMetadata.Add(ratioToReportFunctionMetadata); var sysConnectByPathFunctionMetadata = new OracleProgramMetadata(ProgramType.Function, OracleProgramIdentifier.IdentifierBuiltInProgramSysConnectByPath, false, false, false, false, false, false, 2, 2, AuthId.CurrentUser, OracleProgramMetadata.DisplayTypeNormal, true); allProgramMetadata.Add(sysConnectByPathFunctionMetadata); AllProgramMetadataInternal = allProgramMetadata.ToLookup(m => m.Identifier); NonSchemaBuiltInFunctionMetadataInternal = allProgramMetadata .Where(m => String.IsNullOrEmpty(m.Identifier.Owner)) .ToLookup(m => m.Identifier); BuiltInPackageProgramMetadataInternal = allProgramMetadata .Where(m => m.Owner != null && m.Owner.FullyQualifiedName == OracleObjectIdentifier.IdentifierBuiltInFunctionPackage) .ToLookup(m => m.Identifier); #endregion UniqueConstraintReferringReferenceConstraintsInternal = BuildUniqueConstraintReferringReferenceConstraintLookup(AllObjectsInternal); Instance = new OracleTestDatabaseModel { CurrentSchema = InitialSchema }; }
public void TestToolTipBeforeDatabaseModelLoaded() { const string query = "SELECT S.* FROM SELECTION S"; _documentRepository.UpdateStatements(query); var databaseModel = new OracleTestDatabaseModel(); databaseModel.AllObjects.Clear(); var documentStore = new SqlDocumentRepository(OracleSqlParser.Instance, new OracleStatementValidator(), databaseModel, query); var toolTip = _toolTipProvider.GetToolTip(documentStore, 7); toolTip.ShouldBe(null); }