Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple tables #2

Open
semiton opened this issue Apr 7, 2012 · 0 comments
Open

Multiple tables #2

semiton opened this issue Apr 7, 2012 · 0 comments

Comments

@semiton
Copy link

semiton commented Apr 7, 2012

Please add the ability to specify multiple tables.
Sample:

    this.get = function(tableName, responseCallback) {
        if (typeof tableName.push === 'function') {
            for (var i = 0; i < tableName.length; i++) {
                if (typeof tableName[i] === 'string') {
                    tableName[i] = escapeFieldName(tableName[i]);
                } else {
                    tableName.splice(i,1);
                }
            }
            tableName = tableName.join(',');
        }
        if (typeof tableName === 'string') {
            var combinedQueryString = 'SELECT ' + (selectClause.length === 0 ? '*' : selectClause.join(','))
            + ' FROM ' + tableName
            + buildJoinString()
            + buildDataString(whereClause, ' AND ', 'WHERE')
            + (orderByClause !== '' ? ' ORDER BY ' + orderByClause : '')
            + (limitClause !== -1 ? ' LIMIT ' + limitClause : '')
            + (offsetClause !== -1 ? ' OFFSET ' + offsetClause : '');

            connection.query(combinedQueryString, responseCallback);
            resetQuery(combinedQueryString);
        }

        return that;
    };

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant