Ask a Question related to PERL Modules, Design and Development.
-
onlineviewer #1
Ip address Data Type DBI
Hello,
I'm using perl DBI, and I am trying to insert data into a table, but i
am
having trouble using the right data type for ip address. It will insert
the address but it truncates it. 10.0.0.1 will look like 10
I've tried almost every type , but no luck. Any suggesstions?
Thank you,
onlineviewer Guest
-
Converting from data type varchar to data type money
Hi all, Tearing my hair out trying to figure this out. If anyone can provide any help i would greatly appreciate it. When I try to do an insert... -
Converting data type varchar to data type money
Hi all, Tearing my hair out trying to figure this out. If anyone can provide any help i would greatly appreciate it. When I try to do an insert... -
retriving data from memo data type of msaccess to asp.net
hi all, How i can access the data from MEMO style storage of MS ACCESS using sql query.Can any body give the function ie (Areader.(?)).Which... -
HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type
I have the following problem: I have the following form client side: <FORM.......> <FORM action="./WZUpload.asp" method="Post"... -
HowTo Send Uploaded File with INPUT Type file to Sql Server Image Data Type ?
I have the following problem: I have the following form client side: <FORM.......> <FORM action="./WZUpload.asp" method="Post"... -
Matthew Braid #2
Re: Ip address Data Type DBI
onlineviewer wrote:
If you don't care about in-database comparisons, what's wrong with> Hello,
>
> I'm using perl DBI, and I am trying to insert data into a table, but i
> am
> having trouble using the right data type for ip address. It will insert
> the address but it truncates it. 10.0.0.1 will look like 10
> I've tried almost every type , but no luck. Any suggesstions?
>
> Thank you,
>
varchar (ie, a string)?
If you do care about comparisons and you're only dealing with IPv4,
convert the ip to a number (see below - code contains no error
checking!) and store the number (don't forget to convert back when you
retrieve it - I'll leave that as an excercise for the reader :) )
sub ip4_to_num {
my ($ip) = @_;
my ($num, $pow) = (0, 3);
for my $oct (split /\./, $ip) {
$num += $oct * 256 ** $pow--;
}
return $num;
}
MB
Matthew Braid Guest
-



Reply With Quote

