firebird2.1

Creating table in Firebird script causes “unsuccessful metadata update” with deadlock

帅比萌擦擦* 提交于 2020-01-03 17:27:22
问题 I have the following script that I run using "isql -i scriptfile.sql": CONNECT C:\Databasefile.fdb USER user PASSWORD password; SET TERM !! ; EXECUTE BLOCK AS BEGIN IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'MYTABLE')) THEN EXECUTE STATEMENT 'DROP TABLE MYTABLE;'; END!! SET TERM ; !! CREATE TABLE MYTABLE ( MYCOLUMN VARCHAR(14) NOT NULL ); The very first time I run this (when the table does not already exist) the table is created as expected. If I run the script again I

How can I measure the amount of space taken by blobs on a Firebird 2.1 database?

蹲街弑〆低调 提交于 2019-12-23 09:33:22
问题 I have a production database, using Firebird 2.1, where I need to find out how much space is used by each table, including the blobs. The blob-part is the tricky one, because it is not covered using the standard statistical report. I do not have easy access to the server's desktop, so installing UDFs etc. is not a good solution. How can I do this easily? 回答1: You can count total size of all BLOB fields in a database with following statement: EXECUTE BLOCK RETURNS (BLOB_SIZE BIGINT) AS DECLARE

How can you detect a parent with a nested relationship in a database using SQL?

蓝咒 提交于 2019-12-22 05:10:28
问题 I'm using Firebird 2.1. There is a table name Folders , with the fields: FolderID ParentFolderID FolderName ParentFolderID is -1 if it's the root folder -- otherwise it contains the parent folder's ID. How can I find all parents (up to the root folder) of a low level node? Do I need a recursive query? (Firebird supports them) 回答1: Something like this: WITH RECURSIVE hierarchy (folderid, ParentFolderId, FolderName) as ( SELECT folderid, ParentFolderId, FolderName FROM folders WHERE

Firebird 2.1 - Simple SELECT

南笙酒味 提交于 2019-12-20 03:29:26
问题 I would like to union some data, but a simple select example not working. Selecting existing tables work fine... SELECT 1 as foo Message: can't format message 13:896 -- message file C:\xxxx\firebird.msg not found. Dynamic SQL Error. SQL error code = -104. corrupt pool. In MySQL and Postgres is no problem with these simple select.. Thanks for help! 回答1: Firebird (like many other DBMS) requires a FROM clause. In Oracle you'd use the DUAL table, in Firebird you can use RDB$DATABASE SELECT 1 as

In FirebirdSql, how to return exception message from procedure

♀尐吖头ヾ 提交于 2019-12-17 14:01:28
问题 I want to return the error message from a procedure when an exception happens. In SQL Server you would select the Error_Number() and Error_Message(). How would I do it in FirebirdSql SET TERM ^ ; CREATE PROCEDURE sprocname ( id int ) RETURNS ( gcode int, errmsg varchar(250) ) AS BEGIN gcode = 0; errmsg = ''; -- do procedure code here WHEN ANY DO BEGIN gcode = gdscode; -- ?? errmsg = ??; END SUSPEND; END^ SET TERM ; ^ 回答1: Unfortunately you will need to do that at the client side, as it is

Filter sql based on C# List instead of a filter table

大城市里の小女人 提交于 2019-12-17 09:59:15
问题 Say I have a table with the following data: Now I want to filter by the primary keys department and number. I have a list of department and number combinations that have to be filtered in code. In my mind, I would create a join that results in the following: select * from employee e inner join dynamicTable dyn on e.Department = dyn.Department and e.Number = dyn.Number; dynamicTable is my List in C# code that has the primary keys to filter, but I don't know how to pass this list to the

Granting SELECT on all tables to a user in Firebird 2.1

折月煮酒 提交于 2019-12-14 03:08:42
问题 I've added a user to a Firebird 2.1 instance using gsec , but now I wanted to grant SELECT on all tables to this new user. I could find how to grant this permission on specific tables, but not to them all: GRANT SELECT ON TABLE table TO USER user; If I try to use the new user I get the following error on isql: no permission for read/select access to TABLE table Is there a way to do that on Firebird 2.1? 回答1: Something like this: EXECUTE BLOCK AS DECLARE VARIABLE tablename VARCHAR(32); BEGIN

firebird - codeigniter connection

断了今生、忘了曾经 提交于 2019-12-14 02:44:06
问题 i just moved my project from my laptop to the local server, which is Linux Fedora. my project was working fine when i run it on my laptop but when i moved it to the local server it gave me this error. Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 338 i tried using native php ibase_connect and it's throwing this error Unable to complete network request to host "192.168.4.141". Failed to establish a connection. in /var/www/html

unknown value <Buffer d2 f3 f0 e0 e5 e2 e0 20> when select from firebird in Node.js

拈花ヽ惹草 提交于 2019-12-11 03:35:11
问题 I'm new at firebird. I am trying to fetch the name from DB, but it returns: <Buffer d2 f3 f0 e0 e5 e2 e0 20> What does it mean? How to convert it to readable characters? Thanks in advance db.query('SELECT FIRST 10 * FROM client', function(err, result) { // IMPORTANT: close the connection console.log(result[0].name) db.detach(); }); 回答1: It is a Buffer object (NodeJS docu), which is the usual return value for data, whose type is not predetermined. To convert it to a string again, use its

Insert null into not null column with default FIREBIRD

三世轮回 提交于 2019-12-10 21:52:45
问题 Inserting null into not null column with default is giving me a validation error instead of taking the default value. I don't want to make on before triggers to all of the tables. Is there any other way to do this? Firebird 2.1.3 回答1: The default value is used when you omit a field in the insert, not when you include the field with a null value. Example: Uses default for Name : insert into SomeTable (Id) values (42) Tries to insert null into Name : insert into SomeTable (Id, Name) values (42,