TZQuery opens a temporary table, all fields are read-only?
Moderators: gto, cipto_kh, EgonHugeist
TZQuery opens a temporary table, all fields are read-only?
hello.
I use ZQuery to create a temporary table, and then open it, the fields are all read-only.
The database is mssql, zeos is 8.0
I use ZQuery to create a temporary table, and then open it, the fields are all read-only.
The database is mssql, zeos is 8.0
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: TZQuery opens a temporary table, all fields are read-only?
Hello,
yes - that might happen. I seem to rememeber something like this. The problem seems to be that we cannot get metadata for temporary tables - or at least we don't know how to get metadata for temporary tables.
Best regards,
Jan
yes - that might happen. I seem to rememeber something like this. The problem seems to be that we cannot get metadata for temporary tables - or at least we don't know how to get metadata for temporary tables.
Best regards,
Jan
Re: TZQuery opens a temporary table, all fields are read-only?
hello
Is there a way to solve this problem? Temporary tables are often used to read and write data.
Metadata can be obtained from tempdb. Before exec sp_columns, use tempdb to get no metadata.
Is there a way to solve this problem? Temporary tables are often used to read and write data.
Metadata can be obtained from tempdb. Before exec sp_columns, use tempdb to get no metadata.
Re: TZQuery opens a temporary table, all fields are read-only?
[Redacted thing I posted when I thought this was for MySQL and not SQLServer! Apologies!]
-Mark
-Mark
Last edited by MJFShark on 18.12.2021, 15:27, edited 1 time in total.
Re: TZQuery opens a temporary table, all fields are read-only?
The database I use is MS SQL Server, and the temporary table created is in the database tempdb, from which the metadata of the table can be obtained.
Re: TZQuery opens a temporary table, all fields are read-only?
I have zero experience with temporary tables but I have a MSSQL server at home to test on.
If you can provide the queries to execute I can try to take a look at the issue.
P.s.: I'm using DBLib to connect, not ODBC or ADO.
If you can provide the queries to execute I can try to take a look at the issue.
P.s.: I'm using DBLib to connect, not ODBC or ADO.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: TZQuery opens a temporary table, all fields are read-only?
hello
I made a test example, you can test it, the database is ms sql server.
I made a test example, you can test it, the database is ms sql server.
You do not have the required permissions to view the files attached to this post.
Last edited by zhuyl on 20.12.2021, 12:57, edited 1 time in total.
Re: TZQuery opens a temporary table, all fields are read-only?
...and where can I find it, exactly? :)
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: TZQuery opens a temporary table, all fields are read-only?
hello
I forgot to upload, I am uploading now.
I forgot to upload, I am uploading now.
You do not have the required permissions to view the files attached to this post.
Re: TZQuery opens a temporary table, all fields are read-only?
Hello
Can the problem be solved?
Can the problem be solved?
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: TZQuery opens a temporary table, all fields are read-only?
Hello zhuyl,
I introduced some changes in Zeos 8.0 to allow writing top temporary tables. Please note that currently autoinc fields are not supported by the code. I don't plan to backport these changes to Zeos 7.2. So please upgrade to Zoes 8.0.
Best regards,
Jan
I introduced some changes in Zeos 8.0 to allow writing top temporary tables. Please note that currently autoinc fields are not supported by the code. I don't plan to backport these changes to Zeos 7.2. So please upgrade to Zoes 8.0.
Best regards,
Jan
Re: TZQuery opens a temporary table, all fields are read-only?
Merry Christmas to everyone!
@ zhuyl,
I'm sorry; I promised myself that I'll spend every free minute of my vacation time with my daughter, therefore I had zero time to look into the issue deeply enough. I see Jan jumped on the topic too, so no worries.
@ Jan,
Taking the example from here, with your modifications included the fields are still read only.
@ zhuyl,
I'm sorry; I promised myself that I'll spend every free minute of my vacation time with my daughter, therefore I had zero time to look into the issue deeply enough. I see Jan jumped on the topic too, so no worries.
@ Jan,
Taking the example from here, with your modifications included the fields are still read only.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: TZQuery opens a temporary table, all fields are read-only?
Hi aehimself, All,
Merry Christmas to everyone!
1. It works for me (in conjunction with TZUpdateSQL).
I am enclosing an example: 2. What do you think about:
viewtopic.php?f=50&p=185826#p185826
Michał
Merry Christmas to everyone!
1. It works for me (in conjunction with TZUpdateSQL).
I am enclosing an example: 2. What do you think about:
viewtopic.php?f=50&p=185826#p185826
Michał
You do not have the required permissions to view the files attached to this post.
Re: TZQuery opens a temporary table, all fields are read-only?
Merry Christmas to everyone!
test has the following problems:
1. There is a problem with the SQL statement without a table, such as ‘select getdate()’. Debugging to unit ZSybaseAnalyser.pas: TZSybaseStatementAnalyser.DefineSelectSchemaFromQuery error.
2. Using temporary tables under SQL 2000 will cause errors. Debugging to the unit ZDbcDbLibMetadata.pas: exec tempdb.sys.sp_columns has an error, can you change it to exec tempdb.dbo.sp_columns to be compatible with SQL2000?
3. When the data has non-English characters (such as Chinese), it will be wrong to save to the temporary table.
In addition, I found a problem that caused garbled characters, ZQuery1.FieldByName('CName').AsString:='程序abcd员', when garbled characters appeared when posting, debug to unit ZEncoding.pas: ZDetectUTF8Encoding function: if (EndPtr-Source > SizeOf(PCardinal)) and (PCardinal(Source)^ and $80808080 = 0) //Check quad block ASCII again
then inc(Source, SizeOf(PCardinal)) //SizeOf(PCardinal) here should be changed to: SizeOf(Cardinal)
else Inc(Source);
test has the following problems:
1. There is a problem with the SQL statement without a table, such as ‘select getdate()’. Debugging to unit ZSybaseAnalyser.pas: TZSybaseStatementAnalyser.DefineSelectSchemaFromQuery error.
2. Using temporary tables under SQL 2000 will cause errors. Debugging to the unit ZDbcDbLibMetadata.pas: exec tempdb.sys.sp_columns has an error, can you change it to exec tempdb.dbo.sp_columns to be compatible with SQL2000?
3. When the data has non-English characters (such as Chinese), it will be wrong to save to the temporary table.
In addition, I found a problem that caused garbled characters, ZQuery1.FieldByName('CName').AsString:='程序abcd员', when garbled characters appeared when posting, debug to unit ZEncoding.pas: ZDetectUTF8Encoding function: if (EndPtr-Source > SizeOf(PCardinal)) and (PCardinal(Source)^ and $80808080 = 0) //Check quad block ASCII again
then inc(Source, SizeOf(PCardinal)) //SizeOf(PCardinal) here should be changed to: SizeOf(Cardinal)
else Inc(Source);