Skip to content

Add escape-function for identifiers #5

Description

@gagge

Today you need to do it like this.
There must be a better solution that doesn't need getConnection().

const db = require('larvitdb');
db.pool.getConnection(function(err, dbCon) {
	const sql = 'SELECT * FROM users WHERE username LIKE ' + dbCon.escapeId(postData);

	dbCon.query(sql, function(err, rows) {
		dbCon.release(); // Always release your connection when the query is done

		if (err)
			throw err;
	});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions