Re: [firebird-support] Blob write to Embedded on Linux performance

2014-06-02 Thread Frank Schlottmann-Gödde fr...@schlottmann-goedde.de [firebird-support]
Am 28.05.2014 11:38, schrieb Mike Ro miker...@gmail.com [firebird-support]:
 
 
 I am sorry to bump this, but has anyone else got experience of using
 blobs on Linux?

Yes, of course,  but I never felt the need to time the operations, we
are using a udf s.th. like:

void EXPORT fn_b_load (  char*  s ,  BLOB b  )
{
  unsigned char *buffer;
  if ( b-blob_handle )
  {
int buffsize = 4096;
FILE *file;
unsigned char *fname = intern_recode(s);
file= fopen ( fname, rb );
if ( file )
{
  buffer= ( unsigned char * ) malloc ( buffsize );
  if ( buffer )
  {
int readSize;
for ( ;; )
{
  readSize = fread ( buffer,1,buffsize, file );
  ( *b-blob_put_segment ) ( b-blob_handle, buffer,readSize );
  if ( readSize != buffsize )
break;
}
free ( buffer );
  }
  fclose ( file );
}
free( fname);
  }
}


to load documents into the database.


I will try to find the time to check thiswith some big mp3's.

fsg


-- 
Fascinating creatures, phoenixes, they can carry immensely heavy loads,
  their tears have healing powers and they make highly faithful pets.
  - J.K. Rowling


Re: [firebird-support] Blob write to Embedded on Linux performance

2014-06-02 Thread Mike Ro miker...@gmail.com [firebird-support]
On 02/06/2014 12:06, Frank Schlottmann-Gödde fr...@schlottmann-goedde.de 
[firebird-support] wrote:


 I am sorry to bump this, but has anyone else got experience of using
 blobs on Linux?

Yes, of course, but I never felt the need to time the operations, we
are using a udf ... to load documents into the database.

I will try to find the time to check this with some big mp3's.

Frank, many thanks for your response, example UDF and testing. I will 
certainly try to implement the UDF later today.


Yesterday I tried the same IBPP code on Windows 8 and it is much faster 
for files ~10Mb in size, but I also tested 500Mb video and performance 
was similar to Linux at that size. As well as my IBPP code, I also 
tested FlameRobin, Database Workbench and FSQL on Windows all with 
broadly similar results.


Unfortunately apart from FlameRobin I couldn't find any simple way to 
load a blob on Linux, so your UDF will be a good comparison for me to make.


I found this interesting blog but unfortunately the code linked to is no 
longer available.


http://codicesoftware.blogspot.com/2008/09/firebird-is-faster-than-filesystem-for.html

Thanks againMike






Re: [firebird-support] Update only changed tuple/ execute if-statement via execute statement?

2014-06-02 Thread eric wulfhekel eric.wulfhe...@gmail.com [firebird-support]
Thank you very much for your arguments/tips.

Pity that there is no more perfomant general trigger - approach. But
recreating triggers - maybe over stored procedures - is also a possibility
for me.

Thank you.

Eric




