Skip to content

Commit

Permalink
mx_mysql: Add mx_mysql_statement_insert_id()
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed May 20, 2015
1 parent 073860c commit f7e7258
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mx_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,20 @@ static int mx__mysql_stmt_affected_rows(struct mx_mysql_stmt *stmt, unsigned lon
return 0;
}

static int mx__mysql_stmt_insert_id(struct mx_mysql_stmt *stmt, unsigned long long *count)
{
my_ulonglong c;

mx_assert_return_minus_errno(stmt, EINVAL);
mx_assert_return_minus_errno(stmt->stmt, EBADF);

c = mysql_stmt_insert_id(stmt->stmt);

*count = (unsigned long long)c;

return 0;
}

static int mx__mysql_stmt_close(struct mx_mysql_stmt *stmt)
{
my_bool res;
Expand Down Expand Up @@ -847,6 +861,10 @@ int mx_mysql_statement_execute(struct mx_mysql_stmt *stmt, unsigned long long *c
return 0;
}

int mx_mysql_statement_insert_id(struct mx_mysql_stmt *stmt, unsigned long long int *id) {
return mx__mysql_stmt_insert_id(stmt, id);
}

int mx_mysql_statement_affected_rows(struct mx_mysql_stmt *stmt, unsigned long long int *count) {
return mx__mysql_stmt_affected_rows(stmt, count);
}
Expand Down
1 change: 1 addition & 0 deletions mx_mysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ int mx_mysql_statement_init(struct mx_mysql *mysql, struct mx_mysql_stmt **stmt)
int mx_mysql_statement_prepare(struct mx_mysql_stmt *stmt, char *statement);
int mx_mysql_statement_execute(struct mx_mysql_stmt *stmt, unsigned long long *count);

int mx_mysql_statement_insert_id(struct mx_mysql_stmt *stmt, unsigned long long int *id);
int mx_mysql_statement_affected_rows(struct mx_mysql_stmt *stmt, unsigned long long int *count);
int mx_mysql_statement_num_rows(struct mx_mysql_stmt *stmt, unsigned long long int *count);

Expand Down

0 comments on commit f7e7258

Please sign in to comment.