[firebird-support] Embedded with FB 3
Hi All In past I have used Embedded to make apps that required no FB (2) install and could simply be copied onto machines. I need to do this for a client running FB 3. I have scanned the notes and find 'A special “embedded library” is no longer required. To make the embedded connection, the standard client loads the appropriate provider and becomes an embedded server.' Does this mean I only need to ship the client library now or is it still an number of files? If it's still a number of files where do I find a list of what files and directory structure is required. I can't seem to find any information on shipping FB 3 as an embedded DB. Thanks Rob
[firebird-support] Alter column not null with constraint name FB3
Hi, I need to add Field not null constraint with my custom name. in previous versions of Firebird we can do: 1. ALTER TABLE XXX ADD FIELDX INTEGER CONSTRAINT NK_XXX__FIELDX NOT NULL; 2. UPDATE TABLE XXX SET FIELDX=some calculations; Now in Firebird 3 this is prohibited on table with data. Then i do this on FB3. 1. ALTER TABLE XXX ADD FIELDX INTEGER; 2. UPDATE TABLE XXX SET FIELDX=some calculations; 3. Add not null - how? I see only ALTER TABLE XXX ALTER FIELDX SET NOT NULL; there are not place for constraint name i need to add Field not null constraint with my custom name. regards, Karol Bieniaszewski
Re: [firebird-support] Embedded with FB 3
On 24-4-2018 01:54, Robert Martin nz...@live.com [firebird-support] wrote: > In past I have used Embedded to make apps that required no FB (2) > install and could simply be copied onto machines. I need to do this for > a client running FB 3. I have scanned the notes and find 'A special > “embedded library” is no longer required. To make the embedded > connection, the standard client loads the appropriate provider and > becomes an embedded server.' > > Does this mean I only need to ship the client library now or is it still > an number of files? If it's still a number of files where do I find a > list of what files and directory structure is required. I can't seem to > find any information on shipping FB 3 as an embedded DB. Yes, it seems that is not explicitly documented in the release notes. In any case, in theory you just need to use the full zip-kit of Firebird server. In practice you can leave some files out (ie the executables, documentation, examples, and some other files), see for an example of files needed my blog-post on using Firebird 3 embedded with Java: https://lawinegevaar.nl/firebird/jaybird_embedded_example.html Mark -- Mark Rotteveel
Re: [firebird-support] Alter column not null with constraint name FB3
On 24-4-2018 09:34, liviuslivius liviusliv...@poczta.onet.pl [firebird-support] wrote: > > > Hi, > I need to add Field not null constraint with my custom name. > in previous versions of Firebird we can do: > 1. ALTER TABLE XXX ADD FIELDX INTEGER CONSTRAINT NK_XXX__FIELDX NOT NULL; Interestingly, that syntax is not documented in the Firebird 2.5 language reference. > 2. UPDATE TABLE XXX SET FIELDX=some calculations; > Now in Firebird 3 this is prohibited on table with data. It is prohibited, unless you apply a default. > Then i do this on FB3. > 1. ALTER TABLE XXX ADD FIELDX INTEGER; > 2. UPDATE TABLE XXX SET FIELDX=some calculations; > 3. Add not null - how? I see only ALTER TABLE XXX ALTER FIELDX SET NOT > NULL; there are not place for constraint name > i need to add Field not null constraint with my custom name. alter table xxx add constraint NK_XXX__FIELDX check (fieldx is NOT NULL) Internally, a `not null`-constraint is just a check constraint. Mark -- Mark Rotteveel
Re: [firebird-support] Alter column not null with constraint name FB3
On 24-4-2018 15:40, Mark Rotteveel m...@lawinegevaar.nl [firebird-support] wrote: > On 24-4-2018 09:34, liviuslivius liviusliv...@poczta.onet.pl > [firebird-support] wrote: >> >> >> Hi, >> I need to add Field not null constraint with my custom name. >> in previous versions of Firebird we can do: >> 1. ALTER TABLE XXX ADD FIELDX INTEGER CONSTRAINT NK_XXX__FIELDX NOT NULL; > > Interestingly, that syntax is not documented in the Firebird 2.5 > language reference. > >> 2. UPDATE TABLE XXX SET FIELDX=some calculations; >> Now in Firebird 3 this is prohibited on table with data. > > It is prohibited, unless you apply a default. > >> Then i do this on FB3. >> 1. ALTER TABLE XXX ADD FIELDX INTEGER; >> 2. UPDATE TABLE XXX SET FIELDX=some calculations; >> 3. Add not null - how? I see only ALTER TABLE XXX ALTER FIELDX SET NOT >> NULL; there are not place for constraint name >> i need to add Field not null constraint with my custom name. > > alter table xxx add constraint NK_XXX__FIELDX check (fieldx is NOT NULL) > > Internally, a `not null`-constraint is just a check constraint. Correction, I was mistaken, and this is not true. It will have equivalent behavior, but it is not 100% the same. In any case, the option to define a named NOT NULL constraint seems to be an undocumented oddity of the alter table syntax. Mark -- Mark Rotteveel
Re: [firebird-support] Alter column not null with constraint name FB3
> > Hi, > I need to add Field not null constraint with my custom name. > in previous versions of Firebird we can do: > 1. ALTER TABLE XXX ADD FIELDX INTEGER CONSTRAINT NK_XXX__FIELDX NOT NULL; >>Interestingly, that syntax is not documented in the Firebird 2.5 >>language reference. it has been available for years. And we use it also in table creation Create table A ( FIELD1 INTEGER CONSTRAINT NK_A_FIELD1 NOT NULL ) and this syntax is interchangeably between Firebird and Interbase. There is difference in message when null is inserted into not null field. In Interbase there is constraint name in message in Firebird it is not included. In Firebird we have “TABLE”.”FieldName” in message. Will be good if Firebird will also contain constraint name. And this is good if user can name all self created constraint in the database like it is for all other PK, FK, UK, CK. You can then have in app standardized handling about e.g. error messages. regards, Karol Bieniaszewski
Re: [firebird-support] Alter column not null with constraint name FB3
On 24-4-2018 20:47, 'livius' liviusliv...@poczta.onet.pl [firebird-support] wrote: > > > > > > Hi, > > I need to add Field not null constraint with my custom name. > > in previous versions of Firebird we can do: > > 1. ALTER TABLE XXX ADD FIELDX INTEGER CONSTRAINT NK_XXX__FIELDX NOT NULL; > > >>Interestingly, that syntax is not documented in the Firebird 2.5 > >>language reference. > it has been available for years. And we use it also in table creation > Create table A > ( > FIELD1 INTEGER CONSTRAINT NK_A_FIELD1 NOT NULL > ) > and this syntax is interchangeably between Firebird and Interbase. > There is difference in message when null is inserted into not null field. > In Interbase there is constraint name in message in Firebird it is not > included. > In Firebird we have “TABLE”.”FieldName” in message. > Will be good if Firebird will also contain constraint name. > And this is good if user can name all self created constraint in the > database like it is for all other PK, FK, UK, CK. > You can then have in app standardized handling about e.g. error messages. Given named not null constraints are an undocumented feature, you can't expect too much from it. I suggest you create tickets to get this documented, and maybe to extend support to allow naming the constraint when using alter table xxx alter yyy set not null. I'd suggest something like expanding ALTER TABLE ADD by adding the option to tconstraint: [CONSTRAINT ] NOT NULL () Or maybe ALTER TABLE ALTER SET [CONSTRAINT ] NOT NULL Although that might conflict with the oddity of also supporting ALTER TABLE ALTER SET NULL, which is not defined in the SQL standard and is not a real constraint, and shouldn't get named. Interestingly, the SQL standard also supports named not null constraints, but there also naming it using ALTER COLUMN ... SET NOT NULL is not supported. Mark -- Mark Rotteveel