// Copyright (c) 2010 Sean C. Rhea <sean.c.rhea@gmail.com>
// All rights reserved.
//
// See the file LICENSE included in this distribution for details.

// Note: I'm not crazy about writing code in Java, so the idea behind this
// file is to do the absolute minimum amount of work necessary to call into
// the Sqlite3 C/C++ interface from within Scala.  I'm not trying to impose a
// more Java-like interface on Sqlite, or add object orientation, or anything
// like that.  In fact, I would prefer that this file were generated by an
// automated program.  I played around a bit with gluegen and couldn't get
// it to work.  And SWIG seems to save effort only if you're making wrappers
// for multiple languages.  Luckily there aren't too many functions to wrap.

package org.srhea.scalaqlite;

public class Sqlite3C {
    public static final int OK = 0;
    public static final int ERROR = 1;
    public static final int ROW = 100;
    public static final int DONE = 101;

    public static final int INTEGER = 1;
    public static final int FLOAT = 2;
    public static final int TEXT = 3;
    public static final int BLOB = 4;
    public static final int NULL = 5;

    native static public int open(String path, long[] db);
    native static public int close(long db);
    native static public int enable_load_extension(long db, int onoff);
    native static public int prepare_v2(long db, String sql, long[] stmt);
    native static public int reset(long stmt);
    native static public int bind_null(long stmt, int index);
    native static public int bind_int64(long stmt, int index, long value);
    native static public int bind_double(long stmt, int index, double value);
    native static public int bind_text(long stmt, int index, byte[] value);
    native static public int bind_blob(long stmt, int index, byte[] value);
    native static public int step(long stmt);
    native static public int finalize(long stmt);
    native static public int column_count(long stmt);
    native static public int column_type(long stmt, int n);
    native static public long column_int64(long stmt, int n);
    native static public double column_double(long stmt, int n);
    native static public byte[] column_blob(long stmt, int n);
    native static public String errmsg(long db);
    native static public int sqlite3_changes(long db);

    static {
        System.loadLibrary("scalaqlite");
    }
}

// Copyright (c) 2010 Sean C. Rhea <sean.c.rhea@gmail.com>
// All rights reserved.
//
// See the file LICENSE included in this distribution for details.

// Note: I'm not crazy about writing code in Java, so the idea behind this
// file is to do the absolute minimum amount of work necessary to call into
// the Sqlite3 C/C++ interface from within Scala.  I'm not trying to impose a
// more Java-like interface on Sqlite, or add object orientation, or anything
// like that.  In fact, I would prefer that this file were generated by an
// automated program.  I played around a bit with gluegen and couldn't get
// it to work.  And SWIG seems to save effort only if you're making wrappers
// for multiple languages.  Luckily there aren't too many functions to wrap.

package org.srhea.scalaqlite;

public class Sqlite3C {
    public static final int OK = 0;
    public static final int ERROR = 1;
    public static final int ROW = 100;
    public static final int DONE = 101;

    public static final int INTEGER = 1;
    public static final int FLOAT = 2;
    public static final int TEXT = 3;
    public static final int BLOB = 4;
    public static final int NULL = 5;

    native static public int open(String path, long[] db);
    native static public int close(long db);
    native static public int enable_load_extension(long db, int onoff);
    native static public int prepare_v2(long db, String sql, long[] stmt);
    native static public int reset(long stmt);
    native static public int bind_null(long stmt, int index);
    native static public int bind_int64(long stmt, int index, long value);
    native static public int bind_double(long stmt, int index, double value);
    native static public int bind_text(long stmt, int index, byte[] value);
    native static public int bind_blob(long stmt, int index, byte[] value);
    native static public int step(long stmt);
    native static public int finalize(long stmt);
    native static public int column_count(long stmt);
    native static public int column_type(long stmt, int n);
    native static public long column_int64(long stmt, int n);
    native static public double column_double(long stmt, int n);
    native static public byte[] column_blob(long stmt, int n);
    native static public String errmsg(long db);
    native static public int sqlite3_changes(long db);

    static {
        // Using Runtime.loadLibrary makes the calling class Sqlite3C instead of System,
        // thus loading scalaqlite in the local class loader instead of the system class loader.
        Runtime.getRuntime().loadLibrary("scalaqlite");
    }
}

Switch native library loading to Runtime.loadLibrary to avoid multi-load errors