Re: [firebird-support] Is this a bug of Firebird?

2017-02-10 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
A warning would be enough.

If after the INTO clause there are 2 or 3 variables, no problem, it will be
very easy to detect the mistake. But sometimes that is not the case because
there are 20+ variables and if variable 3 is called "lcName" and variable
24 is called "lcName" too, the programmer can have a hard time detecting
the problem.

Greetings.

Walter.

On Thu, Feb 9, 2017 at 12:19 PM, 'Leyne, Sean' s...@broadviewsoftware.com
[firebird-support]  wrote:

>
>
> Doug,
>
> > Delphi's latest compiler provides a hint in these cases:
> >
> > var
> >   x: Int32;
> > begin
> >   try
> > x := 0;
> > x := 1;
> > writeln(x);
> > end.
> >
> > [dcc32 Hint] Project1.dpr(14): H2077 Value assigned to 'x' never used
> > (Line 14 is the one assigning zero.)
>
> In hindsight my post should have read more like:
>
> - No compiler would treat the condition as an error. A warning, Yes. But
> not an error.
>
> - There are plenty of DB tools (IBExpert for one) which perform their own
> "syntax checking" and report warnings (though I would need to test if IBE
> reports a warning for this case).
>
> - AFAIK, the FB engine only reports errors. So, a new set of
> functions/methods would need to be developed to report and handle warnings.
>
>
> Sean
>
> 
>


RE: [firebird-support] Is this a bug of Firebird?

2017-02-09 Thread 'Leyne, Sean' s...@broadviewsoftware.com [firebird-support]
Doug,

> Delphi's latest compiler provides a hint in these cases:
> 
> var
>   x: Int32;
> begin
>   try
>     x := 0;
>     x := 1;
>     writeln(x);
> end.
> 
> [dcc32 Hint] Project1.dpr(14): H2077 Value assigned to 'x' never used
> (Line 14 is the one assigning zero.)

In hindsight my post should have read more like:

- No compiler would treat the condition as an error.  A warning, Yes.  But not 
an error.

- There are plenty of DB tools (IBExpert for one) which perform their own 
"syntax checking" and report warnings (though I would need to test if IBE 
reports a warning for this case).

- AFAIK, the FB engine only reports errors.  So, a new set of functions/methods 
would need to be developed to report and handle warnings.


Sean



Re: [firebird-support] Is this a bug of Firebird?

2017-02-09 Thread hamacker sirhamac...@gmail.com [firebird-support]
Some times,

I need to create a query where there is a 'where (0=0)' .
it´s not logic for anyone.
But to me, it´s significant because I need to certify that WHERE clausule
always exists when populate my query with dinamic filters controlled by my
application.
In your example, I can espaculate that your intention is not a bug, but
there is a reason for that or your value is innocuous.
innocuous value is not the same as bug, sometimes is not intentional but
happens when generated by automatic selected fields or filters in
application.
The RDBMS does not know the context situation to raise an exception for
ambiguals or innocuous values.



2017-02-08 13:55 GMT-02:00 'Walter R. Ojeda Valiente'
sistemas2000profesio...@gmail.com [firebird-support] <
firebird-support@yahoogroups.com>:

>
>
> CREATE PROCEDURE TEST
> RETURNS(
>   lcName VARCHAR(40))
> AS
> BEGIN
>FOR SELECT
>   ALU_NOMBRE,
>   ALU_APELLD
>FROM
>   ALUMNOS
>INTO
>   :lcName,
>   :lcName
>DO
>   SUSPEND;
>
> END;
>
> In the above stored procedure there are 2 columns in the FOR SELECT but
> just 1 variable name.
>
> It seems a bug for me. Or there are some reasons for allowing to do such
> thing?
>
> Of course, the fault is of the programmer, but it can be detected at
> compilation time.
>
> Firebird version: 2.5.5
>
> Greetings.
>
> Walter.
>
> 
>


Re: [firebird-support] Is this a bug of Firebird?

2017-02-09 Thread Tim Ward t...@telensa.com [firebird-support]
Interesting. (I haven't used Delphi for decades, certainly not this 
century.)


On 09/02/2017 13:17, DougC d...@moosemail.net [firebird-support] wrote:

Delphi's latest compiler provides a hint in these cases:

var
  x: Int32;
begin
  try
x := 0;
x := 1;
writeln(x);
end.

[dcc32 Hint] Project1.dpr(14): H2077 Value assigned to 'x' never used
(Line 14 is the one assigning zero.)

 On Thu, 09 Feb 2017 04:30:06 -0500 *Tim Ward t...@telensa.com 
[firebird-support] * wrote 


It' the equivalent in a conventional programming language of saying:

x = a;
x = b;

