Re: [firebird-support] Re: Unicode text in Exception?

2015-01-22 Thread 'Martijn Tonies (Upscene Productions)' m.ton...@upscene.com [firebird-support]
btw, in Firebird 3, the RDB$EXCEPTIONS.RDB$MESSAGE is still NONE.



>> Oh bugger.
>>
>> Now, I tried the following in the procedure to work around the above:
>>
>> exception test _utf8 'unicode string here';
>>
>> When I look at RDB$PROCEDURES.RDB$PROCEDURE_SOURCE I can see
>> the text is inserted as a hex string.
>>
>> But this doesn't seem to work either?
>>
>> Does this work at all with Exceptions?
>
>AFAIU, your trick (exception parameter) should work.

Hmm, I'm puzzled then, cause it doesn't seem to work at first sight.


With regards,

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

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!



Posted by: "Martijn Tonies (Upscene Productions)" 


++

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] Re: Firebird Embedded open database file on network share

2015-01-22 Thread ralf.erdm...@web.de [firebird-support]
Thanks Ann.
So I now know I had no good idea with the network share :-)

I thought it possible because I read that firebird embedded is at most the same 
engine as the firebird server.
But obviously I didn't thought about such implications.

Thanks to all who took time to help me,
Ralf

Re: [firebird-support] Re: Firebird Embedded open database file on network share

2015-01-22 Thread Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
On 22 Jan 2015 01:06:28 -0800, "ralf.erdm...@web.de [firebird-support]"
 wrote:
> Thanks Ann.
> So I now know I had no good idea with the network share :-)
> 
> I thought it possible because I read that firebird embedded is at most
the
> same engine as the firebird server.
> But obviously I didn't thought about such implications.

The engine is the same, and Firebird server would have the exact same
problem if you would attempt to let multiple Firebird server instances
access the same database from a network share.

If you want to access a Firebird database over a network, use a single
Firebird server instance.

Mark


[firebird-support] Common Table Expressions (“WITH ... AS ... SELECT”)

2015-01-22 Thread masb...@za-management.com [firebird-support]
Hi to all,
I am in the process of writing a list of entries with running costs in a 
quarter and all costs that have arsien since. 
So, I wrote a stored procedure with the mathematical logic for calculating the 
respective sums with different rates of exchange and some other rules. I made 
this procedure flexible so that it either returns all costs for a given period 
(e.g. quarter) or all costs until a certain point of time. 

The resulting structure for the lists basically looks like this:

with costs_in_period as 
(select cp1.file_id, cp1.costs as costsinquarter 
from cost_procedure (periodfrom,periodto) cp1)
 

 select 

 cp2.file_id, cip.costsinquarter, cp2.costs as costssofar

 from cost_procedure (null,periodto) cp2
 left join costs_in_period cip

 on cip.file_id = cp2.file_id
 

 I now have about 7000 cases and both queries incividually take about 2-5 
minutes to query.
 But when I now use the above given CTE structure I killed the running 
transaction after 5 hours running time.
 

 I thought that firebird does nothing else as individually running the two 
queries and then joining them. But it seems to me that it queries the CTE for 
each entry in the main query.
 Am I making something wrong and/or is there a better way of doing that?
 

 Kind regards and thanks for an answer in advance
 Christian



Re: [firebird-support] Re: Firebird Embedded open database file on network share

2015-01-22 Thread Ann Harrison aharri...@ibphoenix.com [firebird-support]

> On Jan 22, 2015, at 5:06 AM, ralf.erdm...@web.de [firebird-support] 
>  wrote:
> 
> So I now know I had no good idea with the network share :-)

I hope I made that clear :-)
> 
> I thought it possible because I read that firebird embedded is at most the 
> same engine as the firebird server.

It is.  But the Shared Server has a single process mediating all physical 
access to the database file and the Classic Server uses interprocess 
communication to avoid physical access conflicts.
The Embedded Engine mediates conflicts between connections it makes, but has no 
way to detect the existence of other Embedded Engines accessing the file 
through a network share.

Good luck,

Ann
> 


Re: [firebird-support] Unlock record

2015-01-22 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
>I looked in a database, and in MON$STATEMENTS tabla I have the following 
>fields:

MON$STATEMENT_ID
MON$ATTACHMENT_ID
MON$TRANSACTION_ID
MON$STATE
MON$TIMESTAMP
MON$SQL_TEXT
MON$STAT_ID

>How can I detect which is the record I have to delete to unlock my record? 
>This is the only table I have to modify?

I typically just look at the mon$sql_text with a mon$timestamp that seems to be 
the correct one.

HTH,  Set

 Mensaje original ---
>> May be I can modify or delete some record in any MON$ table or do some other 
>> thing?

>I typically locate and delete records from MON$STATEMENTS. Mind you, that is 
>2.5 and typically when I have a long-
>running query. Don't know whether deleting from this table is possible or safe 
>with 2.1 or sensible WITH LOCK.


Re: [firebird-support] Common Table Expressions (“WITH ... AS ... SELECT”)

2015-01-22 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
Sorry for top-posting, I'm not currently at a real computer.

I guess you'Re right in that the CTE is called once for each iteration. Since 
you're joining on output and not input fields, that probably would not be 
necessary,  but maybe Firebird doesn't optimizer such - somewhat unusual - 
cases.

7000 cases is peanuts, and even 2-5 minutes seems too long. Typically,  I would 
probably use something like

IIF ( between :PeriodFrom, :PeriodTo), costs, 0)

and modify your SP to return an additional field, but how to best solve this 
requires knowledge of your SP. So, could you show it to us or is it too complex 
or secret?

Set


Hi to all,
I am in the process of writing a list of entries with running costs in a 
quarter and all costs that have arsien since.
So, I wrote a stored procedure with the mathematical logic for calculating the 
respective sums with different rates of exchange and some other rules. I made 
this procedure flexible so that it either returns all costs for a given period 
(e.g. quarter) or all costs until a certain point of time.

The resulting structure for the lists basically looks like this:

with costs_in_period as
(select cp1.file_id, cp1.costs as costsinquarter
from cost_procedure (periodfrom,periodto) cp1)


select

cp2.file_id, cip.costsinquarter, cp2.costs as costssofar

from cost_procedure (null,periodto) cp2

left join costs_in_period cip

on cip.file_id = cp2.file_id


I now have about 7000 cases and both queries incividually take about 2-5 
minutes to query.

But when I now use the above given CTE structure I killed the running 
transaction after 5 hours running time.


I thought that firebird does nothing else as individually running the two 
queries and then joining them. But it seems to me that it queries the CTE for 
each entry in the main query.

Am I making something wrong and/or is there a better way of doing that?


Kind regards and thanks for an answer in advance

Christian






++

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] Re: Common Table Expressions (“WITH ... AS ... SELECT”)

2015-01-22 Thread Dmitry Yemanov dim...@users.sourceforge.net [firebird-support]
22.01.2015 21:13, Svein Erling Tysvær wrote:

> I guess you'Re right in that the CTE is called once for each iteration.

It's not about CTE, but about outer joins. Inner part of the left join 
is always [re-]evaluated for the every outer row.


Dmitry








++

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] Re: Optimising High Latency Database Connections

2015-01-22 Thread gare...@acm.org [firebird-support]
Thank you very much Carlos and un_spoken for your help. 

 We look forward to the improvements Firebird 3.0 will bring.
 

 Kind regards,
 Gareth