How do I load an extension

オープン
#908 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java, sqlite
領域
database

調査の方向性

Start by reading the extension loading notes and the native build configuration for sqlite-jdbc; the report says the extension code was copied into src/main/ext and built with make native before mvn package. Check how the bundled extension-functions extension is compiled and exposed to JDBC connections. Done means documenting or fixing the steps so the built in memstat extension is available to query, with the reported no table behavior resolved.

索引モデルが issue の本文から書いたものです。

説明

question

Describe the bug
I added memstat extension by copying code from https://sqlite.org/src/file/ext/misc/memstat.c and pasting it in src/main/ext.
Then i did:

  • update makefile with -DSQLITE_DEFAULT_MEMSTATUS=1 -DSQLITE_ENABLE_MEMSTATVTAB=1
  • make native (mine is linux x86_64)
  • mvn package

This produced the jar.

Now I copied the Sample.java, showing relevant section below:

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
 import org.sqlite.core.DB;
import org.sqlite.SQLiteConnection;
    import java.util.Properties;

    public class Sample
    {
      public static void main(String[] args)
      {
        Connection connection = null;
        Properties properties = new Properties();
        properties.setProperty("enable_load_extension", "true");

        try
        {
          // create a database connection
          connection = DriverManager.getConnection("jdbc:sqlite:memory:", properties);
            // sql queries to load extensions
        //  connection.prepareStatement("SELECT load_extension('memstat')").execute(); -> perhaps this is not needed?
          Statement sm = connection.createStatement();
          ResultSet rr = sm.executeQuery("select * from memstat"); -> throws no table , tried sqlite_memstat too
          while(rr.next()) {
                System.out.println(rr.getString("name"));
          }
        

I was able to use a .so file and load that but I want to compile it together as done for extension-functions

Expected behavior
I expected to see memstat table.

Logs
If applicable, provide logs.

Environment (please complete the following information):

  • OS: Linux
  • CPU architecture: x86_64
  • sqlite-jdbc version 3.39.2.0

Additional context
Add any other context about the problem here.

主要言語
Java
スター
3.3k
フォーク
676
平均マージ
1日 15時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

xerial/sqlite-jdbc のほかの issue

xerial/sqlite-jdbc の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。