Re: [firebird-support] Re: Cursor FETCH in PSQL and ROW_COUNT/'fetch past last record' error

2017-03-28 Thread 'Martijn Tonies (Upscene Productions)' m.ton...@upscene.com [firebird-support]
Hello Dmitry,

So the first 'fetch' operation on a position that's invalid returns 
"rowcount=0",
any additional fetch (which includes a move) returns an exception?

That seems to be the case.


With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com


-Original Message- 
From: Dmitry Yemanov dim...@users.sourceforge.net [firebird-support]
27.03.2017 11:23, 'Martijn Tonies wrote:
>
> The FOR SELECT loop returns 1..10 as the values.
>
> The fetch/suspend lines return 1..10, with a row count of 1, and another
> ‘10’ with a row count of 0.
>
> If I add another FETCH, I get this error while executing the routine:
>>>attempt to fetch past the last record in a record stream At procedure
> 'DEBUG_CURSOR_TESTS' line: 42, col: 3
>
> And here’s my question: the last fetch has a row_count of 0, another
> fetch returns an error. However, if I make this cursor a scrollable
> cursor, and my first ‘fetch’ is a ‘fetch prior’, I immediately get this
> error:
>>>attempt to fetch before the first record in a record stream At
> procedure 'DEBUG_CURSOR_TESTS' line: 9, col: 3
>
> I get the ‘past last record’ error when I use:
> fetch absolute 11 from c into :p_out1;
>
> I wonder, should the first fetch next that returns no data, return
> row_count=0, or also the ‘fetch past record stream’ error?

AFAIU, this is expected. When the cursor moves past the last record, "no
data" condition is returned. In API, this means fetch() returning 100
(EOF marker). Inside PSQL, row_count is set to 0 that also indicates
EOF. However, moving past EOF is not supported and it throws an error.
It may look counter-intuitive to someone, but this is how our engine
always worked (internally or via API).




Re: [firebird-support] FBTrace: What are "dyn requests"

2017-03-28 Thread Svein Erling Tysvær setys...@gmail.com [firebird-support]
I don't know what dyn requests are, Sean, but reading a bit I do find dyn
mentioned in the Firebird book (page 1028) as well as on page 72 of a
presentation Pavel did at the Firebird conference 2014. First, the Firebird
book:

A byte-encoded language for describing data definition statements.
Firebird's DSQL subsystem parses DDL statements and passes them to a
component that outputs DYN for interpretation by the Y valve, another
subsystem that is responsible for updating the system tables.

Then Pavel:
BLR & DYN
You will never need those unless you're Firebird core developer or GPRE
user.
Note: BLR & DYN records could be quite long, so set max_blr_length &
max_dyn_length trace options accordingly.

Hence, I figured that DYN is something that I - as a normal user -
hopefully never need to know much about. Does this answer your question, or
are you interested in a more technical answer from one of the developers?

Set

2017-03-27 19:59 GMT+02:00 'Leyne, Sean' s...@broadviewsoftware.com
[firebird-support] :

>
>
>
> FBTrace config supports the logging of “dyn requests”,
>
> # Put dyn requests execute records
> log_dyn_requests false
>
> # Print dyn requests or not
> print_dyn false
>
> There is, however, no explanation of what these types of requests are –I
> don’t recall “dyn requests” getting much mention in my over 20 years of
> using FB/IB.
>
> What are “dyn” requests?
>
>
> Sean
>
>
>
>
> 
>


[firebird-support] 64 bit UDF DLL problem on Windows

2017-03-28 Thread Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support]
Hi all,
I hope someone can help me because I'm running out of ideas.
I have an UDF collection written in C language. It works fine on the Linux 
server (Firebird version is: firebird-superclassic-2.5.6.27020.0-1.el7.x86_64)I 
just simply compiled it with gcc, copied the output .so file to Firebird's UDF 
folder and it just works.
Now i want to use this UDF on my Windows development laptop as well, so testing 
would be faster. Firebird installed on my laptop is: 2.5.7.27050, the 64 bit 
version
I took the same C file, compiled it with MinGW 64 bit compiler, copied the 
output to Firebird's UDF folder, declared in the database like:
DECLARE EXTERNAL FUNCTION addnumbers    INTEGER,    INTEGERRETURNS INTEGER BY 
VALUEENTRY_POINT 'sum' MODULE_NAME 'sampledll';

Then i run this select:
SELECT addnumbers(5, 7) FROM rdb$database


