Well ... this is for yet another DBIx module. Something that'd make calling MS SQL stored procedures (since that's all I want from my data access layer, thank you very much) very easy. I have finding the parameters of stored procedures and handling output parameters done, but I can't find a way to handle the optional parameters or even how to find which ones are optional :-(
The code currently goes somewhat like this:
package MyDB;
use DBIx::LazyMethod::MSSQL;
use vars qw(@ISA);
@ISA = qw(DBIx::LazyMethod::MSSQL);
sub new {
my $class = shift;
my $db = $class->SUPER::new(
data_source => 'dbi:ODBC:jobodbc2',
user => 'xxx',
pass => 'xxx',
attr => { PrintError => 0, RaiseError => 0, LongReadLen => 655
+36, 'AutoCommit' => 1 },
methods => {
FetchUserInfo => {
def => { adminid => 1 },
ret => '%',
},
GetServerMailAddress => '$',
GetFieldTitle => {
def => {siteid => undef},
ret => '$'
}
},
);
return $db;
}
1;
and then
use MyDB;
my $db = MyDB->new();
print Dumper($db->FetchUserInfo(userid => '577'));
my $email;
$db->GetServerMailAddress(email => $email);
print "\$email = $email\n";
my $title;
$db->GetFieldTitle( fieldtype => 'I', fieldid => 11, fieldtitle => $ti
+tle);
print "\$title = $title\n";
If I could at least find out what parameters are optional and what are the default values I could just call the procedures with all parameters and pass those defaults, but I can't find a way to do that apart from parsing the SQL :-(
Jenda
|
XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented. |
|