I know htis isnt exactly unix.... but hopefully someone can help me or direct me someplace to get help.
I can run sql queries in scripts against my informix db using:
dbaccess mydb myquery.sql >> sql.output
I need to write my script to select based on todays date. Its very... (5 Replies)
Hi Folks,
This is a small chunk of the bigger problem which i am facing and some help here will help me resolve the rest of the issue.
Problem is that i need to pass the value of a variable from a shell script to a SQL query (infact a lot of SQL's)
i have the following solution but somehow... (4 Replies)
I created a script to read a csv file with four columns. The script also saved values of each col in a arry.
In the script, i connected to db try to run a query to pull out data baisc on the values from the csv file.
select Num from tableName
where Sec_Num in ('${isin}') /*isin is an arry... (1 Reply)
Unix prompt
=========
echo "Enter the query"
read q
==========
User has entered :
SELECT * FROM employee
=====================
Now the problem starts..
echo $q
Output: SELECT "all files names in the PWD" FROM employee
================================================
... (5 Replies)
I have a script (say script1.sh ) and I am calling a script (say script2.sh) within the script1.sh. Here in script1.sh I have a hash ( say %hash1) and i have to pass this hash to script2.sh. Basically i have to do some processing in Scirpt2.sh based on the hash(key,values). I wanted to know how can... (2 Replies)
I heard this was possible but from my research I haven't been able to figure it out yet. Seems it should be simple enough. Basically from a high level view I'm trying to accomplish...
. $X='grep foo blah.log'
then 'mysql command SELECT foo FROM bar WHERE ' . $X
or something like that.
... (2 Replies)
hi there
I have the following script in which i have created a PrintHash() function.
I want to pass to this function the reference to a hash (in the final code i will be passing different hashes to this print function hence the need for a function). I am getting an error
Type of arg 1 to... (1 Reply)
How to pass variable to sql file.
Im tryin in two ways,
Method 1:
my.sql
select * from table where col1 = '$1' and col2 = 'text';
Method 1execute: dbaccess database my.sql $var
Method2:
select * from table col1 in (`cat inputfile`) and col2 = 'text';
method... (2 Replies)
I have a script in which i connect to database to run a query and get the result of the query to a temp file. This works fine , now what i want is there is flat file which contains the value to be used in the query. I want to read this file line by line and then run the query for each value in that... (7 Replies)
Hi,
I have created a shell script that reads line from text file and insert into DB table. I have used IFS to separate the line text. Looks IFS is splitting text properly but while passing one of the values that has special characters in it to query, it is giving weird issue. Below is my... (2 Replies)
Discussion started by: yuvi
2 Replies
LEARN ABOUT DEBIAN
petal::hash::test
Petal::Hash::Test(3pm) User Contributed Perl Documentation Petal::Hash::Test(3pm)NAME
Petal::Hash::Test - Test and Tutorial Petal modifier
SUMMARY
Petal modifiers are snippets of code which are used to extend the expression engine capabilities. This test shows how to write your own
modifiers.
API
The modifier API is very, very simple. It consists of two elements:
The package name
Your modifier should be called Petal::Hash::<SomeThing>, where <SomeThing> is the name that you want to give to your modifier.
For example, this modifier is called Petal::Hash::Test. Petal will automatically pick it the module up and assign it the 'test:' prefix.
package Petal::Hash::Test;
use warnings;
use strict;
The method $class->process ($hash, $argument);
This class method will define the modifier in itself.
* $class is the package name of your modifier (which might come in handy if you're subclassing a modifier),
* $hash is the execution context, i.e. the objects and data which will 'fill' your template,
* $argument is whatever was after your modifier's prefix. For example, for the expression 'test:foo bar', $argument would be 'foo bar'.
In this test / tutorial we're going to write a modifier which uppercases a Petal expression.
sub process
{
my $class = shift;
my $hash = shift;
my $argument = shift;
return uc ($hash->get ($argument));
}
1;
__END__
And that's it! Simple!
AUTHOR
Jean-Michel Hiver
This module is redistributed under the same license as Perl itself.
SEE ALSO
The template hash module:
Petal::Hash
perl v5.12.4 2011-08-25 Petal::Hash::Test(3pm)