It looks like it should be possible in theory to copy from one in-memory database to another (SQLite Online Backup API), but it doesn't seem to be implemented in DBD::SQLite. Also, since the Backup function apparently works by doing a live copy from one SQLite database into another, you'd essentially get a second in-memory database. However, I suspect that's actually not what you want when you say you want to get a "scalar" - do you actually want a binary representation of the database as a scalar? In that case, I suspect you'll have to write the database out to a file. (BTW, Perl supports in-memory files, see open, although it doesn't look like you can pass a filehandle to sqlite_backup_to_file)

Do you know that it is significantly slower to just read the file back in from the disk, have you tried it? What are the additional things you want to do with the copied database?


In reply to Re: SQLite in memory database to scalar by Anonymous Monk
in thread SQLite in memory database to scalar by Rodster001

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.