Recent

Author Topic: [solved] Table names in sqlite3 database  (Read 5547 times)

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1215
Re: [solved] Table names in sqlite3 database
« Reply #15 on: June 15, 2023, 03:46:16 pm »
Is that like if you have multiple databases open at same time?
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1315
Re: [solved] Table names in sqlite3 database
« Reply #16 on: June 15, 2023, 03:55:56 pm »
Is that like if you have multiple databases open at same time?
Each database can contain multiple schemas, which each can contain multiple tables (even with the same name). It's very convenient in PostgreSQL, as it doesn't allow running queries across multiple databases. There's even an extension to map the tables from database1.schema1 to database2.schema2.

Zvoni

  • Hero Member
  • *****
  • Posts: 2741
Re: [solved] Table names in sqlite3 database
« Reply #17 on: June 15, 2023, 04:11:36 pm »
Let's sort out some "Definitions":
A "schema" is actually a Database (as known from MySQL etc.), which contains tables, views, Indexes, Triggers, Stored Procedures and whatever else
Meaning: With the same Server you can have multiple "schemas" (Databases)
e.g. One schema called "SalesAndPurchases", another called "Accounting". Both have their own tables etc.
A User logs in to the one single server, and then per GRANTS it's decided if User A is allowed to take a peek at "Accounting", or if he gets "Err... no no...it's not your business how much the Boss earns"

I know this for a fact, since i HAVE such a scenario (though for IBM DB2)

in context of SQLite: SQLite is a single-file DBMS, meaning the usual case with SQLite is: 1 File, 1 Schema (=Database), which contains tables etc..
That schema is always called "main"

BUT: What you can do in SQLite is "attach" another Database-File.
Then you would have the scenario, which SF is alluding to: having 2 Schemas in SQLite (though i don't know, how that attached schema is called, since in its own file it's "main" again)
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1215
Re: [solved] Table names in sqlite3 database
« Reply #18 on: June 15, 2023, 04:28:56 pm »
What distinguishes one schema from another?
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

Zvoni

  • Hero Member
  • *****
  • Posts: 2741
Re: [solved] Table names in sqlite3 database
« Reply #19 on: June 19, 2023, 01:54:08 pm »
What distinguishes one schema from another?
Usually access rights (as i've written above), but this does not apply to SQLite, since SQLite doesn't support GRANTS/User rights.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1215
Re: [solved] Table names in sqlite3 database
« Reply #20 on: June 21, 2023, 01:12:06 am »
Ok that makes sense, I have only used sqlite, so for me the schema is just the tables in one database. Thanks again for explaining.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

 

TinyPortal © 2005-2018