• Welcome to SQLitening Support Forum.
 

News:

Welcome to the SQLitening support forums!

Main Menu

Recent posts

#11
You've got Questions? We've got Answers! / Re: How to be able to see if a...
Last post by Fim - December 25, 2023, 12:20:49 PM
Ok.
I'm working on my solution.
/Fim W.
BTW Happy Christmas
#12
You've got Questions? We've got Answers! / Re: How to be able to see if a...
Last post by Fim - December 25, 2023, 11:56:55 AM
ok
#13
You've got Questions? We've got Answers! / How to be able to see if an ob...
Last post by Fim - December 25, 2023, 11:37:00 AM

Only way I have come up with is to try to do a lock, if it succeeds, ReturnCode = 0, then the object is not locked. If ReturnCode <> 0, the object is locked.
If you have made a lock during this examination, you should release the lock immediately.

Fim W.
#14
You've got Questions? We've got Answers! / Re: Opposite of slAttach
Last post by cj - November 12, 2023, 03:22:46 PM
Thanks Paul!
Testing code by running multiple times and no problem.
#INCLUDE ONCE "sqlitening.inc"

FUNCTION PBMAIN AS LONG
LOCAL x AS LONG
slSetProcessMods "E2"
FOR x = 1 TO 3
  slOpen  ":memory:"
  slAttach "sample.db3","paul"
  ? slSelStr("select price from parts limit 1") '3365
  slexe "DETACH DATABASE paul"
  ? slSelStr("select price from parts limit 1") 'no such table: parts
  slclose
NEXT
END FUNCTION
         
#15
You've got Questions? We've got Answers! / Re: Opposite of slAttach
Last post by Paul Squires - November 10, 2023, 06:30:11 PM
I haven't used SQLitening in 10 years but maybe something like the following would work:

slExe "DETACH DATABASE '" + database_name + "';"
#16
You've got Questions? We've got Answers! / Re: Opposite of slAttach
Last post by cj - November 10, 2023, 05:43:43 AM
I have read closing a SQLite database closes attached databases.
Searched forum and source code and can't find anything on detaching a database.
#17
You've got Questions? We've got Answers! / Opposite of slAttach
Last post by The Tramp - November 06, 2023, 07:06:38 PM
Once I attached a database to the main one, how do I detach it?
#18
General Board / Copy table to another database...
Last post by cj - July 06, 2023, 09:11:53 PM
#INCLUDE "sqlitening.inc"

FUNCTION PBMAIN AS LONG

 LOCAL sArray() AS STRING

 slOpen    "old.db","C"  'old schema: firstname,lastname,id
 slExe     "create table if not exists T1(firstname text,lastname text, id integer primary key)"
 slExebind "insert into T1 values(?,?,null)",bindstr("Heidi") + bindstr("Klum")
 slExebind "insert into T1 values(?,?,null)",bindstr("Robert")+ bindstr("Hope")
 slExebind "insert into T1 values(?,?,null)",bindstr("Bugs")  + bindstr("Bunny")
 slClose

 slOpen    "new.db","C"
 slAttach  "old.db","old" 'new schema: id,name
 slExe     "create table if not exists T1(id integer primary key,name text)"
 slExe     "insert or replace into T1(id,name) select id,lastname||', '|| firstname from old.T1"

 slselary  "select firstname,lastname from old.t1 " +_
           "union all " +_
           "select id,name from t1",sArray(),"Q9c"
 MSGBOX    JOIN$(sArray(),$CRLF)

END FUNCTION

#19
General Board / Default first record
Last post by cj - June 11, 2023, 02:54:55 PM
create table if not exists CounterTable(c1 integer,c2 text, c3 text);

insert into CounterTable (c1,c2,c3)              
 select 1,'cool','beans'                                
 where not exists (select * from CounterTable);


#20
You've got Questions? We've got Answers! / Timing (cache)
Last post by cj - May 19, 2023, 10:02:03 AM
SELECT * FROM WORDLIST WHERE LENGTH = 10  'missing column name

https://sqlite.org/forum/forumpost/fc1209eb59bcdbc0ec81e193561063707bcd36953d78a7c295521cd20277d674

QuoteThis is usually due to the operating system keeping recently used disk blocks in memory and/or SQLite doing the same with recently used pages from the database file.