@@ -163,7 +163,9 @@ function mysql_stmt_init(db::MySQLDatabaseHandle)
163
163
return mysql_stmt_init (db. ptr)
164
164
end
165
165
166
- # Creates the prepared statement. There should be only 1 statement
166
+ """
167
+ Creates the prepared statement. There should be only 1 statement
168
+ """
167
169
function mysql_stmt_prepare (stmtptr:: Ptr{Cuchar} , sql:: String )
168
170
s = utf8 (sql)
169
171
return ccall ((:mysql_stmt_prepare , mysql_lib),
@@ -172,42 +174,62 @@ function mysql_stmt_prepare(stmtptr::Ptr{Cuchar}, sql::String)
172
174
stmtptr, s, length (s))
173
175
end
174
176
175
- # Returns the error message for the recently invoked statement API
177
+ """
178
+ Returns the error message for the recently invoked statement API
179
+ """
176
180
function mysql_stmt_error (stmtptr:: Ptr{Cuchar} )
177
181
return ccall ((:mysql_stmt_error , mysql_lib),
178
182
Ptr{Cuchar},
179
183
(Ptr{Cuchar}, ),
180
184
stmtptr)
181
185
end
182
186
187
+ """
188
+ Store the entire result returned by the prepared statement in the
189
+ bind datastructure provided by mysql_stmt_bind_result.
190
+ """
183
191
function mysql_stmt_store_result (stmtptr:: Ptr{Cuchar} )
184
192
return ccall ((:mysql_stmt_store_result , mysql_lib),
185
193
Cint,
186
194
(Ptr{Cuchar}, ),
187
195
stmtptr)
188
196
end
189
197
198
+ """
199
+ Return the metadata for the results that will be received from
200
+ the execution of the prepared statement.
201
+ """
190
202
function mysql_stmt_result_metadata (stmtptr:: Ptr{Cuchar} )
191
203
return ccall ((:mysql_stmt_result_metadata , mysql_lib),
192
204
Ptr{Cuchar},
193
205
(Ptr{Cuchar}, ),
194
206
stmtptr)
195
207
end
196
208
209
+ """
210
+ Equivalent of `mysql_num_rows` for prepared statements.
211
+ """
197
212
function mysql_stmt_num_rows (stmtptr:: Ptr{Cuchar} )
198
213
return ccall ((:mysql_stmt_num_rows , mysql_lib),
199
214
Culonglong,
200
215
(Ptr{Cuchar}, ),
201
216
stmtptr)
202
217
end
203
218
219
+ """
220
+ Equivalent of `mysql_fetch_row` for prepared statements.
221
+ """
204
222
function mysql_stmt_fetch_row (stmtptr:: Ptr{Cuchar} )
205
223
return ccall ((:mysql_stmt_fetch , mysql_lib),
206
224
Cint,
207
225
(Ptr{Cuchar}, ),
208
226
stmtptr)
209
227
end
210
228
229
+ """
230
+ Bind the returned data from execution of the prepared statement
231
+ to a preallocated datastructure `bind`.
232
+ """
211
233
function mysql_stmt_bind_result (stmtptr:: Ptr{Uint8} , bind:: Ptr{Cuchar} )
212
234
return ccall ((:mysql_stmt_bind_result , mysql_lib),
213
235
Cchar,
@@ -502,27 +524,3 @@ function mysql_warning_count(mysqlptr::MYSQL)
502
524
return ccall ((:mysql_warning_count , mysql_lib), Cuint, (Ptr{Void},),
503
525
mysqlptr)
504
526
end
505
-
506
- # Handy function to make things easier.
507
- # function prepstmt_getResultsAsDataFrame(stmtptr::Ptr{Cuchar}, sql::String)
508
- # response = mysql_stmt_prepare(stmtptr, sql)
509
- #
510
- # if (response == 0)
511
- # results = mysql_stmt_result_metadata(stmtptr)
512
- # response = mysql_stmt_execute(stmtptr)
513
- #
514
- # if (response == 0)
515
- # println("Query executed successfully !!!")
516
- # return obtainResultsAsDataFrame(results, true, stmtptr)
517
- # else
518
- # println("Query execution failed !!!")
519
- # error = bytestring(mysql_stmt_error(stmtptr))
520
- # println("The error is ::: $error")
521
- # end
522
- #
523
- # else
524
- # println("Error in preparing the query !!!")
525
- # mysql_stmt_error(stmtptr)
526
- # end
527
- #
528
- # end
0 commit comments