mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
db.mysql: add ability to prepare and execute statements separately (#20146)
This commit is contained in:
parent
e6a30dc4ef
commit
d86a11c257
4 changed files with 117 additions and 13 deletions
|
@ -28,6 +28,8 @@ fn test_mysql() {
|
|||
assert result_code == 0
|
||||
result_code = db.exec_none('insert into users (username) values ("blaze")')
|
||||
assert result_code == 0
|
||||
rows := db.exec_param('insert into users (username) values (?)', 'Hi')!
|
||||
assert rows == []mysql.Row{}
|
||||
|
||||
// Regression testing to ensure the query and exec return the same values
|
||||
res := db.query('select * from users')!
|
||||
|
@ -69,6 +71,9 @@ fn test_mysql() {
|
|||
mysql.Row{
|
||||
vals: ['4', 'blaze']
|
||||
},
|
||||
mysql.Row{
|
||||
vals: ['5', 'Hi']
|
||||
},
|
||||
]
|
||||
|
||||
response = db.exec_param('select * from users where username = ?', 'blaze')!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue