I've gotten this before.  If I remember correctly, I had to
use "cast" to tell the database the datatype.

-ejay

....  Here is a section out of my ipdb_lib.pl, notice the
::NUMERIC(40) on the end of the query.  I cannot remember
how many places I had to change this, but I think I
submitted a diff for it.  Good luck,
 ejay

#-----------------------------------------------------------
---------------------------
#       CheckBlocksFree()
# Takes:
#       A database connection to IPDB
#       A block ID to check for.
#       A A bit-boundry
# Returns:
#       -1 on Error
#       0 on No block found
#       ID on found block.
#
sub CheckBlockFree(){
        my $conn = shift || &IPDBError(-1,"No Database
connection");
        my $config = shift || &IPDBError(-1,"No config");
        my $block = shift || &IPDBError(-1,"No Block");
        my $bits = shift || &IPDBError(-1,"No Bits");
        my $region = shift || &IPDBError(-1,"No Region");
        my $query = "";
        if($config{dbtype} eq "Pg"){
                $query = "SELECT ID,ALLOCATED,CHILDR,CHILDL
FROM IPDB WHERE BITS = '".$bits."' AND BLOCK =
".$block."::NUMERIC(40) AND REGION = $region ";
        } else {
                $query = "SELECT ID,ALLOCATED,CHILDR,CHILDL
FROM IPDB WHERE BITS = '".$bits."' AND BLOCK = ".$block."
AND REGION = $region ";
        }
        my @result = &QueryDB($conn,$query,"Checking if
block is free");
        unless($result[1]){
                return(0);
        } else {
                my @out = $result[0]->fetchrow;
                my $id = $out[0];
                my $allo = $out[0];
                my $childl = $out[1];
                my $childr = $out[2];
                if($allo < 0 || $childl < 0 || $childr < 0){
                        return(-1);
                } else {
                        return($id);
                }
        }
        &FinishDB(@result);
}
#-----------------------------------------------------------
---------------------------



> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of David
Wilson
> Sent: Tuesday, June 08, 2004 2:11 PM
> To: [EMAIL PROTECTED]
> Subject: [freeipdb-users] new install problems
> 
> 
> Hi guys I have setup freeipdb on  a test server and it is
not  letting
> me configure blocks.  This is the message I get in the web

> browser when
> I try to add a new allocation or block.
> 
>  
> 
> Error in ipdb_lib.pl in main::QueryDB at line 79 Database
Query Error
> Checking if block is free ERROR: Unable to identify an 
> operator '=' for
> types 'numeric' and 'double precision' [SELECT
> ID,ALLOCATED,CHILDR,CHILDL FROM IPDB WHERE BITS = 21 AND
BLOCK =
> 3626401792 AND REGION = 1 ] 
> 
>  
> 
> This is in the error log:
> 
>  
> 
> Use of uninitialized value in addition (+) at ipdb_lib.pl
line 1133.
> 
> Use of uninitialized value in string eq at ipdb_lib.pl
line 1007.
> 
> DBD::Pg::st execute failed: ERROR:  Unable to identify an
operator '='
> for types 'numeric' and 'double precision' at ipdb_lib.pl
line 76.
> 
> Error in ipdb_lib.pl in main::QueryDB at line 79 Database
Query Error
> Checking if block is free ERROR:  Unable to identify an 
> operator '=' for
> types 'numeric' and 'double precision' [SELECT
> ID,ALLOCATED,CHILDR,CHILDL FROM IPDB WHERE BITS = 21 AND
BLOCK =
> 3626401792 AND REGION = 1 ]
> 
> Exiting -1 at ipdb_lib.pl line 946.
> 
> I am using these packages:
> 
>  
> 
> Math-BigInt-1.70.tar.gz
> 
> DBI-1.42.tar.gz
> 
> DBD-Pg-1.32.tar.gz
> 
> Net-IP-1.20.tar.gz
> 
>  
> 
> psql (PostgreSQL) 7.2.1
> 
>  
> 
> Server version: Apache/1.3.26 (Unix) Debian GNU/Linux
> 
>  
> 
> What am I doing wrong?
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Regards,
> 
> -David Wilson
> 
> Fastmetrics Systems Administrator
> 
> 415-778-5100 x 3
> 
>  
> 
> 


Reply via email to