Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mod_lua] Add Dbh:query_rows #2375

Merged
merged 3 commits into from
Jan 15, 2025
Merged

Conversation

ar45
Copy link
Contributor

@ar45 ar45 commented Jan 30, 2024

The added method, query_rows, allows the retrieval of rows from a database without the need for a callback function, it fetches the rows and returns 3 arguments as show below.

local success, rows, err = dbh:query_rows(sql)

This function performs better with large number of rows. Test results below 50k rows returned.

dbh:query(sql, callback) - 0.335949 seconds
dbh:query_rows(sql) - 0.253178 seconds

@signalwire-ci
Copy link

signalwire-ci bot commented Jan 30, 2024

@signalwire-ci
Copy link

signalwire-ci bot commented Jan 30, 2024

@ar45 ar45 force-pushed the mod_lua_query_rows branch 2 times, most recently from 4052057 to f94f305 Compare January 14, 2025 22:51
@andywolk andywolk changed the title mod_lua: add Dbh:query_rows [mod_lua] Add Dbh:query_rows Jan 15, 2025
@andywolk andywolk added the enhancement New feature or request label Jan 15, 2025
ar45 and others added 3 commits January 15, 2025 16:30
The added method, query_rows, allows the retrieval of rows from a database without the need for a callback function, it fetches the rows and returns 3 arguments as show below.

```
lua
local success, rows, err = dbh:query_rows(sql)
```

This function performs better with large number of rows. Test results below 50k rows returned.

dbh:query(sql, callback) - 0.335949 seconds
dbh:query_rows(sql) - 0.253178 seconds
@andywolk andywolk self-requested a review January 15, 2025 15:34
@andywolk andywolk requested a review from briankwest January 15, 2025 15:35
@andywolk andywolk merged commit 53abb53 into signalwire:master Jan 15, 2025
19 checks passed
@andywolk
Copy link
Contributor

@ar45 Thank you.

@greenbea
Copy link
Contributor

nice work @ar45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants