Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Goldstein
    @GoldsteinE
    Thanks, it works now with bundled
    Kyle Merfeld
    @kmerfeld
    Whats the proper way to insert a value that is an Option<String>?
    with a normal execute statement
    dubiousjim
    @dubiousjim
    I'm cleaning up #771, with an aim to rebase on current master. Probably easiest to close that PR and start a new one with the rebased commits. (If I just force-push the rebased branch, Github makes it hard to review the commits one-by-one.)
    dubiousjim
    @dubiousjim
    While I'm doing that, I did a little cleanup of docs and comments in libsqlite3-sys/build.rs. Question: I notice in the root Cargo.toml that the docs.rsmetadata says to build without any of these features: session, uuid, csvtab, extra_check, hooks, i128_blob, series, unlock_notify. Is that a considered and deliberate choice? Or where these just neglected to be added there?
    Also, in the README.md, these non-build-related features have no documentation: collation, column_decltype, extra_check, series, window. These build-related features have no documentation: with-asan, in_gecko, wasm32-wasi-vfs, winsqlite3, bundled-windows.
    Happy to add an issue or PR with stub explanations for some of these. But thought I'd enumerate them here first, to make it easier to say something like "Oh no, let's leave these two undocumented..."
    dubiousjim
    @dubiousjim
    Cleaned up #771, made PRs #860 and #861
    jamespeterschinner
    @jamespeterschinner
    does rusqlite provide an API to perform bulk imports with sqlite's .import command? As used in this SO post? https://stackoverflow.com/Questions/364017/faster-bulk-inserts-in-sqlite3
    dubiousjim
    @dubiousjim
    The commands starting with a dot are only understood by the sqlite3 shell/cli. They're not understood by the library. Rusqlite only gives an api to the library.
    dubiousjim
    @dubiousjim
    You could instead use https://doc.rust-lang.org/std/process/struct.Command.html to interact with the sqlite3 shell/cli.
    jamespeterschinner
    @jamespeterschinner
    Oh perfect! thanks, excuse my ignorance.
    Thom Chiovoloni
    @thomcc
    I'm not really around, but you probably could do the same thing with the csvtab stuff in rusqlite
    Justin Wood
    @ankhers
    Is there some preferred way to deal with migrations with rusqlite?
    Thom Chiovoloni
    @thomcc
    nope, totally up to you. rusqlite is not an opinionated library like that
    Midas Lambrichts
    @MidasLamb
    image.png
    I just ran into this issue when trying to add the preupdate_hook and using it already in my code:
    It is a stacktrace with gdb, according to that line number it's in the "text" part of ValueRef, but somehow it's still a nullpointer it seems?
    Thom Chiovoloni
    @thomcc
    you're probably better off asking on the issue, I'm the only rusqlite member that comes here and I dont have time to help you debug it, unfortunately (also gwenn knows much more about the hooks than i do)
    Midas Lambrichts
    @MidasLamb
    Ok, thanks for the quick response!
    Alexander Samoylenko
    @lxmnk
    Hello! I would like to run SELECT * FROM notes WHERE id IN (?1) (?1 is a Vec<i32>). Could you provide me example, how to pass vector to parameters? I've searched docs and issues, but found examples only for inserting/updating rows.
    Thom Chiovoloni
    @thomcc
    In general SQLite doesn't work like that, but there are workarounds, see rusqlite/rusqlite#430 for a discussion of using the array feature
    but note that using that requires loading the module first
    Alexander Samoylenko
    @lxmnk

    In general SQLite doesn't work like that, but there are workarounds, see rusqlite/rusqlite#430 for a discussion of using the array feature

    Thank you! Just now I've discovered, that I also can generate a SQL string with right placeholders number (?1, ?2). Could you explain, why using array feature is a better choice?

    Thom Chiovoloni
    @thomcc
    I'd probably generate the string
    Alexander Samoylenko
    @lxmnk
    Thank you again)
    Thom Chiovoloni
    @thomcc
    Alexander Samoylenko
    @lxmnk

    I wrote https://github.com/mozilla/application-services/blob/main/components/support/sql/src/repeat.rs for this purpose once upon a time

    I'll check it out, thanks!

    Thom Chiovoloni
    @thomcc
    @lxmnk oh, note that there's a maximum number of parameters that you can pass to SQLite at once. The maximum number is likely either 999 (for versions older than 3.32, e.g. released before 2020-05-22) or 32766 for ones after that. so, you may need to chunk
    you can query it with https://docs.rs/rusqlite/0.24.2/rusqlite/limits/enum.Limit.html#variant.SQLITE_LIMIT_VARIABLE_NUMBER (which requires the limits feature to be on)
    Cédric Bellegarde
    @gnumdk_gitlab
    Hello
    Looking at previous comments, I'm not sure about my question
    I have a built SQL request with random parameters: one string, one vec<i32> and one vec<string>. Will I be able to generate params with array feature?
    Cédric Bellegarde
    @gnumdk_gitlab
    Another question, Is there an equivalent of https://www.kite.com/python/docs/sqlite3.Connection.create_function in ruqlite ?
    Thom Chiovoloni
    @thomcc
    yes: https://docs.rs/rusqlite/0.24.2/rusqlite/struct.Connection.html#method.create_scalar_function (also create_aggregate_function or create_window_function for different kinds of functions — i don't think these have equivalents in the python binding though)
    you need to turn on the functions feature
    Cédric Bellegarde
    @gnumdk_gitlab
    Ok, thanks
    Cédric Bellegarde
    @gnumdk_gitlab
    Looking at the documentation, I understand that this function are only available on query result.
    Thom Chiovoloni
    @thomcc
    hm?
    thats not really true
    what context do you want to use it in?
    Cédric Bellegarde
    @gnumdk_gitlab
    Python allows to do something like this: SELECT * FROM table WHERE myfunction(column)='value'
    Thom Chiovoloni
    @thomcc
    yes that definitely is allowed here
    Cédric Bellegarde
    @gnumdk_gitlab
    ok
    Thom Chiovoloni
    @thomcc
    what part of the documentation makes you think that wouldnt be
    perhaps the docs should be improved
    Cédric Bellegarde
    @gnumdk_gitlab
    English is not my language, so maybe a confusion around the word scalar, will try to implement, if there is really something confusing, will report the an issue
    Thom Chiovoloni
    @thomcc
    oh
    scalar just means the function takes 1 argument
    err