Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bug: exportToJson: Error get tables 'Full' failed : Query result not well formatted

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

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

評価

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

調査の方向性

sqliteLoader.js の exportToJson ラッパーから始め、提供された users スキーマを使用して iOS で失敗を再現します。createSyncTable の設定とプラグインの iOS エクスポートパスを確認し、Full クエリの結果が拒否される理由を調べます。このデータベースのテーブルを JSON に正常にエクスポートできれば完了です。

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

説明

bug/fix needs: triage

Plugin version:

7.0.1

Platform(s):

iOS

Current behavior:

exportToJson: Error get tables 'Full' failed : Query result not well formatted

Expected behavior:

Succeed in exporting tables to JSON

Steps to reproduce:

 async exportToJson(mode = 'full') {
        console.log('[ sqliteLoader.js ] Exporting database to JSON...');
        return await sqlite.exportToJson({
          database: DB_NAME,
          jsonexportmode: mode
        });
      },

Related code:

Sample table:

    CREATE TABLE IF NOT EXISTS users (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      name TEXT,
      lastName TEXT,
      phoneNumber TEXT,
      email TEXT,
      sobrietyDate TEXT,
      homeGroups TEXT,
      preferences TEXT,
      privacySettings TEXT,
      notificationSettings TEXT, -- JSON string for notification preferences
      createdAt TEXT DEFAULT CURRENT_TIMESTAMP,
      updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,
      sql_deleted BOOLEAN DEFAULT 0 CHECK (sql_deleted IN (0, 1)),
      last_modified INTEGER DEFAULT (strftime('%s', 'now'))
    )
import { CapacitorSQLite } from '@capacitor-community/sqlite';

// Default database name for consistency
const DB_NAME = 'tracker.db';
/**
 * Initialize SQLite database
 * @returns {Promise<object>} Database connection object
 */
export default async function initSQLiteDatabase() {
  console.log('[ sqliteLoader.js:14 ] Initializing SQLite database via Capacitor...');

  try {
    const sqlite = CapacitorSQLite;

    if (!sqlite) {
      throw new Error('CapacitorSQLite plugin not found - this app requires SQLite for iOS');
    }

    console.log('[ sqliteLoader.js ]  Found CapacitorSQLite plugin:', !!sqlite);

    // Step 1: Create connection (check if already exists first)
    try {
      await sqlite.createConnection({
        database: DB_NAME,
        version: 1,
        encrypted: false,
        mode: 'no-encryption',
        readonly: false
      });
      console.log('[ sqliteLoader.js:50 ]  Database connection created');
    } catch (connectionError) {
      console.log('[ sqliteLoader.js:52 ]  Connection may already exist:', connectionError.message);
    }



    // Step 2: Open the database
    await sqlite.open({ database: DB_NAME, readonly: false });
    console.log('[ sqliteLoader.js:56 ]  Database opened successfully');

    // Step 3: Create sync table (required for CapacitorSQLite export/import operations)
    await sqlite.createSyncTable({ database: DB_NAME });
    console.log('[ sqliteLoader.js:58 ]  Sync table created successfully');
// Sync methods for iCloud integration
      async exportToJson(mode = 'full') {
        console.log('[ sqliteLoader.js ] Exporting database to JSON...');
        return await sqlite.exportToJson({
          database: DB_NAME,
          jsonexportmode: mode
        });
      },

      async importFromJson(jsonData) {
        console.log('[ sqliteLoader.js ] Importing database from JSON...');
        return await sqlite.importFromJson({
          jsonstring: JSON.stringify(jsonData)
        });
      },

      async setSyncDate(syncDate) {
        console.log('[ sqliteLoader.js ] Setting sync date...');
        return await sqlite.setSyncDate({
          database: DB_NAME,
          syncdate: syncDate
        });
      },

      async deleteExportedRows() {
        console.log('[ sqliteLoader.js ] Deleting exported rows...');
        return await sqlite.deleteExportedRows({
          database: DB_NAME
        });
      }
    };

  } catch (error) {
    console.error('[ sqliteLoader.js ] Database initialization failed:', error);
    throw error;
  }
}

Other information:

I have read through https://github.com/capacitor-community/sqlite/issues/59 and it is long-closed, but I am having this problem repeatedly and cannot find a fix for it.

Capacitor doctor:

% npx cap doctor
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 7.4.2
  @capacitor/core: 7.4.2
  @capacitor/android: 7.4.2
  @capacitor/ios: 7.4.2

Installed Dependencies:

  @capacitor/cli: 7.4.2
  @capacitor/core: 7.4.2
  @capacitor/android: 7.4.2
  @capacitor/ios: 7.4.2
  
[success] iOS looking great! 👌
[error] gradlew file is missing in android
        AndroidManifest.xml is missing in app/src/main

Expected, since I'm not currently working on Android.

主要言語
Swift
スター
663
フォーク
159
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

capacitor-community/sqlite のほかの issue

capacitor-community/sqlite の issue をすべて見る

似ている issue

Swift の issue をもっと見る

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

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