PostgreSQL support array[] type
-
wrote on 15 Feb 2023, 17:03 last edited by
Hello,
Does Qt support query with array[] args?
My task requires a query like thisselect * func(array[3, 4], array[some binary data, some binary data])
I tried to make a concat string, but didn't get a good result. psql driver message said me a about invalid characters utf-8, about slashes, about quotes, null's etc. I think that transform binary data to string query is bad choice. libpq contains native api on C for this, but i can't make a good parameters format for that
Help me, pls -
Hello,
Does Qt support query with array[] args?
My task requires a query like thisselect * func(array[3, 4], array[some binary data, some binary data])
I tried to make a concat string, but didn't get a good result. psql driver message said me a about invalid characters utf-8, about slashes, about quotes, null's etc. I think that transform binary data to string query is bad choice. libpq contains native api on C for this, but i can't make a good parameters format for that
Help me, pls@Reishu Please show a minimal, compilable example from what you did with Qt and why it is needed.
-
@Reishu Please show a minimal, compilable example from what you did with Qt and why it is needed.
wrote on 15 Feb 2023, 18:20 last edited by@Christian-Ehrlicher This is not done on Qt, because it is not clear if the driver supports it.
why it is needed? Becase postgresql support array[] type in args. I wrote a typical query example
-
@Christian-Ehrlicher This is not done on Qt, because it is not clear if the driver supports it.
why it is needed? Becase postgresql support array[] type in args. I wrote a typical query example
@Reishu said in PostgreSQL support array[] type:
This is not done on Qt, because it is not clear if the driver supports it.
So why not try it out instead doing wild guesses?
-
@Reishu said in PostgreSQL support array[] type:
This is not done on Qt, because it is not clear if the driver supports it.
So why not try it out instead doing wild guesses?
wrote on 15 Feb 2023, 20:17 last edited by Reishu@Christian-Ehrlicher said in PostgreSQL support array[] type:
So why not try it out instead doing wild guesses?
ok, i write some details for you, which I did before creating the question
- first, i'm check a documentation https://doc.qt.io/qt-6/sql-types.html - no support this type
- second, i'm check source code of psql driver https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/sqldrivers/psql/qsql_psql.cpp?h=dev - no support PQexecParams \ PQsendQueryParams of libpq api
- third, the only way is make an array[] what i find - concat data in resulting query string. But this is bad, rly. Do not do it
But, Maybe I was wrong and anyone solve this problem? any driver extension? etc
-
@Christian-Ehrlicher said in PostgreSQL support array[] type:
So why not try it out instead doing wild guesses?
ok, i write some details for you, which I did before creating the question
- first, i'm check a documentation https://doc.qt.io/qt-6/sql-types.html - no support this type
- second, i'm check source code of psql driver https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/sqldrivers/psql/qsql_psql.cpp?h=dev - no support PQexecParams \ PQsendQueryParams of libpq api
- third, the only way is make an array[] what i find - concat data in resulting query string. But this is bad, rly. Do not do it
But, Maybe I was wrong and anyone solve this problem? any driver extension? etc
@Reishu said in PostgreSQL support array[] type:
But, Maybe I was wrong and anyone solve this problem? any driver extension? etc
Not when you think you need those parameters to execute your query. I don't even know what it should do and why it's needed.
1/6