--- maddog39 <[EMAIL PROTECTED]> wrote:
> Maybe someone can point in the right direction.

The source code is here:

 http://www.zentus.com/sqlitejdbc/src/

specifically:

 http://www.zentus.com/sqlitejdbc/src/src/org/sqlite/MetaData.java

    public ResultSet getPrimaryKeys(String c, String s, String table)
            throws SQLException {
        String sql;
        ResultSet rs;
        Statement stat = conn.createStatement();

        rs = stat.executeQuery("pragma table_info('"+escape(table)+"');");

        sql = "select "
            + "null as TABLE_CAT, "
            + "null as TABLE_SCHEM, "
            + "'" + escape(table) + "' as TABLE_NAME, "
            + "cn as COLUMN_NAME, "
            + "0 as KEY_SEQ, "
            + "null as PK_NAME from (";

        int i;
        for (i=0; rs.next(); i++) {
            String colName = rs.getString(2);

            if (!rs.getBoolean(6)) { i--; continue; }
            if (i > 0) sql += " union all ";

            sql += "select '" + escape(colName) + "' as cn";
        }
        sql += i == 0 ? "select null as cn) limit 0;" : ");";
        rs.close();

        return stat.executeQuery(sql);
    }

 and

    public ResultSet getTypeInfo() throws SQLException {
        if (getTypeInfo == null) {
            getTypeInfo = conn.prepareStatement(
                  "select "
                + "tn as TYPE_NAME, "
                + "dt as DATA_TYPE, "
                + "0 as PRECISION, "
                + "null as LITERAL_PREFIX, "
                + "null as LITERAL_SUFFIX, "
                + "null as CREATE_PARAMS, "
                + typeNullable + " as NULLABLE, "
                + "1 as CASE_SENSITIVE, "
                + typeSearchable + " as SEARCHABLE, "
                + "0 as UNSIGNED_ATTRIBUTE, "
                + "0 as FIXED_PREC_SCALE, "
                + "0 as AUTO_INCREMENT, "

If you get the functionality working, send a patch to the list.




      

--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to