[Firebird-devel] A new Rust driver

2020-08-23 Thread Luis Fernando Batels
Hi!

I would like to share a new lib for use the Firebird in Rust programming
language, and currently the only one:
https://github.com/fernandobatels/rsfbclient.

We are using the official fbclient, but one of contributors is also working
on a native Rust implementation.


-- 
Att, Luis Fernando Batels.
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Adriano dos Santos Fernandes
Em dom, 23 de ago de 2020 09:18, Mark Rotteveel 
escreveu:

> On 23-08-2020 13:43, Dimitry Sibiryakov wrote:
> > 23.08.2020 03:39, Adriano dos Santos Fernandes wrote:
> >> I have created RDB$BLOB_UTIL package pull request:
> >
> >AFAICS this package is based on UDR. Does it really have to be
> > system? May be it would be better to make it optionally declarable as
> > any other UDR: just library and SQL script.
>

Not exactly, it needs transaction events not present in external engines.



> What is your argument against making it built-in? Having it built-in
> ensures that you can rely on it being present without having to take
> explicit action.
>

Yes, and that is very good when talking about core functionality.

And in code it's very modular and adds minimal things to "core's core".


Adriano
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Dimitry Sibiryakov

23.08.2020 14:17, Mark Rotteveel wrote:

What is your argument against making it built-in?


  Actually none except may be security. I don't know whether execution permissions can be 
granted or revoked for system packages.
  I just have a feeling that Oracle-compatible set of packages can be more handy as an 
independent project.


--
  WBR, SD.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Adriano dos Santos Fernandes
Em dom, 23 de ago de 2020 05:03, Mark Rotteveel 
escreveu:

> I'm wondering if it would be possible to make the PSQL compiler a little
> bit more intelligent and do such optimizations automatically.
>

By definition you cannot write to a created (and already closed) blob if
you reopen it. And PSQL does that, create, append and close blob so it can
be used immediately.

There is also the request internals... Perhaps losting one or two years on
it to support such things.


Adriano
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Adriano dos Santos Fernandes
Em dom, 23 de ago de 2020 05:10, Mark Rotteveel 
escreveu:

> I haven't looked in depth, but as far as I can tell, this only handles
> binary blobs. Is that correct?
>

I have initially tought to support text operations explicitly too but in
the end I found it unneccessary.

You just need to call append with the data in the correct charset.

The data will be validated to the field charset when assigned.

More advanced operations for blob filters usage and charset transliteration
may be added.


Adriano
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Mark Rotteveel

On 23-08-2020 13:43, Dimitry Sibiryakov wrote:

23.08.2020 03:39, Adriano dos Santos Fernandes wrote:

I have created RDB$BLOB_UTIL package pull request:


   AFAICS this package is based on UDR. Does it really have to be 
system? May be it would be better to make it optionally declarable as 
any other UDR: just library and SQL script.


What is your argument against making it built-in? Having it built-in 
ensures that you can rely on it being present without having to take 
explicit action.


Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Dimitry Sibiryakov

23.08.2020 03:39, Adriano dos Santos Fernandes wrote:

I have created RDB$BLOB_UTIL package pull request:


  AFAICS this package is based on UDR. Does it really have to be system? May be it would 
be better to make it optionally declarable as any other UDR: just library and SQL script.


--
  WBR, SD.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] ODP: RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Karol Bieniaszewski
>>PSQL compiler a little 
>>bit more intelligent and do such optimizations automatically.

It should be more inteligent as this is simple task.
Blob should have flag like returned outside. If set then new blob should be 
created if false it is simple appended.

E.g. in this loop there is no need to create blob as it is not returned
>  while (i < 150)
>  do
>  begin
>  b = b || s;
>  i = i + 1;
>  end


But e.g. here (e.g. blob b is in returning values)

>  while (i < 150)
>  do
>  begin
>  b = b || s;
>  if i mod 10=0 then
> susspend;
>  i = i + 1;
>  end

