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
CORE-MATH 32bits in Pasca...
by
schuler
[
Today
at 09:32:39 pm]
Using Lazarus to teach In...
by
LeP
[
Today
at 07:57:48 pm]
Lazarus forum incompatibl...
by
Thausand
[
Today
at 07:16:18 pm]
Fpcupdeluxe
by
Thaddy
[
Today
at 06:12:30 pm]
FPC 3.2.4-rc1 available
by
Thaddy
[
Today
at 06:09:54 pm]
FPC Unleashed (inline var...
by
Fibonacci
[
Today
at 03:55:47 pm]
504 Gateway Timeout
by
Martin_fr
[
Today
at 03:28:06 pm]
Problem with MariaDB and ...
by
OH1KH
[
Today
at 03:26:54 pm]
Feature announcement: Fun...
by
Thaddy
[
Today
at 01:47:33 pm]
Little bit...
by
Thaddy
[
Today
at 01:24:47 pm]
Elite Arcade
by
nomorelogic
[
Today
at 01:16:40 pm]
IDE Coolbar
by
staratel20
[
Today
at 01:00:32 pm]
Midi to Wav Converter
by
Thaddy
[
Today
at 12:28:47 pm]
Pure Pascal ZPAQ and ZSTD
by
Tomxe
[
Today
at 11:48:23 am]
AmigaOS can't run program...
by
Trenatos
[
Today
at 11:30:22 am]
Lazarus and FreePascal on...
by
jwdietrich
[
Today
at 10:44:37 am]
Space Duel
by
Tomi
[
Today
at 09:18:22 am]
Call the Llama.cpp dynami...
by
LeP
[
Today
at 09:11:38 am]
Is there a "known good" c...
by
Thaddy
[
Today
at 08:07:46 am]
Can I get the position an...
by
CM630
[
Today
at 07:29:22 am]
Lazarus 4.6 on macOS 10.1...
by
wpostma
[
Today
at 03:30:20 am]
Forums were down, and are...
by
wpostma
[
Today
at 03:26:20 am]
Untitled raycaster game (...
by
flowCRANE
[
Today
at 01:17:56 am]
Change original package o...
by
pmralbuquerque
[April 19, 2026, 07:55:14 am]
Can /my/ AI help me with ...
by
domasz
[April 19, 2026, 07:23:35 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [ZeosDBO/TZQuery] Passing a parameter that is a list of integer for MariaDB (Read 1077 times)
rdxdt
New member
Posts: 9
[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: 1906
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: 9
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: 1906
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: 9
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