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
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
Debugger regression in La...
by
TheMouseAUS
[
Today
at 01:14:05 am]
Setting up an ARM embedde...
by
Ruptor
[
Today
at 12:10:31 am]
Has anyone installed TeeB...
by
wp
[July 10, 2025, 10:43:30 pm]
ChatGPT and ObjectPascal ...
by
zeljko
[July 10, 2025, 10:09:18 pm]
About Skia graphics engin...
by
DomingoGP
[July 10, 2025, 10:07:17 pm]
internal Compiler Error
by
marcov
[July 10, 2025, 09:36:12 pm]
activex.pp OleTranslateAc...
by
marcov
[July 10, 2025, 09:25:23 pm]
MOVED: Can't rebuild laza...
by
Martin_fr
[July 10, 2025, 09:01:27 pm]
LINUX: My program stops w...
by
Martin_fr
[July 10, 2025, 08:59:09 pm]
catch error 400
by
paweld
[July 10, 2025, 08:42:15 pm]
Zeromemory vs. Fillchar
by
ASerge
[July 10, 2025, 08:25:18 pm]
LazGetShortLanguageID -> ...
by
Grahame Grieve
[July 10, 2025, 08:15:00 pm]
Can't rebuild lazarus
by
JuhaManninen
[July 10, 2025, 08:13:45 pm]
Forte Report CE Questions
by
PascalProg
[July 10, 2025, 07:24:17 pm]
MDI ChildForm
by
astar
[July 10, 2025, 06:03:20 pm]
Questions about GUID decl...
by
Thaddy
[July 10, 2025, 05:07:49 pm]
Pascal Conference 2025
by
Kralle
[July 10, 2025, 05:00:59 pm]
TBufDataset with Invalid ...
by
talisjonatas
[July 10, 2025, 04:53:42 pm]
activex.pp definition pro...
by
Thaddy
[July 10, 2025, 01:03:29 pm]
Synapse and ShareMem ...n...
by
Thaddy
[July 10, 2025, 01:02:40 pm]
Create a png image from a...
by
paweld
[July 10, 2025, 12:57:35 pm]
controls.lpr(731,15) Erro...
by
Bandy
[July 10, 2025, 12:55:34 pm]
Input Chinese using Micro...
by
momigo
[July 10, 2025, 09:25:32 am]
Reselect Last Selection
by
440bx
[July 10, 2025, 04:09:47 am]
Feature request: hard typ...
by
Warfley
[July 10, 2025, 01:45:22 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB (Read 470 times)
rdxdt
New member
Posts: 8
[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: 1770
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: 8
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: 1770
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: 8
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