Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIT_AND not found [CORE4329] #4652

Closed
firebird-automations opened this issue Jan 31, 2014 · 7 comments
Closed

BIT_AND not found [CORE4329] #4652

firebird-automations opened this issue Jan 31, 2014 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Firebird User unter Windows7 (winfire)

Defining a view using BIT_AND does not work:

StepVersion is BIGINT, embedded Firebird Database Dlls are 32 Bit.

CREATE VIEW MyView AS SELECT CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 48), 0xFFFF) as varchar(32)) || '.' || CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 32), 0xFFFF) as varchar(32)) || CASE BIT_AND(BIN_SHR(max(SRC3.StepVersion), 16), 0xFFFF) WHEN 0xFFFF THEN '' ELSE '.' || CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 16), 0xFFFF) as varchar(32)) END || CASE BIT_AND(max(SRC3.StepVersion), 0xFFFF) WHEN 0xFFFF THEN '' ELSE '.' || CAST(BIT_AND(max(SRC3.StepVersion), 0xFFFF) as varchar(32)) END AS CurrentVersionInfo FROM MyTable AS SRC3

FirebirdSql.Data.FirebirdClient.FbException: Dynamic SQL Error
SQL error code = -804
Function unknown
BIT_AND ---> FirebirdSql.Data.Common.IscException: Dynamic SQL Error
SQL error code = -804
Function unknown
BIT_AND

This works:
select BIN_AND(BIN_SHR(max(3454654546546544), 48), 0xFFFF) from rdb$database

I thought BIT_AND is a internal function and is available for INT and BIGINT.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

> I thought BIT_AND is a internal function
You are wrong. There is no such internal function.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Firebird User unter Windows7 (winfire)

Sorry, than change your Documentation:

http://www.firebirdsql.org/refdocs/langrefupd21-intfunc-bin_and.html

BIN_AND()

Available in: DSQL, PSQL

Added in: 2.1

Description: Returns the result of the bitwise AND operation on the argument(s).

Result type: INTEGER or BIGINT

---

How can I use it for INTEGER and BIGINT?
And why does this work?
select BIN_AND(BIN_SHR(max(3454654546546544), 48), 0xFFFF) from rdb$database

@firebird-automations
Copy link
Collaborator Author

Modified by: Firebird User unter Windows7 (winfire)

description: Defining a view using BIT_AND does not work:

CREATE VIEW MyView AS SELECT CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 48), 0xFFFF) as varchar(32)) || '.' || CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 32), 0xFFFF) as varchar(32)) || CASE BIT_AND(BIN_SHR(max(SRC3.StepVersion), 16), 0xFFFF) WHEN 0xFFFF THEN '' ELSE '.' || CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 16), 0xFFFF) as varchar(32)) END || CASE BIT_AND(max(SRC3.StepVersion), 0xFFFF) WHEN 0xFFFF THEN '' ELSE '.' || CAST(BIT_AND(max(SRC3.StepVersion), 0xFFFF) as varchar(32)) END AS CurrentVersionInfo FROM MyTable AS SRC3

FirebirdSql.Data.FirebirdClient.FbException: Dynamic SQL Error
SQL error code = -804
Function unknown
BIT_AND ---> FirebirdSql.Data.Common.IscException: Dynamic SQL Error
SQL error code = -804
Function unknown
BIT_AND

This works:
select BIN_AND(BIN_SHR(max(3454654546546544), 48), 0xFFFF) from rdb$database

I thought BIT_AND is a internal function and is available for INT and BIGINT.

=>

Defining a view using BIT_AND does not work:

StepVersion is BIGINT, embedded Firebird Database Dlls are 32 Bit.

CREATE VIEW MyView AS SELECT CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 48), 0xFFFF) as varchar(32)) || '.' || CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 32), 0xFFFF) as varchar(32)) || CASE BIT_AND(BIN_SHR(max(SRC3.StepVersion), 16), 0xFFFF) WHEN 0xFFFF THEN '' ELSE '.' || CAST(BIT_AND(BIN_SHR(max(SRC3.StepVersion), 16), 0xFFFF) as varchar(32)) END || CASE BIT_AND(max(SRC3.StepVersion), 0xFFFF) WHEN 0xFFFF THEN '' ELSE '.' || CAST(BIT_AND(max(SRC3.StepVersion), 0xFFFF) as varchar(32)) END AS CurrentVersionInfo FROM MyTable AS SRC3

FirebirdSql.Data.FirebirdClient.FbException: Dynamic SQL Error
SQL error code = -804
Function unknown
BIT_AND ---> FirebirdSql.Data.Common.IscException: Dynamic SQL Error
SQL error code = -804
Function unknown
BIT_AND

This works:
select BIN_AND(BIN_SHR(max(3454654546546544), 48), 0xFFFF) from rdb$database

I thought BIT_AND is a internal function and is available for INT and BIGINT.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

What should we change ? Are you see the difference between BIT_AND (non-existing) and BIN_AND (existing and working) ?
BIT and BIN is a bit different set of chars, isn't is ? Look at 3rd character T vs N :)

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Firebird User unter Windows7 (winfire)

Oh, thanks. I come from Oracle (BITAND) and so I really haven't seen the small but important difference.
Sorry about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant