go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Query parameters that are not in SQLite3 pragmas list

Open tredoe opened this issue 5 years ago • 12 comments

I have not found the next pragmas: loc, mutex and txlock in the list of pragmas. So, if they are only used by "go-sqlite3", please indicate it.

tredoe avatar Dec 16 '19 11:12 tredoe

See https://github.com/mattn/go-sqlite3#connection-string

mattn avatar Dec 17 '19 03:12 mattn

I'm supposing that you refer to the next line:

This library supports dsn options of SQLite itself and provides additional options.

But the issue is that it don't say which parameters have been added for the driver.

tredoe avatar Dec 17 '19 04:12 tredoe

@tredoe I think you are conflating URI options with pragmas. They are not the same thing. The URI options supported by SQLite itself are listed here.

Basically, any options in the table in this library's README that start with an underscore were added by this library. But I don't understand why the distinction matters to you.

rittneje avatar Dec 17 '19 05:12 rittneje

@rittneje I'm refering to pragmas like has been said clearly in the title.

I know that all options that start with an underscore have been added to be passed like pragmas except three of them which are not in the pragma list.

tredoe avatar Dec 17 '19 05:12 tredoe

Query parameters are not same in the list SQLite3 supported since query parameters have some meanings for easily usage like txlock.

mattn avatar Dec 17 '19 05:12 mattn

@tredoe Again, query parameters are not pragmas. Thus the title of your post does not make any sense. In fact, I don't believe that any of the query parameters provided by SQLite itself have pragma equivalents.

@mattn already provided you the list of query parameters supported by this library. You already have the list of pragmas supported by SQLite in your original post. So I don't know what it is you are looking for. What exactly are you trying to do?

rittneje avatar Dec 17 '19 05:12 rittneje

Again, query parameters are not pragmas. Thus the title of your post does not make any sense. In fact, I don't believe that any of the query parameters provided by SQLite itself have pragma equivalents.

This driver is using query parameters that start with an underscore to pass them to the driver like pragms. Right?

tredoe avatar Dec 17 '19 07:12 tredoe

When I use a DBMS driver, I want to know which parameters are used by the DBMS and which has been added by the driver author; because when I have to use a DBMS driver in other language, I'll know which code (related to query parameters) will can add without problem (at writing from a language to another one).

tredoe avatar Dec 17 '19 07:12 tredoe

This driver is using query parameters that start with an underscore to pass them to the driver like pragms. Right?

Query parameters with an underscore are not passed to SQLite3 directly.

mattn avatar Dec 17 '19 07:12 mattn

Query parameters with an underscore are not passed to SQLite3 directly.

Then, how are they used and which is the reason to have been added?

tredoe avatar Dec 17 '19 07:12 tredoe

As you point in top of this conversation, sqlite3 does not support loc, mutex and txlock. So all of Go users must write code to run these pragmas.

_, err = conn.Exec(fmt.Sprintf("pragma xxx=%d", xxx)
if err != nil {
    // error handling
}

So I added few query options to be possible to add them easily and these query parameters are prefixed with an underscore to avoid conflict with official query parameters.

mattn avatar Dec 17 '19 07:12 mattn

For the description of adding specific query parameter, please find-out from github issues or commit-log.

mattn avatar Dec 17 '19 07:12 mattn