I get this error msg: 
can't format message 13:896 -- message file C:\Windows\firebird.msg not 
found.invalid request BLR at offset 36.function ADDNUMBERS is not 
defined.module name or entrypoint could not be found.

I also restarted Firebird, but still no success.
Do you have ideas why it cannot find my UDFs?How could i find more detailed 
information? (Like it doesn't find the file? Or there is a problem finding the 
function in the file? Or are there compatibility issues? Or anything else?)

Thank you,Szilveszter






[firebird-support] How to cill attachment from DB side

2017-03-28 Thread jonatan.laurit...@yahoo.dk [firebird-support]
Hi!

I am running Firebird 2.1 and I am receiving deadlock error with the 
transaction Id. From this Id I can find the attachment with the SQL:
select a.*
  from mon$transactions t
left join mon$attachments a on (t.mon$attachment_id=a.mon$attachment_id)
  where t.mon$transactionid=2264690

From the attachment I can trace the computer and username but user is saying 
that she has no open program. So - the program is ended but the attachment is 
still registered in the server. The question is - how to kill this attachment 
with some SQL command or some gsec, isql, ... command?

Jonatan.
 



Re: [firebird-support] 64 bit UDF DLL problem on Windows

2017-03-28 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
28.03.2017 13:26, Nagy Szilveszter nagy_szilvesz...@yahoo.com 
[firebird-support] wrote:
> Do you have ideas why it cannot find my UDFs?

   First of all, check that your DLL exports 'sum' without mangling.


-- 
   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/



Re: [firebird-support] 64 bit UDF DLL problem on Windows

2017-03-28 Thread Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support]
My sample DLL's source C code is just as simple as this:


#include 
int sum(int a, int b){    return a+b;}


That's all. And it works fine in linux.
How should i modify it?

 

On Tuesday, March 28, 2017 3:22 PM, "Dimitry Sibiryakov s...@ibphoenix.com 
[firebird-support]"  wrote:
 

 28.03.2017 13:26, Nagy Szilveszter nagy_szilvesz...@yahoo.com 
[firebird-support] wrote:
> Do you have ideas why it cannot find my UDFs?

  First of all, check that your DLL exports 'sum' without mangling.


-- 
  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] 64 bit UDF DLL problem on Windows

2017-03-28 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
28.03.2017 15:14, Nagy Szilveszter nagy_szilvesz...@yahoo.com 
[firebird-support] wrote:
> That's all. A nd it wo rks fine in linux.
>
> How should i modify it?

   STFW how to export functions from C++ DLLs.


-- 
   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/



RE: [firebird-support] FBTrace: What are "dyn requests"

2017-03-28 Thread 'Leyne, Sean' s...@broadviewsoftware.com [firebird-support]
SET,

> I don't know what dyn requests are, Sean, but reading a bit I do find dyn
> mentioned in the Firebird book (page 1028) as well as on page 72 of a
> presentation Pavel did at the Firebird conference 2014. First, the Firebird
> book:
> 
> A byte-encoded language for describing data definition statements.
> Firebird's DSQL subsystem parses DDL statements and passes them to a
> component that outputs DYN for interpretation by the Y valve, another
> subsystem that is responsible for updating the system tables.
> 
> Then Pavel:
> BLR & DYN
> You will never need those unless you're Firebird core developer or GPRE
> user.
> Note: BLR & DYN records could be quite long, so set max_blr_length &
> max_dyn_length trace options accordingly.
> 
> Hence, I figured that DYN is something that I - as a normal user - hopefully
> never need to know much about. Does this answer your question, or are you
> interested in a more technical answer from one of the developers?

So, DYN == DDL

OK

What is it with developers, why can't they make things obvious without need to 
dig very deep!

It would have taken no effort to have replace "dyn" with "ddl" and had a 
self-describing config file!

Thanks as always!


Sean



Re: [firebird-support] 64 bit UDF DLL problem on Windows

2017-03-28 Thread Nagy Szilveszter nagy_szilvesz...@yahoo.com [firebird-support]
Excuse me, but i'm looking for helpful answers.
This is not C++ as you can see, but C. And it's very hard to find relevant 
information about C because almost every search result would give C++ or C# 
results when searching for C. Also I'd like to have the same code running on 
both platforms.
I have wasted a lot of time but succes yet to come. Please help if you can.  

On Tuesday, March 28, 2017 4:26 PM, "Dimitry Sibiryakov s...@ibphoenix.com 
[firebird-support]"  wrote:
 

 28.03.2017 15:14, Nagy Szilveszter nagy_szilvesz...@yahoo.com 
