Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Databases
»
[ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
You can embed Windows Con...
by
Fibonacci
[
Today
at 04:18:40 am]
Conscious Artificial Inte...
by
schuler
[
Today
at 02:42:53 am]
Implementing an Elo ratin...
by
mas steindorff
[
Today
at 02:22:34 am]
[New Component] ExtTabCtr...
by
jianwt
[
Today
at 02:21:39 am]
Can /my/ AI help me with ...
by
microxa
[
Today
at 12:56:29 am]
IndySecOpenSSL is now ava...
by
TheMouseAUS
[
Today
at 12:08:51 am]
RunFormula: math expressi...
by
stormray
[June 17, 2026, 10:32:05 pm]
Codepage issue in console...
by
ASerge
[June 17, 2026, 09:36:27 pm]
Pdf Viewer in Pascal
by
Tomxe
[June 17, 2026, 07:18:20 pm]
Canvas size
by
Thaddy
[June 17, 2026, 07:15:50 pm]
[Reopened] TSaveDialog
by
Thaddy
[June 17, 2026, 05:12:17 pm]
What am I missing here? [...
by
Thaddy
[June 17, 2026, 03:39:02 pm]
Questions about 16 color ...
by
wp
[June 17, 2026, 01:45:07 pm]
TCHATGPT — An Artificial ...
by
Weiss
[June 17, 2026, 07:00:13 am]
FPC Unleashed (inline var...
by
440bx
[June 16, 2026, 11:53:51 pm]
RFC: Separation of MCU an...
by
ackarwow
[June 16, 2026, 11:06:14 pm]
Error with last fixes_3.2...
by
patyit
[June 16, 2026, 09:49:02 pm]
Mundo Medieval 3D MMORPG ...
by
Rodrigo Robles
[June 16, 2026, 06:06:17 pm]
Which Control should I us...
by
wp
[June 16, 2026, 05:08:55 pm]
Just Question App paramet...
by
eldonfsr
[June 16, 2026, 04:50:19 pm]
Content is distorting / w...
by
Handoko
[June 16, 2026, 03:53:02 pm]
ZxTune chiptunes player
by
Guva
[June 16, 2026, 12:41:14 pm]
Onscroll event for Tscrol...
by
laz_one_or2
[June 16, 2026, 11:16:39 am]
Fpcupdeluxe
by
CharlyTango
[June 16, 2026, 10:35:33 am]
Compiling Qt6 project on ...
by
wp
[June 16, 2026, 10:14:53 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB (Read 1093 times)
rdxdt
New Member
Posts: 12
[ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
«
on:
June 13, 2025, 02:53:10 pm »
Hello, i'm porting an application and i have to do the following query
Code: SQL
[Select]
[+]
[-]
SELECT
venda_pagamento
.
id
,
venda_pagamento
.
pagamento_id
,
SUM
(
venda_pagamento
.
valor
)
AS
valor_total
,
forma_pagamento
.
tipo
FROM
venda_pagamento
INNER
JOIN
forma_pagamento
ON
venda_pagamento
.
pagamento_id
=
forma_pagamento
.
id
WHERE
venda_pagamento
.
venda_id
IN
(
:venda_ids
)
GROUP
BY
venda_pagamento
.
pagamento_id
,
venda_pagamento
.
id
,
forma_pagamento
.
tipo
How can i set the parameter :venda_ids to be a list of integers for that query on MariaDB
The SQL Syntax would be like
Code: SQL
[Select]
[+]
[-]
venda_pagamento
.
venda_id
IN
(
1
,
3
,
4
,
6
,
8
,
9
,
11
,
12
,
19
)
Logged
zeljko
Hero Member
Posts: 1959
Re: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
«
Reply #1 on:
June 13, 2025, 03:57:48 pm »
YourParam
.AsString := YourStringList.CommaText ? (contains numbers in TStringList)
Logged
rdxdt
New Member
Posts: 12
Re: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
«
Reply #2 on:
June 13, 2025, 04:13:21 pm »
If the parameter type is ftString then it will have this result
Code: SQL
[Select]
[+]
[-]
venda_pagamento
.
venda_id
IN
(
'1,3,4,6,8,9,11,12,19'
)
, which would not work.
The prepared query should look like
Code: SQL
[Select]
[+]
[-]
venda_pagamento
.
venda_id
IN
(
1
,
3
,
4
,
6
,
8
,
9
,
11
,
12
,
19
)
It would work if ZeosDBO supported Macro, then a raw macro would work perfectly, but from testing does not seem like it supports.
Logged
zeljko
Hero Member
Posts: 1959
Re: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
«
Reply #3 on:
June 13, 2025, 04:40:40 pm »
Then use Format() ... Format('WHERE myitems in (%s) ',[AItemsCommaSeparated]);
Logged
rdxdt
New Member
Posts: 12
Re: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
«
Reply #4 on:
June 13, 2025, 04:54:10 pm »
My previous reply still applies, once Zeos parse the parameter as ftString it will encapsulate it's content in single quotes.
But nevermind, i made the query in another way that won't require this anymore.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Databases
»
[ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB
TinyPortal
© 2005-2018