where the compiler is expected to know that neither a not the
first assignment have any side effects other than the assignment
(and where the expression b doesn't depend on the value of x)(and
where x isn't volatile, ect ect).

A compiler *could* detect and warn about such things (ie it's not
forbidden by the laws of mathematics) but I don't think I know of
any that do. And as there are good reasons for deliberately
wanting to do the above it could only be a warning, not an error.






--
Tim Ward



Re: [firebird-support] Is this a bug of Firebird?

2017-02-09 Thread DougC d...@moosemail.net [firebird-support]
Delphi's latest compiler provides a hint in these cases:



var

  x: Int32;

begin

  try

x := 0;

x := 1;

writeln(x);

end.



[dcc32 Hint] Project1.dpr(14): H2077 Value assigned to 'x' never used

(Line 14 is the one assigning zero.)



 On Thu, 09 Feb 2017 04:30:06 -0500 Tim Ward t...@telensa.com 
[firebird-support]  wrote 




  It' the equivalent in a conventional programming language of saying:

 

 x = a;

 x = b;

 

 where the compiler is expected to know that neither a not the first assignment 
have any side effects other than the assignment (and where the expression b 
doesn't depend on the value of x)(and where x isn't volatile, ect ect).

 

 A compiler *could* detect and warn about such things (ie it's not forbidden by 
the laws of mathematics) but I don't think I know of any that do. And as there 
are good reasons for deliberately wanting to do the above it could only be a 
warning, not an error. 











Re: [firebird-support] Is this a bug of Firebird?

2017-02-09 Thread Marsupilami79 marsupilam...@gmx.de [firebird-support]
Hmm - Delphi and Free Pascal do exactly that - they emit a warning, that
the first assigned value never gets used.

Am 09.02.2017 um 10:30 schrieb Tim Ward t...@telensa.com [firebird-support]:
>  
>
> It' the equivalent in a conventional programming language of saying:
>
> x = a;
> x = b;
>
> where the compiler is expected to know that neither a not the first
> assignment have any side effects other than the assignment (and where
> the expression b doesn't depend on the value of x)(and where x isn't
> volatile, ect ect).
>
> A compiler *could* detect and warn about such things (ie it's not
> forbidden by the laws of mathematics) but I don't think I know of any
> that do. And as there are good reasons for deliberately wanting to do
> the above it could only be a warning, not an error.
>
> On 08/02/2017 23:36, 'Walter R. Ojeda Valiente'
> sistemas2000profesio...@gmail.com [firebird-support] wrote:
>>  
>> The error is of the programmer, I agree with you, but to repeat the
>> name of a variable without the Firebird showing any message of error
>> is, at least for me, a bug.
>>
>> To have 2 or more variables with the same name after the INTO clause
>> is useless. The compiler can be smart enough to detect such thing.
>>
>> Or not?
>>
>> Greetings.
>>
>> Walter.
>>
>> On Wed, Feb 8, 2017 at 2:36 PM, 'Leyne, Sean'
>> s...@broadviewsoftware.com [firebird-support]
>> > > wrote:
>>
>>  
>>
>>
>>
>> > Yes, but I can not know the value of the column X.ALU_NOMBRE
>> >
>> > And the idea, of course, is know that value, that's why it
>> appears in the FOR
>> > SELECT. If not, I can do nothing with X.ALU_NOMBRE
>>
>> You are asking for the system to evaluate the *intent* of logic.
>>
>> That is completely outside the purview of any application
>> environment that I know.
>>
>> The only thing that a system can check/enforce is the correctness
>> of the code, not to check whether the developer has 2 brain cells.
>>
>>
>> Sean
>>
>>
>
>
> -- 
> Tim Ward
> 



Re: [firebird-support] Is this a bug of Firebird?

2017-02-09 Thread Tim Ward t...@telensa.com [firebird-support]

It' the equivalent in a conventional programming language of saying:

x = a;
x = b;

where the compiler is expected to know that neither a not the first 
assignment have any side effects other than the assignment (and where 
the expression b doesn't depend on the value of x)(and where x isn't 
volatile, ect ect).


A compiler *could* detect and warn about such things (ie it's not 
forbidden by the laws of mathematics) but I don't think I know of any 
that do. And as there are good reasons for deliberately wanting to do 
the above it could only be a warning, not an error.


On 08/02/2017 23:36, 'Walter R. Ojeda Valiente' 
sistemas2000profesio...@gmail.com [firebird-support] wrote:
The error is of the programmer, I agree with you, but to repeat the 
name of a variable without the Firebird showing any message of error 
is, at least for me, a bug.


To have 2 or more variables with the same name after the INTO clause 
is useless. The compiler can be smart enough to detect such thing.


Or not?

Greetings.

Walter.

On Wed, Feb 8, 2017 at 2:36 PM, 'Leyne, Sean' 
s...@broadviewsoftware.com [firebird-support] 
> wrote:




> Yes, but I can not know the value of the column X.ALU_NOMBRE
>
> And the idea, of course, is know that value, that's why it
appears in the FOR
> SELECT. If not, I can do nothing with X.ALU_NOMBRE

You are asking for the system to evaluate the *intent* of logic.

That is completely outside the purview of any application
environment that I know.

The only thing that a system can check/enforce is the correctness
of the code, not to check whether the developer has 2 brain cells.


Sean






--
Tim Ward



Re: [firebird-support] Is this a bug of Firebird?

2017-02-08 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
The error is of the programmer, I agree with you, but to repeat the name of
a variable without the Firebird showing any message of error is, at least
for me, a bug.

To have 2 or more variables with the same name after the INTO clause is
useless. The compiler can be smart enough to detect such thing.

Or not?

Greetings.

Walter.

On Wed, Feb 8, 2017 at 2:36 PM, 'Leyne, Sean' s...@broadviewsoftware.com
[firebird-support]  wrote:

>
>
>
>
> > Yes, but I can not know the value of the column X.ALU_NOMBRE
> >
> > And the idea, of course, is know that value, that's why it appears in
> the FOR
> > SELECT. If not, I can do nothing with X.ALU_NOMBRE
>
> You are asking for the system to evaluate the *intent* of logic.
>
> That is completely outside the purview of any application environment that
> I know.
>
> The only thing that a system can check/enforce is the correctness of the
> code, not to check whether the developer has 2 brain cells.
>
>
> Sean
>
> 
>


RE: [firebird-support] Is this a bug of Firebird?

2017-02-08 Thread 'Leyne, Sean' s...@broadviewsoftware.com [firebird-support]


> Yes, but I can not know the value of the column X.ALU_NOMBRE
> 
> And the idea, of course, is know that value, that's why it appears in the FOR
> SELECT. If not, I can do nothing with X.ALU_NOMBRE

You are asking for the system to evaluate the *intent* of logic.

That is completely outside the purview of any application environment that I 
know.

The only thing that a system can check/enforce is the correctness of the code, 
not to check whether the developer has 2 brain cells.


Sean



Re: [firebird-support] Is this a bug of Firebird?

2017-02-08 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
Yes, but I can not know the value of the column X.ALU_NOMBRE

And the idea, of course, is know that value, that's why it appears in the
FOR SELECT. If not, I can do nothing with X.ALU_NOMBRE

Greetings.

Walter.



On Wed, Feb 8, 2017 at 12:02 PM, Dimitry Sibiryakov s...@ibphoenix.com
[firebird-support]  wrote:

> 08.02.2017 16:55, 'Walter R. Ojeda Valiente'
> sistemas2000profesio...@gmail.com
> [firebird-support] wrote:
> > Of course, the fault is of the programmer, but it can be detected at
> compilation time.
>
>Why? It is expanded into code like this:
>
> FOR SELECT ALU_NOMBRE, ALU_APELLD  AS CURSOR X DO
>lcName = X.ALU_NOMBRE;
>lcName = X.ALU_APELLD;
>
>Pointless, but valid.
>
> --
>WBR, SD.
>
>
> 
>
> 
>
> ++
>
> Visit http://www.firebirdsql.org and click the Documentation item
> on the main (top) menu.  Try FAQ and other links from the left-side menu
> there.
>
> Also search the knowledgebases at http://www.ibphoenix.com/
> resources/documents/
>
> ++
> 
>
> Yahoo Groups Links
>
>
>
>


Re: [firebird-support] Is this a bug of Firebird?

2017-02-08 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
08.02.2017 16:55, 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com 
[firebird-support] wrote:
> Of course, the fault is of the programmer, but it can be detected at 
> compilation time.

   Why? It is expanded into code like this:

FOR SELECT ALU_NOMBRE, ALU_APELLD  AS CURSOR X DO
   lcName = X.ALU_NOMBRE;
   lcName = X.ALU_APELLD;

   Pointless, but valid.

-- 
   WBR, SD.






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



[firebird-support] Is this a bug of Firebird?

2017-02-08 Thread 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
CREATE PROCEDURE TEST
RETURNS(
  lcName VARCHAR(40))
AS
BEGIN
   FOR SELECT
  ALU_NOMBRE,
  ALU_APELLD
   FROM
  ALUMNOS
   INTO
  :lcName,
  :lcName
   DO
  SUSPEND;

END;

In the above stored procedure there are 2 columns in the FOR SELECT but
just 1 variable name.

It seems a bug for me. Or there are some reasons for allowing to do such
thing?

Of course, the fault is of the programmer, but it can be detected at
compilation time.

Firebird version: 2.5.5

Greetings.

Walter.