capacitor-community / capacitor-community/sqlite

bug: CREATE TABLE with SQL comments causes ExportToJson to fail

Open
#685 0 comments 0 reactions 0 assignees View on GitHub
bug/fix needs: triage
Dominant language
Swift
Stars
661
Forks
158
PR merge metrics
No merged PRs in 30d

Description

**Plugin version:**
^8.0.0

**Platform(s):**
Android

**Current behavior:**
When a CREATE TABLE statement contains SQL comments (-- or /* */),
ExportToJson fails with the following error:

`ExportToJson: CreateExportObject: GetTablesFull: length=1; index=1`

**Expected behavior:**
ExportToJson completes successfully.

**Steps to reproduce:**
1. Create a table with SQL comments inside the CREATE TABLE statement
2. Call ExportToJson('full')
3. Error occurs

**Related code:**
```
CREATE TABLE IF NOT EXISTS user_learning_logs (
uuid TEXT PRIMARY KEY,
-- 'LEARN', 'REVIEW', 'CHALLENGE','PROFICIENCY'
activity_type TEXT NOT NULL
);
```

**Other information:**
Removing all comments from CREATE TABLE statements resolves the issue.

**Capacitor doctor:**
Latest Dependencies:

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

Installed Dependencies:

@capacitor/cli: 8.0.2
@capacitor/android: 8.0.2
@capacitor/core: 8.2.0
@capacitor/ios: 8.2.0

[success] Android looking great!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.