EV-MariaDB

 view release on metacpan or  search on metacpan

MariaDB.xs  view on Meta::CPAN

    self->op_stmt_ctx = ctx;

    self->state = STATE_STMT_CLOSE;
    status = mysql_stmt_close_start(&self->op_bool_ret, ctx->stmt);
    if (status == 0) {
        on_stmt_close_done(self);
    } else {
        update_watchers(self, status);
    }
}

void
stmt_reset(EV::MariaDB self, IV stmt_iv, SV *cb)
PREINIT:
    ev_mariadb_stmt_t *ctx;
    int status;
CODE:
{
    CHECK_READY(self, cb);

    ctx = INT2PTR(ev_mariadb_stmt_t *, stmt_iv);
    CHECK_STMT(ctx);
    push_cb(self, cb);
    self->op_stmt = ctx->stmt;

    self->state = STATE_STMT_RESET;
    status = mysql_stmt_reset_start(&self->op_bool_ret, ctx->stmt);
    if (status == 0) {
        on_stmt_reset_done(self);
    } else {
        update_watchers(self, status);
    }
}

void
ping(EV::MariaDB self, SV *cb)
PREINIT:
    int status;
CODE:
{
    CHECK_READY(self, cb);

    push_cb(self, cb);

    self->state = STATE_PING;
    status = mysql_ping_start(&self->op_ret, self->conn);
    dispatch_utility(self, status, self->op_ret != 0);
}

void
change_user(EV::MariaDB self, const char *user, const char *password, SV *db_sv, SV *cb)
PREINIT:
    int status;
    const char *db;
CODE:
{
    CHECK_READY(self, cb);

    db = (SvOK(db_sv)) ? SvPV_nolen(db_sv) : NULL;

    /* Stash the new credentials; on_utility_done commits them on success or
       discards on failure so reset() never sees credentials we couldn't use.
       Pass the pending pointers to libmariadb so the strings live across the
       async start/cont sequence (Perl args expire when the XS body returns). */
    replace_str(&self->pending_user, user);
    replace_str(&self->pending_password, password);
    if (db) replace_str(&self->pending_database, db);

    push_cb(self, cb);

    self->state = STATE_CHANGE_USER;
    status = mysql_change_user_start(&self->op_bool_ret, self->conn,
        self->pending_user, self->pending_password, self->pending_database);
    dispatch_utility(self, status, self->op_bool_ret != 0);
}

void
select_db(EV::MariaDB self, const char *db, SV *cb)
PREINIT:
    int status;
CODE:
{
    CHECK_READY(self, cb);

    /* Stash the new database; on_utility_done commits on success. */
    replace_str(&self->pending_database, db);

    push_cb(self, cb);

    self->state = STATE_SELECT_DB;
    status = mysql_select_db_start(&self->op_ret, self->conn, self->pending_database);
    dispatch_utility(self, status, self->op_ret != 0);
}

void
reset_connection(EV::MariaDB self, SV *cb)
PREINIT:
    int status;
CODE:
{
    CHECK_READY(self, cb);

    push_cb(self, cb);

    self->state = STATE_RESET_CONNECTION;
    status = mysql_reset_connection_start(&self->op_ret, self->conn);
    dispatch_utility(self, status, self->op_ret != 0);
}

void
set_charset(EV::MariaDB self, const char *charset, SV *cb)
PREINIT:
    int status;
CODE:
{
    CHECK_READY(self, cb);

    /* Stash the new charset; on_utility_done commits on success. */
    replace_str(&self->pending_charset, charset);

    push_cb(self, cb);



( run in 0.772 second using v1.01-cache-2.11-cpan-140bd7fdf52 )