[firebird-support] wrote:
> That's all. A nd it wo rks fine in linux.
>
> How should i modify it?

  STFW how to export functions from C++ DLLs.


-- 
  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





   

[firebird-support] Re: FBTrace: What are "dyn requests"

2017-03-28 Thread Dmitry Yemanov dim...@users.sourceforge.net [firebird-support]
28.03.2017 17:41, 'Leyne, Sean' s...@broadviewsoftware.com wrote:
>
> What is it with developers, why can't they make things obvious without need 
> to dig very deep!
>
> It would have taken no effort to have replace "dyn" with "ddl" and had a 
> self-describing config file!

DYN is a legacy DDL language. In the old times, all DDL was converted to 
DYN and then executed as byte code. Now DDL is executed natively, but 
DYN still can be executed via legacy API calls.

So, strictly speaking, DYN = DDL is not always true.


Dmitry




Re: [firebird-support] Inserting/Updating new records with data from previous records

2017-03-28 Thread Alan J Davies alan.dav...@aldis-systems.co.uk [firebird-support]
Thanks Maya, it was a lot more complicated that that. I ended up 
creating a GTT plus a main SP for selecting the delivery notes required 
and calling a second Create SP for inserting into the GTT, then a third 
Clone SP for replicating that data - one record for each label, then 
another Update SP for calculating the no of boxes on each label.

Alan J Davies
Aldis


On 27/03/2017 06:18, Maya Opperman m...@omniaccounts.co.za 
[firebird-support] wrote:
>
>
>>Alan Wrote:
>>Partno, del_qty no_boxes, (pallet_qty, qty_per_box - do not vary for
> each part)
>>ABC 200 10 300 20
>>ABC 200 10 300 20
>>ABC 100 5 300 20
>
>>So far so good, but some of their customers require a second barcode
> label attached to the outer pallet (the 300 above)
>
>>I need to produce 2 pallet labels as follows:
>>Partno, del_qty no_boxes
>>ABC 300 15
>>ABC 200 10
>
> You will need a field to say which pallet the items are in, for example
> palletno.
>
> Then,
>
> select
> partno, palletno, sum(del_qty), sum(no_boxes)
> from yourTable
> group by partno, palletno
>
>
> -Maya
>
> 


[firebird-support] Re: Cursor FETCH in PSQL and ROW_COUNT/'fetch past last record' error

2017-03-28 Thread Dmitry Yemanov dim...@users.sourceforge.net [firebird-support]
28.03.2017 10:06, Martijn Tonies wrote:
>
> So the first 'fetch' operation on a position that's invalid returns
> "rowcount=0",
> any additional fetch (which includes a move) returns an exception?

Yes. Moving cursor from "last" to EOF is perfectly valid, "no data" 
condition is not an error (as per SQL spec). After that, you may fetch 
prior and get the last record back. Moving cursor from EOF further can 
be theoretically processed in two ways: (1) silent no-op (cursor remains 
its position at EOF) and (2) raise an error. The former is somewhat 
error prone (can lead to infinite loops, for example), perhaps this is 
the reason why the engine raises an error instead. This is the logic 
existing since InterBase for DSQL cursors, and it was applied to PSQL 
cursors for consistency.


Dmitry




Re: [firebird-support] Re: Cursor FETCH in PSQL and ROW_COUNT/'fetch past last record' error

2017-03-28 Thread 'Martijn Tonies (Upscene Productions)' m.ton...@upscene.com [firebird-support]
Hello Dmitry,

>28.03.2017 10:06, Martijn Tonies wrote:
>>
>> So the first 'fetch' operation on a position that's invalid returns
>> "rowcount=0",
>> any additional fetch (which includes a move) returns an exception?
>
>Yes. Moving cursor from "last" to EOF is perfectly valid, "no data" 
>condition is not an error (as per SQL spec). After that, you may fetch 
>prior and get the last record back. Moving cursor from EOF further can 
>be theoretically processed in two ways: (1) silent no-op (cursor remains 
>its position at EOF) and (2) raise an error. The former is somewhat 
>error prone (can lead to infinite loops, for example), perhaps this is 
>the reason why the engine raises an error instead. This is the logic 
>existing since InterBase for DSQL cursors, and it was applied to PSQL 
>cursors for consistency.

Right, thanks. Just wanted to get things straight here. 

Got this working in the debugger ;)


With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com