Oracle forms 10g - Private packages - oracleforms

While reading Oracle Applications Developer’s Guide, I came across these lines-
If a client–side (Oracle Forms) package exceeds the 10K limit, you can reduce the size of the package by putting private variables and procedures in one or more
”private packages.”
could someone explain how to create private packages?
Any helpful links is also appreciated.

There is no private packages as such in oracle,but you can have use private procedures or functions inside a package which are accessible only to the package.
Procedures and Functions inside a package can be made private by not declaring them in the package specifications
Another point to note is that private procedures or functions can be called only inside the package body and we should declare them before they are called
In your case to solve 10k Limit issue you can define a wrapper package and them call a package where you can define a public procedure which you define in the package specifications and body and pass all the arguments and use the public procedure to only call the private procedure
you can refer the answer in the below for example
Execute private procedure globally in oracle package
Wrapper package
CREATE OR REPLACE PACKAGE BODY testPackage_Wrapper AS
PROCEDURE publicProc IS
BEGIN
testPackage.publicProc();
END;

Related

Does SystemVerilog support global functions?

I want to make a parity_check function which can be accessed by three different modules. Is this possible in SV? If yes, where do I declare this function and how do I import it into my module?
You can put a function into a separate file and include it using `include:
`include "some_file_name.sv"
However, a much better way is to use a package:
package some_package_name;
function string some_function_name;
return "some_function_name called";
endfunction
endpackage
You would put that into a separate file and you must compile that before compiling any module that uses it. You then import the package into each module:
module some_module_name;
import some_package_name::*; // or import some_package_name::some_function_name;
initial
$display(some_function_name);
endmodule
Putting a function in a package is better than just putting it into a file and using include, because a package is a named scope. Because a package is a named scope, any issues with some clash of names can be resolved by, instead of using import, referring to the full name of the function in its package, eg:
module some_module_name;
initial
$display(some_package_name::some_function_name);
endmodule

How to Cache LINQ to SQL Results?

I'm using LINQ to SQL to call some reporting stored procedures.
Each stored procedure returns a class which accepts some input parameters, for example:
public partial class csp_WeekCommencingListResult
{
public static IEnumerable<csp_WeekCommencingListResult> GetAll(int? masterTrackingGroupId)
{
using (var dataContext = OscaDataContext.CreateWithCustomTimeOut())
{
return dataContext
.csp_WeekCommencingList(masterTrackingGroupId)
.ToList();
}
}
}
How could I cache the result of the stored procedure for the passed parameters?
For example, when 1 is passed to this stored procedure, its result should be cached for a day.
Any thoughts? is there any framework I can use? or I have to build my own custom cache manager per stored procedure using the .NET Cache object?
Thanks,
You should probably add caching at a higher level, for example in the code that is calling this code.
Try to figure out a good caching strategy that works with your project.
And when it comes to cache managers, I usually use the ICacheManager from Microsoft EnterpriseLibrary Caching which I property inject with some dependency injection framework like Castle or StructureMap. That way I can run different configurations for different environments (dev, test, prod etc).

Is there a way to create and use global data structures (specifically c# struct) in SSIS 2008 R2

I have some complex data that I need to pass from one SSIS (SQL Server Integration Services) script task to another SSIS script task.
It is essentially an array of this C# struct:
struct GeneratedReport {
public string ReportCode;
public string FileName;
public int NoOfDataRows;
};
The problem is that I need a way to define the struct at a global level in the package so that all script tasks within the package can use this global data structure. I can find no way of doing it and I don't know where I would declare such a structure.
Any help much appreciated!
There are couple approaches you might try:
1) create a separate assembly that defines this structure, reference it from every script task. But you'll need to manage separate assembly, deploy it with the package, etc - still, if you have complex structure, it is worth it.
2) use loosely-typed structure, rather than strong-typed one. E.g. use Hashtable object, and put this Hashtable object into SSIS variable.
No separate assembly, but your code now is different:
reportCode = (string)((Hashtable)variableValue)["ReportCode"];

Programmatically load SSIS package configurations

