1

Topic: SQL request insert and readonly-fields

Procedure (Delphi) makes in a cycle request "UPDATE OR INSERT INTO...."
How to understand/define, what this or that field is readonly?
I see that FibPlus is able to generate the correct request where there are no calculated fields where there are no fields which "came" from JOIN tables.
That it was more clear. There is a request:

SELECT
A.ID;
A.INPUT_DATE;
A.LCD;
T.NAME TYPE_NAME;
A.PHONES_LIST/* calculated */
FROM
APART A
LEFT JOIN TYPES T ON A.ID_TYPE = T.ID

FibPlus generates:

INSERT INTO APART (
ID;
INPUT_DATE;
LCD
)
VALUES (
:ID;
:INPUT_DATE;
:LCD
)

There are no fields TYPE_NAME and PHONES_LIST.
But at me is not present primary SQL request since I fulfill import from XML a file. In XML a file a dial-up of all fields, including TYPE_NAME, and PHONES_LIST.
And here it is necessary to understand/define somehow that TYPE_NAME and PHONES_LIST it is not necessary to import.
Access to basis where it is necessary to import the data, at the program is.
Firebird 2.5

2

Re: SQL request insert and readonly-fields

X11;
To subtract from basis table structure
And to compare fields not to offer?

3

Re: SQL request insert and readonly-fields

Well why not to offer?
And how to understand, what the field not simply is present, but it only for reading?
In the table there is a field, for example, PHONES_LIST, but it calculated.

4

Re: SQL request insert and readonly-fields

X11 wrote:

Well why not to offer?
And how to understand, what the field not simply is present, but it only for reading?
In the table there is a field, for example, PHONES_LIST, but it calculated.

It will be tightened more knowing and prompt
. How much I remember
RDB$FIELDS.RDB$COMPUTED_SOURCE
But I am possible and I am mistaken

5

Re: SQL request insert and readonly-fields

X11 wrote:

I see that FibPlus is able to generate the correct request

  go in source codes, look as they it do.

6

Re: SQL request insert and readonly-fields

There fiendish difficulty smile))

7

Re: SQL request insert and readonly-fields

I  RDB$RELATION_FIELDS. RDB$UPDATE_FLAG

8

Re: SQL request insert and readonly-fields

X11 wrote:

FROM APART A LEFT JOIN TYPES T ON A.ID_TYPE = T.ID

Trouble in that select - too floppy tool.
He can read the data from tables, from , from procedures, from foreign tables etc.
Except columns there there can be expressions, subqueries etc.
And application often does not know whence what value comes crawling, on what objects of a DB   request (above "TYPES T" is that, the table, , procedure? The request of it does not know and cannot know, only the server)
More shortly, IMHO, it is necessary to request to do Prepare and when the server returns the prepared data (the information how to create and assort  in  for reading of lines) - already in this answer to look where there that, where updated, and where read-only.

9

Re: SQL request insert and readonly-fields

m7m wrote:

it is passed...
It will be tightened more knowing and prompt
. How much I remember
RDB$FIELDS.RDB$COMPUTED_SOURCE
But I am possible and I am mistaken

extern const wchar_t* const ib_sys_query_get_updatable_columns =
L "select rf.rdb$field_name as field_name\n"
L "from rdb$relation_fields rf\n"
L "join rdb$fields f\n"
L "on rf.rdb$field_source=f.rdb$field_name\n"
L "where rf.rdb$relation_name =? and\n"
L "(f.rdb$computed_blr is NULL)";