Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Lester Caine

Berko Bubu wrote:

INSERT INTO PRICE (ID, "NAME", COST)



You should not use double quotes around column names. Try to use backtick
operator instead:
INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
Don't know if that solves the problem, but it's atleast good practice.
Second, do you really need firebird database?
It's pretty outdated database, and there are much better alternatives.

It's an existing system, so i can't change it.
I have tried with firebird 2.5 and same result.

The value stored right. I have seen it in FlameRobin, ISQL, etc
And when i use native native lib (ibase_connect,ibase_prepare,ibase_execute) i 
get right value.
Maybe is it a bug in pdo_firebird driver ?


This is possible ...
Have you tried the other options to PDO::FETCH_ASSOC ?

I've not bothered with the PDO drivers as the Firebird one can't cope with 
two-phase commits cross database, and I know that others have found the 
restrictions imposed by PDO prevent things working well in older style Firebird 
Applications.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Lester Caine

Matijn Woudt wrote:

Dear List!
>
>i have a strange problem.
>
>I have a Firebird database (dialect 3). Firebird server: 2.0.6
>I create a table, and insert a row like that:
>CREATE TABLE PRICE (
>   ID INTEGER NOT NULL,
>   "NAME" VARCHAR(10),
>   COST NUMERIC(15, 2));
>
>INSERT INTO PRICE (ID, "NAME", COST)
>

You should not use double quotes around column names. Try to use backtick
operator instead:
INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
Don't know if that solves the problem, but it's atleast good practice.
Second, do you really need firebird database?
It's pretty outdated database, and there are much better alternatives.


Matijn ... All totally incorrect information for a REAL SQL database. Backticks 
are a bodge for MySQL only and not part of the SQL standard.


And Firebird is used for many systems worldwide and is a much better alternative 
to many later database engines. Many Oracle users are porting over to Firebird 
to reduce costs.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Berko Bubu
> > INSERT INTO PRICE (ID, "NAME", COST)
> >
> 
> You should not use double quotes around column names. Try to use backtick
> operator instead:
> INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
> Don't know if that solves the problem, but it's atleast good practice.
> Second, do you really need firebird database?
> It's pretty outdated database, and there are much better alternatives.
It's an existing system, so i can't change it. 
I have tried with firebird 2.5 and same result.

The value stored right. I have seen it in FlameRobin, ISQL, etc
And when i use native native lib (ibase_connect,ibase_prepare,ibase_execute) i 
get right value.
Maybe is it a bug in pdo_firebird driver ?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Matijn Woudt
On Fri, Jan 18, 2013 at 12:49 PM,  wrote:

> Dear List!
>
> i have a strange problem.
>
> I have a Firebird database (dialect 3). Firebird server: 2.0.6
> I create a table, and insert a row like that:
> CREATE TABLE PRICE (
>   ID INTEGER NOT NULL,
>   "NAME" VARCHAR(10),
>   COST NUMERIC(15, 2));
>
> INSERT INTO PRICE (ID, "NAME", COST)
>

You should not use double quotes around column names. Try to use backtick
operator instead:
INSERT INTO `PRICE` (`ID`, `NAME`, `COST`)
Don't know if that solves the problem, but it's atleast good practice.
Second, do you really need firebird database?
It's pretty outdated database, and there are much better alternatives.

- Matijn


Re: [PHP-DB] Firebird return wrong value

2013-01-18 Thread Lester Caine

vbe...@mail.com wrote:

result:
Array ( [0] => Array ( [COST] => -0.00 ) )


As a starting point ... can you look at the database using Flamerobin and check 
what it shows has been stored. I don't see anything wrong with what you have 
done except that 'cost' should perhaps be -1.0, so once we know what IS in the 
database we can look at which end has gone wrong ;)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Firebird return wrong value

2013-01-18 Thread vberko
Dear List!

i have a strange problem.

I have a Firebird database (dialect 3). Firebird server: 2.0.6
I create a table, and insert a row like that:
CREATE TABLE PRICE (
  ID INTEGER NOT NULL,
  "NAME" VARCHAR(10),
  COST NUMERIC(15, 2));

INSERT INTO PRICE (ID, "NAME", COST)
VALUES (2, 'my price2', -1);

when i read it back i get strange value. I get -0.0 and not -1.

    $db=new 
PDO("firebird:dbname=localhost:c:/test/test.fdb","testuser","testpassword",array());
            $sql="select cost from price where id=2";
    $q=$db->query($sql);
    $ret=$q->fetchAll(PDO::FETCH_ASSOC);
    print_r($ret);

result:
Array ( [0] => Array ( [COST] => -0.00 ) )

Thanks for your advice,
Berko

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php