Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Sqlite Schema should be... #82

Closed
arhoads76 opened this Issue · 2 comments

2 participants

@arhoads76

The current Schema property for the Sqlite code isn't quite right (imo). Here's one that will return column names instead of a table name and a create table blob:

    IEnumerable<dynamic> _schema;
    public IEnumerable<dynamic> Schema
    {
        get
        {
            if (_schema == null) {
                var rows = new List<dynamic>();
                foreach (var row in Query("PRAGMA table_info('" + TableName + "')")) {
                    rows.Add(new {
                        COLUMN_NAME = (row as IDictionary<string,object>)["name"].ToString(),
                        DATA_TYPE   = (row as IDictionary<string,object>)["type"].ToString(),
                        IS_NULLABLE = (row as IDictionary<string,object>)["notnull"].ToString() == "0" ? "NO" : "YES",
                    });
                }
                _schema = rows;
            }
            return _schema;
        }
    }
@robconery
Collaborator

This is SQLite specific as far as I can tell - I need to support SQL Server. Also, "isn't quite right" doesn't help me solve a problem.

@robconery robconery closed this
@arhoads76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.