[sqlite] Tcl API docs - clarification
Just spent a while trying to work out how to access sqlite in read-only mode from Tcl. There seems to be nothing in the API doc : http://www.sqlite.org/tclsqlite.html I eventually got the information from an error message: wrong # args: should be sqlite3 HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? Would it be possible for you to add these options for the 'sqlite3' command to the Tcl API document. Thanks John Gillespie ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Tcl API docs - clarification
Hi, I think you should have a look here: http://www.sqlite.org/uri.html Hope that helps! Fredrik On Tue, Oct 23, 2012 at 10:48 AM, John Gillespie rjkgilles...@gmail.comwrote: Just spent a while trying to work out how to access sqlite in read-only mode from Tcl. There seems to be nothing in the API doc : http://www.sqlite.org/tclsqlite.html I eventually got the information from an error message: wrong # args: should be sqlite3 HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? Would it be possible for you to add these options for the 'sqlite3' command to the Tcl API document. Thanks John Gillespie ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- Life is like a trumpet - if you don't put anything into it, you don't get anything out of it. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Why is the SQLite provider missing from the Server Explorer Add Connection dialogue
Hi All, I installed sqlite-netFx40-setup-x64-2010-1.0.82.0.exehttp://system.data.sqlite.org/downloads/1.0.82.0/sqlite-netFx40-setup-x64-2010-1.0.82.0.exe on my Win 7 machine. But the Server Explorer Add Connection dialogue does not show a Sqlite source. I have read various posts and could not find a solution. I also tried sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exehttp://system.data.sqlite.org/downloads/1.0.82.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe and chose to install it in GAC. Still the same problem. I also tried to edit machine.config and app.config, no improvement. Do I have to install Sqlite in order for it to work? Thanks ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] insert if in SQL cmd
The analogy you have chosen to explain the algorithm of your program is clear, but it seems to me that you are using a specific computer language to achieve its goal. Perhaps, it would be much easier on us, the helpers, to help you if you provide information that is more tangible; as in a snip of the code. Genius might have limitations, but stupidity is no handicap -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of YAN HONG YE Sent: Monday, October 22, 2012 10:01 PM To: sqlite-users@sqlite.org Subject: [sqlite] insert if in SQL cmd I need a function to run step 2 in sql cmd, but I don't know how to write in the sql environment. 1. BEGIN TRANSACTION; 2. if today is mondy to fridy,then run 3-6 ELSE run 6. 3. prepare and step stmt A (SELECT * FROM foo WHERE rowid=1), A is not finalized or reset; 4. execute stmt B (DELETE FROM foo WHERE rowid=1), B is prepared, executed and finalized; 5. access column data via stmt A 6. COMMIT ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Why is the SQLite provider missing from the Server Explorer Add Connection dialogue
Quanren Xiong wrote: I installed sqlite-netFx40-setup-x64-2010-1.0.82.0.exe on my Win 7 machine. But the Server Explorer Add Connection dialogue does not show a Sqlite source. I have read various posts and could not find a solution. Only the 32-bit setup packages are capable of installing the Visual Studio design-time support. I also tried sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe and chose to install it in GAC. Still the same problem. What version of Visual Studio are you using? What errors are seen in the log files %TEMP%\Installer.exe.trace.tmp*.log? Do I have to install Sqlite in order for it to work? For the Visual Studio design-time support, yes. For simply using it in a project, no. See also: http://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q8 -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Why is the SQLite provider missing from the Server Explorer Add Connection dialogue
Thanks for your reply. Sorry last time I installed sqlite-netFx40-setup-bundle-x64-2010-1.0.82.0.exe, it did not work. I did not install tried sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe. Sorry for the typo. Even my machine is running 64 bit Win7, I just tried sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe. This time I saw SQLite Provider in the Server Explorer Add Connection dialogue. However when I run the test program, I got following error messages. Do I need to install sqlite-netFx40-setup-bundle-x64-2010-1.0.82.0.exe as well? How to get the design time working on 64 bit platform? Thanks a lot See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ** Exception Text ** System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark stackMark, Boolean loadTypeFromPartialName) at System.Type.GetType(String typeName) at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow) at test.TestCasesDialog.runButton_Click(Object sender, EventArgs e) in c:\dev\sqlite\dotnet\test\TestCasesDialog.cs:line 111 at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message m) at System.Windows.Forms.ButtonBase.WndProc(Message m) at System.Windows.Forms.Button.WndProc(Message m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. ** Loaded Assemblies ** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600) CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll test Assembly Version: 1.0.82.0 Win32 Version: 1.0.82.0 CodeBase: file:///C:/Program%20Files%20(x86)/System.Data.SQLite/2010/bin/test.exe System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.269 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.278 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.282 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll System.Data Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.233 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.233 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll System.Numerics Assembly Version: 4.0.0.0
Re: [sqlite] Why is the SQLite provider missing from the Server Explorer Add Connection dialogue
Quanren Xiong wrote: However when I run the test program, I got following error messages. Do I need to install sqlite-netFx40-setup-bundle-x64-2010-1.0.82.0.exe as well? No. The test application has nothing to do with the Visual Studio design-time support. Since the test application is managed code, it will run with the native processor architecture of the machine, which means it will require the 64-bit native interop assembly. Please see the following for more details: http://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q12 http://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q20 For your own projects, using the official NuGet package is highly recommended as it has the native library pre-loading feature enabled and handles these processor architecture differences mostly automatically. How to get the design time working on 64 bit platform? Visual Studio is always a 32-bit application. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Getting Error SQLITE_NOTADB
Hi I am using Sqlite for my project and getting Error like -SQLITE_NOTADB whenever i am trying below scenario- 1- Open and create the database 2- Execute Sqlite_Exec to Insert the record in the database table 3- Close the database 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Anybody have any idea what would be the reason if db table is creating properly then why does failing in this condition . Cheers kritesh I am getting Error lockBtree -- Regards kritesh tripathi ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting Error SQLITE_NOTADB
I assume you have some program doing the sqlite_exec? Care to show us your code? I just ran a test doing what you describe with SQLite Database Browser Version 2.0b1 and the following program compiled against 3.7.13; After the 2nd run of this program there are 2 records in test.db which the browser showsno errors occur. #include stdio.h #include sqlite3.h int main() { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 11:58 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Getting Error SQLITE_NOTADB Hi I am using Sqlite for my project and getting Error like -SQLITE_NOTADB whenever i am trying below scenario- 1- Open and create the database 2- Execute Sqlite_Exec to Insert the record in the database table 3- Close the database 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Anybody have any idea what would be the reason if db table is creating properly then why does failing in this condition . Cheers kritesh I am getting Error lockBtree -- Regards kritesh tripathi ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting Error SQLITE_NOTADB
On 23 Oct 2012, at 5:58pm, kritesh tripathi tripathi.krit...@gmail.com wrote: 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Try it without step 4. Do you still have the problem ? Try it with steps 3, 4, or 5. Do you still have the problem ? What SQL command results in the SQLITE_NOTADB ? Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting Error SQLITE_NOTADB
hi michale there is no problem in creating and inserting the records in table ...but after tht i am trying to update the coloum value of table and using update command with where clause ..here every time sqlite_exec command failing and rc returns in sqlite3_prepare such as SQLITE_NOTADB CHEERS KRITESH On Oct 24, 2012 2:10 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: I assume you have some program doing the sqlite_exec? Care to show us your code? I just ran a test doing what you describe with SQLite Database Browser Version 2.0b1 and the following program compiled against 3.7.13; After the 2nd run of this program there are 2 records in test.db which the browser showsno errors occur. #include stdio.h #include sqlite3.h int main() { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 11:58 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Getting Error SQLITE_NOTADB Hi I am using Sqlite for my project and getting Error like -SQLITE_NOTADB whenever i am trying below scenario- 1- Open and create the database 2- Execute Sqlite_Exec to Insert the record in the database table 3- Close the database 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Anybody have any idea what would be the reason if db table is creating properly then why does failing in this condition . Cheers kritesh I am getting Error lockBtree -- Regards kritesh tripathi ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting Error SQLITE_NOTADB
hi simon i am not using step 4 in my program...after step 1 to 3 ,db file create in external sd card . then i am trying to update the colum value of table using upadte command with where clause but its failing due to below if condition as i mentioned in the sqlite3_prepare--lockBtree if(memcmp...) page1_init fail cheers kritesh On Oct 24, 2012 2:12 AM, Simon Slavin slav...@bigfraud.org wrote: On 23 Oct 2012, at 5:58pm, kritesh tripathi tripathi.krit...@gmail.com wrote: 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Try it without step 4. Do you still have the problem ? Try it with steps 3, 4, or 5. Do you still have the problem ? What SQL command results in the SQLITE_NOTADB ? Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting Error SQLITE_NOTADB
OK...here it is again using an updatestill works for me. Does it work for you? run it like this...first run with no args creates the table simple simple 1 2 simple 2 3 The args just update from/to values so you can see them changing using and update/where clause. #1 What OS? #2 What language #3 Where's your code? #include stdio.h #include sqlite3.h int main(int argc, char *argv[]) { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } if (argc == 1) { sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); } else { char sql[4096]; if (argc != 3) { printf(Need 2 args, old/new values\n); exit(1); } sprintf(sql,update t set i=%s where i=%s,argv[2],argv[1]); rc=sqlite3_exec(db,sql,NULL,NULL,NULL); } if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); return 0; } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 1:44 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Getting Error SQLITE_NOTADB hi michale there is no problem in creating and inserting the records in table ...but after tht i am trying to update the coloum value of table and using update command with where clause ..here every time sqlite_exec command failing and rc returns in sqlite3_prepare such as SQLITE_NOTADB CHEERS KRITESH On Oct 24, 2012 2:10 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: I assume you have some program doing the sqlite_exec? Care to show us your code? I just ran a test doing what you describe with SQLite Database Browser Version 2.0b1 and the following program compiled against 3.7.13; After the 2nd run of this program there are 2 records in test.db which the browser showsno errors occur. #include stdio.h #include sqlite3.h int main() { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 11:58 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Getting Error SQLITE_NOTADB Hi I am using Sqlite for my project and getting Error like -SQLITE_NOTADB whenever i am trying below scenario- 1- Open and create the database 2- Execute Sqlite_Exec to Insert the record in the database table 3- Close the database 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Anybody have any idea what would be the reason if db table is creating properly then why does failing in this condition . Cheers kritesh I am getting Error lockBtree -- Regards kritesh tripathi ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] VTab xRename
Hello, The documentation says the xRename function is mandatory: http://sqlite.org/vtab.html#xrename The xRename method is required for every virtual table implementation. But it seems possible to not specify it: static const sqlite3_module fts3aux_module = { ... 0, /* xRename */ ... }; Regards. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] VTab xRename
On Tue, Oct 23, 2012 at 10:16:07PM +0200, gwenn scratched on the wall: Hello, The documentation says the xRename function is mandatory: http://sqlite.org/vtab.html#xrename The xRename method is required for every virtual table implementation. But it seems possible to not specify it: static const sqlite3_module fts3aux_module = { ... 0, /* xRename */ ... }; And when you attempt to rename the table, what happens? The virtual table interface is advanced, in the sense that there are very few safety nets or double-checks. It is designed to be used by an intelligent programmer that knows their stuff. You need to do what the docs say, exactly, or something bad can happen. That's not to say something bad will happen right away. The fact that you can assign a NULL function pointer to the xRename() function only means the system is not double-checking your work when you pass in the structure... it does not mean that passing a NULL is allowed. I strongly suspect that if you do not provide a xRename() function, and someone attempts to rename the table, the whole application will simply crash. Your fault. -j -- Jay A. Kreibich J A Y @ K R E I B I.C H Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable. -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Mac development question
Hi, ALL, I'm developing a program that will be cross-platform and utilize SQLite database. My main development platform is Windows and when I finish I will move to Mac. My question is: 1. I know on Mac I need to build an application bundle. Where do I store the .db file relative to the bundle? Inside it? Home directory? Somewhere on the hard drive? What is the usual place for it? 2. When I done on Windows I should be able to just copy the file and drop it on the Mac HD, right? Thank you. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
On Oct 23, 2012, at 4:58 PM, Igor Korot ikoro...@gmail.com wrote: 1. I know on Mac I need to build an application bundle. Where do I store the .db file relative to the bundle? Inside it? Home directory? Somewhere on the hard drive? What is the usual place for it? If the database is read-only, you can sore it inside the bundle. If it is application configuration, you should store it in the application's directory in the user's ~/Library/Application Support/application name If the database is a document, you should store it wherever the use directs via a file dialog. SQLite itself doesn't care where the database is stored as long as the directory it is in is read/write. 2. When I done on Windows I should be able to just copy the file and drop it on the Mac HD, right? Yes. e ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
Hi, Doug, On Tue, Oct 23, 2012 at 2:26 PM, Doug Currie doug.cur...@gmail.com wrote: On Oct 23, 2012, at 4:58 PM, Igor Korot ikoro...@gmail.com wrote: 1. I know on Mac I need to build an application bundle. Where do I store the .db file relative to the bundle? Inside it? Home directory? Somewhere on the hard drive? What is the usual place for it? If the database is read-only, you can sore it inside the bundle. Nope. There will be new records insertion/old record update/delete. If it is application configuration, you should store it in the application's directory in the user's ~/Library/Application Support/application name Nope. It is for an application data. If the database is a document, you should store it wherever the use directs via a file dialog. So then user home directory (~) should be fine, right? SQLite itself doesn't care where the database is stored as long as the directory it is in is read/write. 2. When I done on Windows I should be able to just copy the file and drop it on the Mac HD, right? Yes. Good. Thank you. e ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
On Oct 23, 2012, at 11:35 PM, Igor Korot ikoro...@gmail.com wrote: So then user home directory (~) should be fine, right? No. Don't. Lookup NSApplicationSupportDirectory and check the documentation. Apple has clear APIs and guidelines about where to put what. Learn them. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
On 23 Oct 2012, at 10:35pm, Igor Korot ikoro...@gmail.com wrote: On Tue, Oct 23, 2012 at 2:26 PM, Doug Currie doug.cur...@gmail.com wrote: On Oct 23, 2012, at 4:58 PM, Igor Korot ikoro...@gmail.com wrote: 1. I know on Mac I need to build an application bundle. Where do I store the .db file relative to the bundle? Inside it? Home directory? Somewhere on the hard drive? What is the usual place for it? If the database is read-only, you can sore it inside the bundle. Nope. There will be new records insertion/old record update/delete. If it is application configuration, you should store it in the application's directory in the user's ~/Library/Application Support/application name Nope. It is for an application data. If the database is a document, you should store it wherever the use directs via a file dialog. So then user home directory (~) should be fine, right? No. Never put anything in the home directory. That's just for other things Apple has already put in there. Most user's don't realise they have a home directory and will arbitrarily delete things they find there: I don't know what this is for and I don't care about it.. If your user considers these SQLite databases to be their own documents (i.e. like a word processor saves text documents, your application saves SQLite databases) then you must use Apple's standard 'Save' and 'Open' APIs to allow the user to decide where the files go. This gives the user all the facilities they're used to, like drag-and-drop and automatically picking the most recently used directory. Most users will chose to keep their documents on the desktop or in their own Documents folder, but will regard any application which doesn't give them the ability to choose as weird and broken and will not use it. If one of these files disappears between runs of your program then the application just considers that saved document to have been deleted. If your SQLite database is used to support the inner workings of your application that the user knows nothing about and never has to manipulate themself (e.g. a web browser might keep an internal database of DNS addresses) then there are two possibilities. If you only need one of these files, no matter which user is using your app, then it belongs in /Library/Application Support/application name. If each user needs their own file then it belongs in ~/Library/Application Support/application name as Doug wrote. Apple provides an API which will provide the correct pathname for you, as Petite wrote. You would never have to know the above path yourself unless you're writing in a language which cannot access Apple's standard API. If one of these documents disappears between runs of your program then your application must be able to recover from this situation itself, perhaps by creating a new empty database or by duplicating a copy from its application bundle. If your SQLite database is used to store the user's own preferences about how the application should work which change with the user's own preferences, then the file should be stored in the user's Preferences folder. Again, Apple provides an API which will produce the right path for you, and you should never generate it yourself. However storing preferences in a SQLite database is non-standard: Apple already provides a standard mechanism for storing user preferences. If one of these documents disappears between runs of your program then your application must be able to recover from this situation itself, perhaps by creating a new empty database or by duplicating a copy from its application bundle. All of the above is second-nature to any Macintosh programmer. They don't even have to think about this stuff, just like a Windows programmer expects to see their application show up in the Start menu and on the Taskbar. It may be that you should talk to an experienced Mac programmer before porting your application across so you do this and other things in the way a Mac user would expect. SQLite itself doesn't care where the database is stored as long as the directory it is in is read/write. 2. When I done on Windows I should be able to just copy the file and drop it on the Mac HD, right? Yes. Good. Right. SQLite database file format is cross-platform. If you have one that works on one platform, you can just copy it over and it'll work. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
Hi, On Tue, Oct 23, 2012 at 3:10 PM, Simon Slavin slav...@bigfraud.org wrote: On 23 Oct 2012, at 10:35pm, Igor Korot ikoro...@gmail.com wrote: On Tue, Oct 23, 2012 at 2:26 PM, Doug Currie doug.cur...@gmail.com wrote: On Oct 23, 2012, at 4:58 PM, Igor Korot ikoro...@gmail.com wrote: 1. I know on Mac I need to build an application bundle. Where do I store the .db file relative to the bundle? Inside it? Home directory? Somewhere on the hard drive? What is the usual place for it? If the database is read-only, you can sore it inside the bundle. Nope. There will be new records insertion/old record update/delete. If it is application configuration, you should store it in the application's directory in the user's ~/Library/Application Support/application name Nope. It is for an application data. If the database is a document, you should store it wherever the use directs via a file dialog. So then user home directory (~) should be fine, right? No. Never put anything in the home directory. That's just for other things Apple has already put in there. Most user's don't realise they have a home directory and will arbitrarily delete things they find there: I don't know what this is for and I don't care about it.. OK. If your user considers these SQLite databases to be their own documents (i.e. like a word processor saves text documents, your application saves SQLite databases) then you must use Apple's standard 'Save' and 'Open' APIs to allow the user to decide where the files go. This gives the user all the facilities they're used to, like drag-and-drop and automatically picking the most recently used directory. Most users will chose to keep their documents on the desktop or in their own Documents folder, but will regard any application which doesn't give them the ability to choose as weird and broken and will not use it. If one of these files disappears between runs of your program then the application just considers that saved document to have been deleted. Well, that the closest definition of the data I'm about to put into this database. I am making a sport related application and need to store the data about the teams, players etc. User should be able to add/edit/delete this information and this information will be presented in the GUI. Now the application is not creating the database - I am. The application/user is just uses the data in it. So on the first start there should be records in the db already. However, from you response I gather I will need an application installer which will ask the user Where do you want to store the database with the data? Am I correct? If yes, what I can use in order to create such distribution package? I presume it should be something like XCode installer, which asks couple of questions first and then copy everything. If no, then could you clarify, please. Thank you. If your SQLite database is used to support the inner workings of your application that the user knows nothing about and never has to manipulate themself (e.g. a web browser might keep an internal database of DNS addresses) then there are two possibilities. If you only need one of these files, no matter which user is using your app, then it belongs in /Library/Application Support/application name. If each user needs their own file then it belongs in ~/Library/Application Support/application name as Doug wrote. Apple provides an API which will provide the correct pathname for you, as Petite wrote. You would never have to know the above path yourself unless you're writing in a language which cannot access Apple's standard API. If one of these documents disappears between runs of your program then your application must be able to recover from this situation itself, perhaps by creating a new empty database or by duplicating a copy from its application bundle. If your SQLite database is used to store the user's own preferences about how the application should work which change with the user's own preferences, then the file should be stored in the user's Preferences folder. Again, Apple provides an API which will produce the right path for you, and you should never generate it yourself. However storing preferences in a SQLite database is non-standard: Apple already provides a standard mechanism for storing user preferences. If one of these documents disappears between runs of your program then your application must be able to recover from this situation itself, perhaps by creating a new empty database or by duplicating a copy from its application bundle. All of the above is second-nature to any Macintosh programmer. They don't even have to think about this stuff, just like a Windows programmer expects to see their application show up in the Start menu and on the Taskbar. It may be that you should talk to an experienced Mac programmer before porting your application across so you do this
Re: [sqlite] Mac development question
On 23 Oct 2012, at 11:41pm, Igor Korot ikoro...@gmail.com wrote: On Tue, Oct 23, 2012 at 3:10 PM, Simon Slavin slav...@bigfraud.org wrote: If your user considers these SQLite databases to be their own documents (i.e. like a word processor saves text documents, your application saves SQLite databases) then you must use Apple's standard 'Save' and 'Open' APIs to allow the user to decide where the files go. This gives the user all the facilities they're used to, like drag-and-drop and automatically picking the most recently used directory. Most users will chose to keep their documents on the desktop or in their own Documents folder, but will regard any application which doesn't give them the ability to choose as weird and broken and will not use it. If one of these files disappears between runs of your program then the application just considers that saved document to have been deleted. However, from you response I gather I will need an application installer which will ask the user Where do you want to store the database with the data? Am I correct? If yes, what I can use in order to create such distribution package? I presume it should be something like XCode installer, which asks couple of questions first and then copy everything. If no, then could you clarify, please. Okay, you nearly got it. First, Macs don't use installers. Your user drags your application to wherever they want to keep it. Then they run your application. Your application is responsible for creating support files wherever it needs them to be. If it starts up and notices that its support files are missing (which they definitely will be the first time, and may be subsequent times) then it's responsible for making new ones. It can make these files by you writing complicated software which creates exactly the right files in the right place, or by simply copying a pre-made file or folder structure from its bundle straight into the user's filespace (far simpler and faster). The only time I see installers is from programmers used to non-Mac and Mac users hate them. Well, that the closest definition of the data I'm about to put into this database. I am making a sport related application and need to store the data about the teams, players etc. User should be able to add/edit/delete this information and this information will be presented in the GUI. Now the application is not creating the database - I am. The application/user is just uses the data in it. So on the first start there should be records in the db already. Sorry but I need clarification of the above. This database that you say you start off creating -- I am in the above. Pretend that the Mac this application is installed on one computer shared by two different people, each with their own user account, and both of whom like using your application. Your starting data can be got from anywhere. You can copy it from inside your application bundle. Or you can download it from a page on a web server. Or your program can create some random starting data. What governs where the data should be kept is whether you need one copy that's used for all users, or one copy per user, or one copy for each time a user hits 'save'. Ignore what the source of the 'starting' data is, and pretend your two users sharing one computer have both been using your application for months. After a couple of months of use is there just one copy of the database for the application, and all users share the same data no matter who is logged in, and changes made by one user show up when the other user uses your program ? Or do both users need their own copy of this database, but this database doesn't represent a specific save, it's more like background information not related to any 'Save' the user has created ? Or is this a particular copy of the user's data, created when they hit 'Save', and any user may have multiple copies of the data, because they can hit 'Save' lots of times ? The answer tells us where the data should be saved, and which API function you use to get the unix path your program should use. For the first two options above, there's an API call you make which hands back the appropriate folder without user interaction. For the third option, where your user is making their own save files, you call a different API which lets the user pick where they want their new saved file. It presents the folder structure to the user, let's them pick a folder, then hands back to your program the path for the folder the user picked. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Getting Error SQLITE_NOTADB
hi michael thanks for the responnse bt still getting the same problem language-C++ RTOS-micro itron where-creating db in digital camera external sd card and afterwards usin this db file for some wifi feature present in digital camera so that user can see all those images in tv or mobile. after debug i find tht in tht if condition using memcmp which compares between page1 and zmagicheaderbt value of page1= is this a problem ? cheers kritesh On Oct 24, 2012 3:57 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: OK...here it is again using an updatestill works for me. Does it work for you? run it like this...first run with no args creates the table simple simple 1 2 simple 2 3 The args just update from/to values so you can see them changing using and update/where clause. #1 What OS? #2 What language #3 Where's your code? #include stdio.h #include sqlite3.h int main(int argc, char *argv[]) { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } if (argc == 1) { sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); } else { char sql[4096]; if (argc != 3) { printf(Need 2 args, old/new values\n); exit(1); } sprintf(sql,update t set i=%s where i=%s,argv[2],argv[1]); rc=sqlite3_exec(db,sql,NULL,NULL,NULL); } if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); return 0; } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 1:44 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Getting Error SQLITE_NOTADB hi michale there is no problem in creating and inserting the records in table ...but after tht i am trying to update the coloum value of table and using update command with where clause ..here every time sqlite_exec command failing and rc returns in sqlite3_prepare such as SQLITE_NOTADB CHEERS KRITESH On Oct 24, 2012 2:10 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: I assume you have some program doing the sqlite_exec? Care to show us your code? I just ran a test doing what you describe with SQLite Database Browser Version 2.0b1 and the following program compiled against 3.7.13; After the 2nd run of this program there are 2 records in test.db which the browser showsno errors occur. #include stdio.h #include sqlite3.h int main() { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 11:58 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Getting Error SQLITE_NOTADB Hi I am using Sqlite for my project and getting Error like -SQLITE_NOTADB whenever i am trying below scenario- 1- Open and create the database 2- Execute Sqlite_Exec to Insert the record in the database table 3- Close the database 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto page1_init_failed; Everytimes above if condition True hence page1_init_failed and returns rc = SQLITE_NOTADB; Anybody have any idea what would be the reason if db table is creating properly then why does failing in this condition . Cheers kritesh I am getting Error lockBtree -- Regards kritesh tripathi ___ sqlite-users mailing list
Re: [sqlite] Getting Error SQLITE_NOTADB
Save yourself some time and show some code, it will make it easy for us to help you. Genius might have limitations, but stupidity is no handicap -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of kritesh tripathi Sent: Tuesday, October 23, 2012 10:32 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Getting Error SQLITE_NOTADB hi michael thanks for the responnse bt still getting the same problem language-C++ RTOS-micro itron where-creating db in digital camera external sd card and afterwards usin this db file for some wifi feature present in digital camera so that user can see all those images in tv or mobile. after debug i find tht in tht if condition using memcmp which compares between page1 and zmagicheaderbt value of page1= is this a problem ? cheers kritesh On Oct 24, 2012 3:57 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: OK...here it is again using an updatestill works for me. Does it work for you? run it like this...first run with no args creates the table simple simple 1 2 simple 2 3 The args just update from/to values so you can see them changing using and update/where clause. #1 What OS? #2 What language #3 Where's your code? #include stdio.h #include sqlite3.h int main(int argc, char *argv[]) { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } if (argc == 1) { sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); } else { char sql[4096]; if (argc != 3) { printf(Need 2 args, old/new values\n); exit(1); } sprintf(sql,update t set i=%s where i=%s,argv[2],argv[1]); rc=sqlite3_exec(db,sql,NULL,NULL,NULL); } if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); return 0; } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 1:44 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Getting Error SQLITE_NOTADB hi michale there is no problem in creating and inserting the records in table ...but after tht i am trying to update the coloum value of table and using update command with where clause ..here every time sqlite_exec command failing and rc returns in sqlite3_prepare such as SQLITE_NOTADB CHEERS KRITESH On Oct 24, 2012 2:10 AM, Black, Michael (IS) michael.bla...@ngc.com wrote: I assume you have some program doing the sqlite_exec? Care to show us your code? I just ran a test doing what you describe with SQLite Database Browser Version 2.0b1 and the following program compiled against 3.7.13; After the 2nd run of this program there are 2 records in test.db which the browser showsno errors occur. #include stdio.h #include sqlite3.h int main() { sqlite3 *db; int rc; rc=sqlite3_open(test.db,db); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_exec(db,create table t (i integer);,NULL,NULL,NULL); rc=sqlite3_exec(db,insert into t values(1);,NULL,NULL,NULL); if (rc != SQLITE_OK) { puts(sqlite3_errmsg(db)); } sqlite3_close(db); } Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of kritesh tripathi [tripathi.krit...@gmail.com] Sent: Tuesday, October 23, 2012 11:58 AM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] Getting Error SQLITE_NOTADB Hi I am using Sqlite for my project and getting Error like -SQLITE_NOTADB whenever i am trying below scenario- 1- Open and create the database 2- Execute Sqlite_Exec to Insert the record in the database table 3- Close the database 4- Confirm by opening the .db file in sqlite browser tht dtabase table insert the records 5- Again Open the the database 6- Whenever Executing Sqlite_Exec to Update the colum value of database table . .Getting the Errror in Sqlite3_Prepare()---lockBtree(BtShared *pBt)-- if( memcmp(page1, zMagicHeader, 16)!=0 ){ goto
Re: [sqlite] Mac development question
Igor Korot wrote: Well, that the closest definition of the data I'm about to put into this database. I am making a sport related application and need to store the data about the teams, players etc. User should be able to add/edit/delete this information and this information will be presented in the GUI. Now the application is not creating the database - I am. The application/user is just uses the data in it. So on the first start there should be records in the db already. However, from you response I gather I will need an application installer which will ask the user Where do you want to store the database with the data? Am I correct? If yes, what I can use in order to create such distribution package? I presume it should be something like XCode installer, which asks couple of questions first and then copy everything. If no, then could you clarify, please. You should not have an application installer, at all. Instead, you can ask the question on where to store the database when the user opens your program. Or better yet, your application should have menu commands like new database and open database, where if they choose the former then you ask them (using Apple's standard method) where that database goes. If they chose open database, then you can let them open an existing one, or one should be able to double-click the database file in the Finder to open that one instead, which is what Mac users expect. As such, your application should support having multiple databases per user, even if they may typically just use one. If users open your program directly and not by double-clicking on a database file, you could automatically bring up a prompt to make a new one, as if they used the new database menu. -- Darren Duncan ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
Simon, On Tue, Oct 23, 2012 at 5:24 PM, Simon Slavin slav...@bigfraud.org wrote: On 23 Oct 2012, at 11:41pm, Igor Korot ikoro...@gmail.com wrote: On Tue, Oct 23, 2012 at 3:10 PM, Simon Slavin slav...@bigfraud.org wrote: If your user considers these SQLite databases to be their own documents (i.e. like a word processor saves text documents, your application saves SQLite databases) then you must use Apple's standard 'Save' and 'Open' APIs to allow the user to decide where the files go. This gives the user all the facilities they're used to, like drag-and-drop and automatically picking the most recently used directory. Most users will chose to keep their documents on the desktop or in their own Documents folder, but will regard any application which doesn't give them the ability to choose as weird and broken and will not use it. If one of these files disappears between runs of your program then the application just considers that saved document to have been deleted. However, from you response I gather I will need an application installer which will ask the user Where do you want to store the database with the data? Am I correct? If yes, what I can use in order to create such distribution package? I presume it should be something like XCode installer, which asks couple of questions first and then copy everything. If no, then could you clarify, please. Okay, you nearly got it. First, Macs don't use installers. Your user drags your application to wherever they want to keep it. Then they run your application. Your application is responsible for creating support files wherever it needs them to be. If it starts up and notices that its support files are missing (which they definitely will be the first time, and may be subsequent times) then it's responsible for making new ones. It can make these files by you writing complicated software which creates exactly the right files in the right place, or by simply copying a pre-made file or folder structure from its bundle straight into the user's filespace (far simpler and faster). The only time I see installers is from programmers used to non-Mac and Mac users hate them. It looks like you are Apple person that I got suggeted to talk to. ;-) The situation is as follows: I am developing an application that will utilize not just SQLite but some other library. According to the development standards on *nix-like systems programs should use dynamic linking (use .so), and not static linking (not use .a). Since Apple Mac OS X follows *nix, this will be the approach. According to the same guidelines all those libraries should go to /usr/lib (or /usr/local/lib). Now how else I can place everything in the proper place without installer/distribution package? On Mac they have dmg extension IIRC. Now AFAICS, those distribution packages (or dmg) files can be called installation packages. Well, that the closest definition of the data I'm about to put into this database. I am making a sport related application and need to store the data about the teams, players etc. User should be able to add/edit/delete this information and this information will be presented in the GUI. Now the application is not creating the database - I am. The application/user is just uses the data in it. So on the first start there should be records in the db already. Sorry but I need clarification of the above. This database that you say you start off creating -- I am in the above. Pretend that the Mac this application is installed on one computer shared by two different people, each with their own user account, and both of whom like using your application. OK. Your starting data can be got from anywhere. You can copy it from inside your application bundle. Or you can download it from a page on a web server. Or your program can create some random starting data. What governs where the data should be kept is whether you need one copy that's used for all users, or one copy per user, or one copy for each time a user hits 'save'. Ignore what the source of the 'starting' data is, and pretend your two users sharing one computer have both been using your application for months. This will be one copy for all users. The database will be populated originally by me and will be supplied alone with the application bundle and those additional library. After a couple of months of use is there just one copy of the database for the application, and all users share the same data no matter who is logged in, and changes made by one user show up when the other user uses your program ? Or do both users need their own copy of this database, but this database doesn't represent a specific save, it's more like background information not related to any 'Save' the user has created ? Or is this a particular copy of the user's data, created when they hit 'Save', and any user may have multiple copies of the data,
Re: [sqlite] Mac development question
Darren, On Tue, Oct 23, 2012 at 8:53 PM, Darren Duncan dar...@darrenduncan.net wrote: Igor Korot wrote: Well, that the closest definition of the data I'm about to put into this database. I am making a sport related application and need to store the data about the teams, players etc. User should be able to add/edit/delete this information and this information will be presented in the GUI. Now the application is not creating the database - I am. The application/user is just uses the data in it. So on the first start there should be records in the db already. However, from you response I gather I will need an application installer which will ask the user Where do you want to store the database with the data? Am I correct? If yes, what I can use in order to create such distribution package? I presume it should be something like XCode installer, which asks couple of questions first and then copy everything. If no, then could you clarify, please. You should not have an application installer, at all. Instead, you can ask the question on where to store the database when the user opens your program. Or better yet, your application should have menu commands like new database and open database, where if they choose the former then you ask them (using Apple's standard method) where that database goes. If they chose open database, then you can let them open an existing one, or one should be able to double-click the database file in the Finder to open that one instead, which is what Mac users expect. As such, your application should support having multiple databases per user, even if they may typically just use one. If users open your program directly and not by double-clicking on a database file, you could automatically bring up a prompt to make a new one, as if they used the new database menu. -- Darren Duncan I doubt the user of the application will wait couple of minutes while the database will be created and the data will be populated for about 5000 records. They won't come from the internet and I'm planning to insert them as a bulk procedure from the Excel file I have. Thank you. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Mac development question
Igor Korot wrote: Darren, On Tue, Oct 23, 2012 at 8:53 PM, Darren Duncan dar...@darrenduncan.net wrote: You should not have an application installer, at all. Instead, you can ask the question on where to store the database when the user opens your program. Or better yet, your application should have menu commands like new database and open database, where if they choose the former then you ask them (using Apple's standard method) where that database goes. If they chose open database, then you can let them open an existing one, or one should be able to double-click the database file in the Finder to open that one instead, which is what Mac users expect. As such, your application should support having multiple databases per user, even if they may typically just use one. If users open your program directly and not by double-clicking on a database file, you could automatically bring up a prompt to make a new one, as if they used the new database menu. -- Darren Duncan I doubt the user of the application will wait couple of minutes while the database will be created and the data will be populated for about 5000 records. They won't come from the internet and I'm planning to insert them as a bulk procedure from the Excel file I have. Thank you. Why would it take that long? Creating a database with 5000 records on a modern machine shouldn't take more than about 1 second or so. But even if it takes longer, my comment is about letting the user choose from the application itself where the data they edit goes, and your comments about the user waiting have nothing to say against that. -- Darren Duncan ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users