I am making a framework in SSIS to load files from configurable folders and match them to a logical job in the database. In this job a package name is configured and in SSIS I execute this package in runtime.
I want to programmatically load a package configuration for this package, depending on the job loaded. SSIS SQL Server package configuration is not an option, because that loads values to this package just once in runtime for the package itself, but I want to load a specific package configuration in runtime that has been stored with the job (job has one package, but has many package configurations)....
Schematically:
folderA -> file A.1 -> job A -> load package configuration for job A -> execute package in job A.
Is that possible?
We do something simliar using parent and child packages to run a standard package for differnt clients with differnt configuration values. The parent packge uses and enviroment variable and our configuration table to pull the configuration values for that particular process. The child table is configured to accept variables for the configuration which are sent from the parent package inthe execute package task. This also allows us to do some custom steps for a particular client in the parent package if need be (which is about 100% of the time here). So of you get one file form one client that they just cannot provide in the format the standard child import uses you can do transformation steps to get teh file ready for the standard import and then run the standard. Or you can add steps after the standrd package to send an email to the client with exceptions that they need to fix in their data for instance if only one client requires that.
You create Variables in the parent package for each piece of configuration information you want to send, typically to other variables or connection strings for the conmnections in the child package. You then put in an Excute package task that uses a connection to the child package.
In the child package you then go to the SSIS menu and choose package configurations and Add. Then for the type of configuration, you choose Parent Package variable. You will create one Parent package variable for each configuration item you want to send to the Child package. Things we send are things like the client_id, the connection strings to a client specific database, variables for things that might vary by client, etc.
We also store all our configurations in a table in a meta database where we store information about imports. So we set up our parent pacakge to use an environment variable to tell it which database to connect to to get the configuration information Then the second confiuration is to the SSISConfiguration table that stores the configuration information. We populate that information by server (it will vary by server generally, connection strings are different for dev, qa and prod) through an insert script that we run before testing the package.
For further detail, look in Books Online for execute package task and it wil show you how to set up the packages to pass variables.
I found the solution now. It is only possible by using a script task that uses the SSIS object model to create a package in runtime based on the SQL Server Application class where you can load the package by filename. After loading the package from file, I can read the configuration from file by xml or by SQL Server and add it in runtime to the child package configuration list.
Two important notes:
1) Parent variables are not passed to child package automatically.
Only when an execute package task is used the parent variables are passed to the child automatically. To get this working I search the variables in runtime and write the values in it, because I know the exact variables I want to pass to each child package.
2) When using SQL Server as a package configuration for a child package, you must also create a connection manager in runtime and add it to the connection manager collection of the package. when adding the package configuration to the child package, be sure that the name of that connection manager is part of the connection string.
Here is the code to prove it works:
//load the information of the job into these variables. Package is the File system deployed package on a share. Package configuration can be the package configuration in an xml file on a share, or a connection string when using SQL Server (this one is used here).
string package = this.Dts.Variables["Package"].Value.ToString();
string packageConfiguration = this.Dts.Variables["PackageConfiguration"].Value.ToString();
//create a package from package factory, by file.
Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
Package packageToRun = app.LoadPackage(package, null);
//------------------------------------------ CHILD PACKAGE VARIABLES PASSING
packageToRun.EnableConfigurations = true;
//add one extra package configuration for child package specific configuration
Configuration config = packageToRun.Configurations.Add();
config.Name = "MyConfig";
config.ConfigurationType = DTSConfigurationType.SqlServer;
config.ConfigurationString = packageConfiguration;
//use the name 'MyConnectionManager' in your packageConfiguration
ConnectionManager cm = packageToRun.Connections.Add("OleDb");
cm.Name = "MyConnectionManager";
//TODO: retrieve this from an environvariable to allow change in data source for DEV, QA, PROD, now temporarly fixed to this value
cm.ConnectionString = "Data Source=.;Initial Catalog=YYYYYYYYYY;Provider=SQLNCLI10.1;Integrated Security=SSPI;";
//For Parent-Child var passing, I used the technique to let all the parent variables being defined in the child packages.
//Other technique could be to allow the child package not define the parent variables, but then the child packages have to reference them from code
//------------------------------------------ PARENT VARIABLES PASSING
//Now check if these parent variables exist in child package and write the actual values in them
try
{
Variables vars = null;
VariableDispenser variableDispenser = packageToRun.VariableDispenser;
if (
packageToRun.Variables.Contains("User::XXXXXXXXXXXX") &&
)
{
packageToRun.VariableDispenser.LockForWrite("User::XXXXXXXXXXXX");
variableDispenser.GetVariables(ref vars);
packageToRun.Variables["User::XXXXXXXXXXXX"].Value = this.Dts.Variables["User::XXXXXXXXXXXX"].Value;
vars.Unlock();
packageToRun.Execute();
Dts.TaskResult = (int)ScriptResults.Success;
}
else
{
this.Dts.Events.FireError(0, string.Empty, "Child package: " + package + " has no required master variables defined or unable to unlock.", string.Empty, 0);
}
}
catch (Exception ex)
{
this.Dts.Events.FireError(0, string.Empty, ex.Message, string.Empty, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}

Inlining functions in AS3

I'm looking for a way to inline functions in AS3.
I know that the language itself doesn't offer a native way of doing that but perhaps there is another option:
ANT precompile task
shell script
command line tool
...
Basically, anything that could eventually be integrated with ANT and run on a Hudson CI server.
You can use Joa Ebert Apparat tools to achieve such a thing and more.
You can't inline whatever function you want they are some restrictions
Basically you have to create a new class that extends Macro or Inlined following your need, and declare static function within it, then after running TDSI your function will be inlined.
Check out for example Math inlined function or Macro function
Adobe introduced native inline functions with the new ASC2 compiler in 2012. Use the -inline compiler argument to inline all getters and setters and any functions marked with the new [Inline] metadata. Inlined functions must meet these conditions:
The function is final, static or the containing scope is file or package
The function does not contain any activations
The function does not contain any try or with statements
The function does not contain any function closures
The function body contains less than 50 expressions
http://www.bytearray.org/?p=4789