Every 10 loop there is need to new one blob to create – as susspend return blob 
outside.
Only should be identified situations when „blob is returned” occure. If it 
sussped or more situations like 

>> insert into t (b) values (:b);

Only need to set flag for blob in that situations and in next assignment create 
new one with flag set to false

Regards,
Karol Bieniaszewski
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Mark Rotteveel
I haven't looked in depth, but as far as I can tell, this only handles 
binary blobs. Is that correct?


Mark

On 23-08-2020 03:39, Adriano dos Santos Fernandes wrote:

Hi!

I have created RDB$BLOB_UTIL package pull request:

https://github.com/FirebirdSQL/firebird/pull/281

Here is a test comparing how problematic is the current approach (which
has exponential time complexity and space storage) of creating blobs in
PSQL with the RDB$BLOB_UTIL approach.

Current:

--
Takes 0m12,772s and resulting database has 117334016 size

isql -term !
create database 'b.fdb'!

create table t (b blob sub_type binary)!

execute block
as
 declare b blob;
 declare s varbinary(1) = '0';
 declare i integer;
begin
 i = 1;
 while (i < 1)
 do
 begin
 s = s || '0';
 i = i + 1;
 end

 b = s;

 i = 1;
 while (i < 150)
 do
 begin
 b = b || s;
 i = i + 1;
 end

 insert into t (b) values (:b);
end!

commit!
--


RDB$BLOB_UTIL:

--
Takes 0m0,502s and resulting database has 3383296 size.

isql -term ! -ch utf8
create database 'b.fdb'!

create table t (b blob sub_type binary)!

execute block
as
 declare bh integer;
 declare b blob;
 declare s varbinary(1) = '0';
 declare i integer;
begin
 bh = rdb$blob_util.new(false, false);

 i = 1;
 while (i < 1)
 do
 begin
 s = s || '0';
 i = i + 1;
 end

 i = 0;
 while (i < 150)
 do
 begin
 execute procedure rdb$blob_util.append(bh, s);
 i = i + 1;
 end

 insert into t (b) values (rdb$blob_util.make_blob(:bh));
end!

commit!
--


Adriano


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel




--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] RFC: RDB$BLOB_UTIL system package

2020-08-23 Thread Mark Rotteveel
I'm wondering if it would be possible to make the PSQL compiler a little 
bit more intelligent and do such optimizations automatically.


Mark

On 23-08-2020 03:39, Adriano dos Santos Fernandes wrote:

I have created RDB$BLOB_UTIL package pull request:

https://github.com/FirebirdSQL/firebird/pull/281

Here is a test comparing how problematic is the current approach (which
has exponential time complexity and space storage) of creating blobs in
PSQL with the RDB$BLOB_UTIL approach.

Current:

--
Takes 0m12,772s and resulting database has 117334016 size

isql -term !
create database 'b.fdb'!

create table t (b blob sub_type binary)!

execute block
as
 declare b blob;
 declare s varbinary(1) = '0';
 declare i integer;
begin
 i = 1;
 while (i < 1)
 do
 begin
 s = s || '0';
 i = i + 1;
 end

 b = s;

 i = 1;
 while (i < 150)
 do
 begin
 b = b || s;
 i = i + 1;
 end

 insert into t (b) values (:b);
end!

commit!
--


RDB$BLOB_UTIL:

--
Takes 0m0,502s and resulting database has 3383296 size.

isql -term ! -ch utf8
create database 'b.fdb'!

create table t (b blob sub_type binary)!

execute block
as
 declare bh integer;
 declare b blob;
 declare s varbinary(1) = '0';
 declare i integer;
begin
 bh = rdb$blob_util.new(false, false);

 i = 1;
 while (i < 1)
 do
 begin
 s = s || '0';
 i = i + 1;
 end

 i = 0;
 while (i < 150)
 do
 begin
 execute procedure rdb$blob_util.append(bh, s);
 i = i + 1;
 end

 insert into t (b) values (rdb$blob_util.make_blob(:bh));
end!

commit!
--


--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel