Class::DBI::Test::SQLite(3pm) User Contributed Perl Documentation Class::DBI::Test::SQLite(3pm)NAME
Class::DBI::Test::SQLite - Base class for Class::DBI tests
SYNOPSIS
use base 'Class::DBI::Test::SQLite';
__PACKAGE__->set_table('test');
__PACKAGE__->columns(All => qw/id name film salary/);
sub create_sql {
return q{
id INTEGER PRIMARY KEY,
name CHAR(40),
film VARCHAR(255),
salary INT
}
}
DESCRIPTION
This provides a simple base class for Class::DBI tests using SQLite. Each class for the test should inherit from this, provide a
create_sql() method which returns a string representing the SQL used to create the table for the class, and then call set_table() to create
the table, and tie it to the class.
METHODS
set_table
__PACKAGE__->set_table('test');
This combines creating the table with the normal Class::DBI table() call.
create_sql (abstract)
sub create_sql {
return q{
id INTEGER PRIMARY KEY,
name CHAR(40),
film VARCHAR(255),
salary INT
}
}
This should return, as a text string, the schema for the table represented by this class.
perl v5.12.4 2005-05-24 Class::DBI::Test::SQLite(3pm)
Check Out this Related Man Page
Class::DBI::Cascade::None(3pm) User Contributed Perl Documentation Class::DBI::Cascade::None(3pm)NAME
Class::DBI::Cascade::None - Do nothing upon deletion
DESCRIPTION
This is a Cascading Delete strategy that will do nothing, leaving orphaned records behind.
It is the base class for most ofther Cascade strategies, and so provides several important methods:
CONSTRUCTOR
new
my $strategy = Cascade::Class->new($Relationship);
This must be instantiated with a Class::DBI::Relationship object.
METHODS
foreign_for
my $iterator = $strategy->foreign_for($obj);
This will return all the objects which are foreign to $obj across the relationship. It's a normal Class::DBI search you can get the results
either as a list or as an iterator.
cascade
$strategy->cascade($obj);
Cascade across the related objects to $obj.
WRITING NEW STRATEGIES
Creating a Cascade strategy should be fairly simple. You usually just need to inherit from here, and then supply a cascade() method that
does the required thing with the results from foreign_for().
So, for example, Cascade::Delete is implemented simply as:
package Class::DBI::Cascade::Delete;
use base 'Class::DBI::Cascade::None';
sub cascade {
my ($self, $obj) = @_;
$self->foreign_for($obj)->delete_all;
}
perl v5.12.4 2005-09-14 Class::DBI::Cascade::None(3pm)
Looking for any advise from a DBA/DA. When should you use CHAR and when should you use VARCHAR when designing a table. From my readings seems like VARCHAR will accept any length string even though you define a length to it, so I setup gadget VARCHAR(10) I could actually put something with 20... (1 Reply)
could you please help :
i have written script to search the for PRIMARY INDEX and if found display the whole definition of create table:
ISSUE NOW IS:
to store the table name in a variable and search the file if and update and show table exists..
Example:
ct t15(
c1... (3 Replies)
Hello All,
I am trying to write a Perl script that is using 'SQLite' as the application needs a very light weight Database. I wanted to know how to catch exceptions when I run queries in SQLite. Without this the Perl script comes to a halt everytime an exception occurs. Please help.
Regards,... (4 Replies)
write a shell script that computes the gross salary of a employee accordin to the followin rules:
1)if basic salary is<1500 then HRA=10%of the basic and DA=90% of the basic.
2)if basic salary is >=1500 then HRA=rs500 and DA=98% of the basic
the basic salary is entered interactively through the... (1 Reply)
Hi,
I have a shell script to unload all the empname who have salary >50000 from the emp table into a text file(empname.txt) .
m_db unload "$dbc_file" -column_delimiter ',' -select "SELECT empname FROM emp where salary > 50000" >> empname.txt
Now my text file have data in the following format ... (3 Replies)
Hi all,
i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Hi all,
I have an interesting and I am sure simple question for yau'll.
Basically this is what I am after:
The table:
CREATE TABLE places (id INT, city VARCHAR(24), name VARCHAR(24));
The data:
id = 1, city = canberra, name = aaron
id = 2, city = canberra, name = andrew
id = 3, city... (4 Replies)
Hi,
I'm new to shell programming, can anyone help me on this? I want to do following operations -
1. Average salary for each country
2. Total salary for each city
and data that looks like -
salary country city
10000 zzz BN
25000 zzz BN
30000 zzz BN
10000 yyy ZN
15000 yyy ZN
... (3 Replies)
I have a file with 3 columns
I want to get the record with the max salary. If there are more than 1 record having the highest salary, i want any one of them.
empid,ename,Sal
1,abc,100
2,def,200
3,xyz,300
4,pqr,100
5,mnq,300
Output
Any record with 300 as salary
Please use next... (1 Reply)
my file contains salary field and i just want to find a salary between 50000 to 99999?
Is there any command so that i can achieve this
Please help (3 Replies)