2014-05-30 17:08 GMT+02:00 Ann Harrison aharri...@ibphoenix.com
[firebird-support] firebird-support@yahoogroups.com:



 On Sat, May 24, 2014 at 8:51 AM, eric wulfhekel eric.wulfhe...@gmail.com
 [firebird-support] firebird-support@yahoogroups.com wrote:


  I want to create a update trigger which sets the current date to a field
 modified if values has changed. I have a lot of tables with a lot of
 columns so i want to work with system table for that task. I build the
 if-statement within a select and wat to execute this statement


 I've left your example below.  You're on the right track.  The actual
 problem you're having is that EXECUTE STATEMENT executes SQL statements.
  You're generating a statement that can be used only in triggers and stored
 procedures.  As Set suggested, a better plan would be to use your current
 approach, but generate actual CREATE TRIGGER statements rather than the
 PSQL.  Yes, that means that you will need to recreate triggers when your
 tables change, but you may be able to do that - or at least signal that
 maintenance is required - with a DDL trigger.

 Alternately you could generate a series of SQL statements - UPDATE ...
 WHERE NEW.field IS DISTINCT FROM OLD.field - and execute them.
  However, that would be horribly inefficient - searching the system tables,
 generating a query, passing that query to the engine where it has to be
 parsed, compiled, optimized, executed, and released - all of that for every
 field in every record you change.  I'd bet that performance would be
 measured not by wall clock, but by calendar.

 Good luck,

 Ann




 Here's the statement you tried and the error...



 CREATE TRIGGER PLZTEST_MODIFIED FOR PLZTEST
 ACTIVE BEFORE UPDATE POSITION 0
 AS
 declare variable stmt varchar(1024);
 begin
 for
 select 'if (new.' || rdb$field_name || ' is null and old.' ||
 rdb$field_name || ' is not null or new.' || rdb$field_name ||
 'is not null and old.' || rdb$field_name || ' is null or new.' ||
 rdb$field_name || '  old.' || rdb$field_name || ') then
 new.MODIFIED = current_timestamp;'
  from rdb$relation_fields
  where rdb$relation_name = 'PLZTEST'
  into :stmt
 do
 execute statement stmt;
 end


 The resulting statement looks good.
 The problem here seems, that i could not execute statements starts with
 if. the error occur is

 Dynamic SQL Error.
 SQL error code = -104.
 Token unknown - line 1, column 1.
 if.

 Or maybe is there another way to realise that?

 Thank you in advance


   



[firebird-support] Select...Join Query

2014-06-02 Thread Jack Cane jwc...@enwphotos.com [firebird-support]
If this is possible in a single query, could you please show me to return the 
'select'-ed column value in the example below, whether or not the FK condition 
is satisfied. 

In following sample query, TableTwo is related to TableOne via foreign key 
relationship):

Select kOne, apples from TableOne join TableTwo on FKone = kOne.

Best,
jwc



[firebird-support] INSERT .. RETURNING not returning any record when using ADO .NET Provider

2014-06-02 Thread Mikkel Nygaard m...@dddretail.com [firebird-support]
Hello all


We are running Firebird on a Cubox (ARM device) with Ubuntu 10.4. I'm using the 
ADO.NET Provider installed via NuGet and almost everything works as it should. 
I'm developing cross-SQL ORM and I've been using the RETURNING statement to 
retrieve the ID (or other trigger-generated values) of a newly inserted row. 
This works like a charm on Oracle and MSSQL but in Firebird the RETURNING 
statement doesn't return anything. The documentation says:


In DSQL, a statement with a RETURNING clause always returns exactly one row. 
If no record was actually inserted, the fields in this row are all NULL. This 
behaviour may change in a later version of Firebird. In PSQL, if no row was 
inserted, nothing is returned, and the receiving variables keep their existing 
values.


No record is returned.


I found this bug report http://tracker.firebirdsql.org/browse/DNET-319 which 
seems to describe my problem, but it was reported 4 years ago and apparently 
not yet solved.


Is there any way for me to get around this issue without having to fix and 
build the code myself, as suggested in the bug report comments?


Best Regards

Mikkel Nygaard


SV: [MULIG SPAM] [firebird-support] Select...Join Query

2014-06-02 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
If this is possible in a single query, could you please show me to return the 
'select'-ed column value in the example below, whether or not the FK condition 
is satisfied.

In following sample query, TableTwo is related to TableOne via foreign key 
relationship):

Select kOne, apples from TableOne join TableTwo on FKone = kOne.

Hi Jack, if the answer is not simply adding the word 'left' or 'right', then I 
don't understand your question.

Hence, if not

Select kOne, apples from TableOne left join TableTwo on FKone = kOne

or

Select kOne, apples from TableOne right join TableTwo on FKone = kOne

is the answer you're looking for, then please rephrase your queston.

HTH,
Set