Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ lua sqlite3 attach database

lua sqlite3 attach database

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Renny   Canada  (26 posts)  Bio
Date Sun 12 Aug 2018 06:16 AM (UTC)
Message
For the mud aardwolf I would like to attach Aardwolf.db to my own database so I can do a join on one of the tables.

Is there a way to do this with the lsqlite3 module?

I have thought of some workarounds such as copying the table to my own database, but I would rather avoid this if possible (due to periodically having to update it).
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 12 Aug 2018 09:15 PM (UTC)

Amended on Sun 12 Aug 2018 09:16 PM (UTC) by Nick Gammon

Message
See: Stack Overflow question: SQLite - How do you join tables from different databases?.

Something like this:


db = sqlite3.open('foo.db')  -- open

db:exec ("attach 'bar.db' as db2") -- attach other database

for a in db:nrows ('SELECT * FROM foo LEFT JOIN bar USING (id)') do
  tprint(a)
end

db:close ()

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #2 on Sun 19 Aug 2018 01:40 AM (UTC)
Message
This sounds interesting. What are you making, Renny?

https://github.com/fiendish/aardwolfclientpackage
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,909 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.