Re: [sqlite] Re: sqlite_open
Dave Dyer wrote: At 08:04 PM 11/30/2006, John Stanton wrote: Those are Macintosh issues, not Sqlite, and you need to handle them in your application. Yes indeed. I'm only suggesting that sqlite would be a better substrate if it provided a supported way to tell me "I can't open the database" rather than "there is no table named xx". Jon Postel said: "Be conservative in what you do; be liberal in what you accept from others." Checking the existence of a file is a mere stat() away and querying the master table list is simple: SELECT name FROM sqlite_master WHERE type='table' AND name='%q'; sqlite is lean and mean, feature creep detracts from that. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Right() function
Cécilia Vigny wrote: Hi, Does SQLite supports the right(string, len) function ? For instance : SELECT myfield, right(myfield,5) FROM mytable where myfield = "aaa"; I've got an error near '(' when executing this request. http://www.sqlite.org/lang_expr.html substr(X,Y,Z): Return a substring of input string X that begins with the Y-th character and which is Z characters long. The left-most character of X is number 1. If Y is negative the the first character of the substring is found by counting from the right rather than the left. If SQLite is configured to support UTF-8, then characters indices refer to actual UTF-8 characters, not bytes. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Accommodating 'Insert' and 'Update'
Rich Shepard wrote: On Tue, 28 Nov 2006, Craig Morrison wrote: Another method is to have a field declared UNIQUE and use the syntax: INSERT OR REPLACE INTO table ... The UNIQUE constraint will trigger the REPLACE constraint if it already exists and the row will get updated instead of inserted. Craig, What I'm working on now is the general project database description. The schema for table 'model' is: CREATE TABLE model (model_name text not null primary key, model_desc text, model_type text, keName text, agent INTEGER); CREATE INDEX model_name_idx on model (model_name); The index is, I believe, redundant as the column is the primary key so it's both unique and indexed. I believe you are correct. I must admit I'm a bit behind on indexes as most of the sql operations that I do are simple lookups on small datasets. Maybe one of the other gurus can chime in here and offer more insight. Do I need to specify each field as unique for this to work? Perhaps part of my problem is that I'm not getting the database connection to work properly so I cannot test it in real time. One step at a time. No, you don't. What you have to make sure of though is that your `model_name' doesn't get changed during the edit because that will change the `uniqueness' of the record and thus the UNIQUE constraint never fires. Since model_name is your index and it is the unique or defining characteristic of each row its contents must not change after being inserted for an update to occur. If you must change the model_name, then you are delegated to "delete and reinsert" the record. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Accommodating 'Insert' and 'Update'
Rich Shepard wrote: What is the most efficient approach to test whether a record has a value in a field that's different from the one displayed? The only approach that occurs to me is to retrieve each field from the table and compare values with those in the form when the "Save" button is clicked. If the field is blank, then use an 'insert' statement; if the field has an existing value, use an 'update' statement. Seems kludgy to me. Kludgy but works. Another method is to have a field declared UNIQUE and use the syntax: INSERT OR REPLACE INTO table ... The UNIQUE constraint will trigger the REPLACE constraint if it already exists and the row will get updated instead of inserted. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] OT: filenaming conventions -- was: Re: [sqlite] Saving tables
P Kishor wrote: On 11/28/06, John Stanton <[EMAIL PROTECTED]> wrote: If you use an extension greater than 3 chars you violate rules for some existing file systems and reduce portability. You can also make it difficult to parse the extension when it is used to type the file. we are going a bit off-thread here, but violating the file system rule (in this case, Windows) is precisely why I use an extension greater that 3 chars. For example, .db extension is used by several other programs -- Windows itself uses .db extension for thumbnails it generates for pictures inside a folder. I want to get above that riff-raff. The stupid system just lists my databases as "SQLITE File." Good enough for me. As far as portability is concerned -- my world revolves around Unixes, in particular Mac OS X, some Linux variants, and Windows. I have never had any portability issues with foo.sqlite. In medecine the Hippocratic Oath requires "First, do no harm". Not a bad principle for IT design also. I think, in good health, the first principle should be, don't expose yourself to ills. By making my extension illegible to anything but SQLite, I am not even getting in the fray. Since we're already off-topic. :-D I'm sure you are already aware of this, just pointing it out in context so those that aren't have a heads up. Just a bit of warning, as it has bitten a few in the bum, about >3 character extensions under the NT+ variants.. They can and will bite you, for instance: dir *.sql Will list not only *.sql files, but *.sqlite too. Imagine: del *.sql Deleting all your *.sqlite files. Whoopsie.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] C++ SQLite
sebcity wrote: Thanks, Could you supply an example? I'm not going to be as nice as everyone else, go here: http://www.sqlite.org/cvstrac/wiki Do some research and then come back instead of asking for handouts. We've all been where you are now, the difference is that we tried on our own and _then_ came here asking questions when we got stuck. Trying to do a little work on your own will do you a world of good. Clay Dowling wrote: sebcity wrote: How would one go about using c++ (Visual Studio.NET) to call and display SQLite tables. C++ wrappers? You could just use the API directly. Myself, I've put a wrapper around it, but there's nothing saying that you have to. Clay -- CeaMuS http://www.ceamus.com Simple Content Management - To unsubscribe, send email to [EMAIL PROTECTED] ----- -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Date and time
Lloyd wrote: select datetime(1162961284,'unixepoch','localtime'); 2006-11-08 10:18:04 The result is correct. I would like to know how sqlite is performing the localtime correction. timestamps are in relation to UTC.. When you use the localtime modifier, you are instructing the code to adjust the timestamp display in accordance with your local settings. IOW, the offset from UTC of your system is used in the calculation of the displayed date. Google: "strftime", "asctime" and "localtime" for a better explanation. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Date data type
Lloyd wrote: Thanks gg and Craig Morrison for your informative reply. I would like to know one more thing, can I use these date and time functions with comparison operators? Will they return the correct result or as per the string comparison rules? Same rules apply, if it smells like a string.. :-) You can always cast() the result and then do your comparison. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Date data type
Lloyd wrote: Hi, How can I manage date and time using sqlite? [Do I have to do it outside sqlite?] http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] unsupported file format
Py Olivier wrote: Hello, After compiling I'm testing the C example program provided in the quick start page, just to get into the C/C++ interface for SQLite. ./exprog testdb 'select * from tbl1' The database file opens normaly, but I get an error coming from the sqlite3_exec method : SQL error: unsupported file format. As if there was a problem with the table names or query. The same SQL query on the same database works fine with the command-line sqlite3 program. What am I misunderstanding ? Not trying to be a jerk, but please search the archives for the past week or so. This subject has been beat to death.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Major projects using SQLite
Jon García de Salazar Bilbao wrote: Hi, Could you give examples of some major software projects using SQLite? Thanks, Jon. FireFox 2.0.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] How do you find out the names of the fields within a table?
John Newby wrote: Hi Fred, I am using vb.net 2002. I am not sure about dynamic arrays, I am looking into it now URLs may wrap For dictionaries: http://windowssdk.msdn.microsoft.com/en-us/library/x4k5wbx4.aspx For dynamic arrays: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmReDim.asp Google is your friend.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] How do you find out the names of the fields within a table?
John Newby wrote: Hi Craig, I have looked into the dictionary that you suggested, but wouldn't this be the same as the array as I would still need to know how many times to go through the while loop to add the names of the fields? Also I need to get the names of the fields back out to populate a comboBox, which I already know how to do with an array. item = myDict("hash") Its pretty simple. Use your favorite search engine to look for "scripting.dictionary" and you will find a wealth of information on VBScript's dictionary object. From an earlier message of yours: ' select all field names from the selected table sqlite_cmd.CommandText = (strSQL) ' Now the SQLiteCommand object can give us a DataReader-Object: sqlite_datareader = sqlite_cmd.ExecuteReader() i = 0 While sqlite_datareader.Read() 'Try fieldNames(i) = sqlite_datareader("name") 'atch es As Exception ' MessageBox.Show(es.Message) End Try i += 1 End While sqlite_datareader.Close() You are already getting the field names on the fly, why do you insist on knowing how many fields there are? After you populate the dictionary, you can get the count of items (fields) by doing: itemCount = myDict.Count To attempt to stave off any more questions: set fieldNames = CreateObject("Scripting.Dictionary") sqlite_cmd.CommandText = (strSQL) sqlite_datareader = sqlite_cmd.ExecuteReader() i = 0 While sqlite_datareader.Read() fieldNames.Add i, sqlite_datareader("name") i += 1 End While sqlite_datareader.Close() fieldCount = fieldNames.Count Your problem is *not* sqlite, but rather a command of VB itself. You might want to spend some time getting up to speed on VB. Or better yet, why don't you just pass a reference to the list box and add them directly to it? I'm not going to comment further on this topic as it is now QUITE far off-topic. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] How do you find out the names of the fields within a table?
Martin Jenkins wrote: John Newby wrote: Yeah I can get the names, but I need to put them in an array, and to put them in an array I need to know the size of the array to store them in, so I need to get a count first, then store this number as the size of the array before I store the values into the array. Are you sure there no dynamic container objects in VB that support an "append" method? Lists? If not (and I find that hard to believe) you could hack around it by appending the names to a string, then parsing the string and then dimensioning your array, or you could build a linked list but ... surely VB has more intelligent containers than statically sized arrays? Martin Yup, they are called dictionaries.. set myDict = CreateObject("Scripting.Dictionary") myDict.Add "Hash", "Data" I'll leave the rest up to the OP as this is straying from the topic at hand.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Problems with multiple threads?
Bill King wrote: It would be nice if SQLite told us this. However, SQLite detects the reserved lock and returns SQLITE_BUSY, telling niether transaction much other than to try again. If a reserved lock is detected when trying to promote an existing read lock, this is a deadlock situation and should perhaps return an error code of SQLITE_DEADLOCK instead? Christian According to DRH this scenario shouldn't happen. Begin should set a flag, and the second begin will bug out because the flag is set. This is what looks like happening in my scenario, and is definately wrong behaviour. begin should be just that begin, mutually exclusive, unless Dr Hipp want's to implement versioning based transaction schemes. Not, begin "maybe i'm read, maybe i'm write, i'll decide later and woe betide any one else who tries to write". It may be wrong behavior, but that's how SQLite works. Sometimes you just have to learn the quirks of the system and then deal with them. File a bug report or submit a patch with the "correct" behavior and I am sure DRH will be more than happy to review it. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] OT: SQL Help
Jarrett, Zachary wrote: I misread what you wanted to do. Now that I've re-read your post, I realize that the proper statement for what you want to do uses NOT IN rather than IN. So... DELETE FROM files WHERE filestamp NOT IN (SELECT filestamp FROM snapshot); Zack Thanks Zack, works a treat! -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
[sqlite] OT: SQL Help
With all the other discussions going on with more important matters please excuse this brief interruption.. I have two tables that are created thusly: CREATE TABLE files (filehash VARCHAR(48) UNIQUE, filestamp INTEGER, filename VARCHAR(2048)); CREATE TABLE snapshot (filehash VARCHAR(48) UNIQUE, filestamp INTEGER, filename VARCHAR(2048)); I suck at SQL, so I plead for your advice.. I want to be able to delete all rows from 'files' that do *not* exist in 'snapshot'. My efforts to date have done nothing but leave me with less hair. Thanks. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Purging the mailing list roles. Was: Please Restore Your Account Access
Jay Sprenkle wrote: On 5/30/06, Eric Scouten <[EMAIL PROTECTED]> wrote: I agree with Jay. I'd hate to have to respond to an e-mail ping every so often just to continue reading the list. On the other hand, I wouldn't mind terribly if I got placed on "moderated" status (i.e. had to go through a verification step in order to *post* to the list) if I were either (a) new to the list, or (b) hadn't posted in a while. As an alternative, Maybe we should point people who only want to read the list to a link to an email archive/aggregator and tell them to search there if they want answers and only to subscribe/resubscribe if they actively want to post. Because this penalizes people who want direct delivery. I don't know about you, but I have spent a lot of time tweaking my filters here to get mail delivered to me the way I want it. Trudging through someone else's archive is out of the question. +1 for moderated posting status after days, -10 for all of the other suggestions that will cause me to jump through hoops to stay subscribed. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] "SQL logic error or missing database"
Ran wrote: Indeed if I reset after the first step failed, and than prepare again, the select works. But I guess this is not the usual way to do things right? I mean - shouldn't the first prepare be aware of the fact that the database was changed? Or maybe CREATE TABLE is a special case? If I were to hazzard a guess, its because there was a second handle opened to the database that modified the schema which the first handle doesn't know about until it does its sanity check before operating on the database. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] scary warnings
[EMAIL PROTECTED] wrote: If you do not care to see the warnings, there is probably some way to turn them off in your compiler. To the OP: In VC7 and above.. Open the project settings for your project, navigate to: Configuration Properties -> C/C++ -> Disable Specific Warnings. Plug in the warning number(s) you don't want to see. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] maximum number of databases
Fitzpatrick, Bill (MS) wrote: We are considering SQLite to manage our data which is distributed over a number of ordinary directories (about a 1000 and growing). Is it feasible to create a separate SQLite database for each directory, totaling more than a 1000 databases each managed by the same SQLite server? What is the maximum number of databases managed a single server? http://www.sqlite.org/ "About SQLite SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine" Note: it says *engine* not server. SQLite is not a DBMS in the true sense, it is a library that you link to your applications that allows you to manage tables of a database in one file. You can open as many database files as your environment will allow.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] sqlite2 api question - updates
Jay Sprenkle wrote: > If version 2 does not support parameters what's the correct way to escape > the data? > I don't know about parameters, but here is one way: char *pszStatement; #define STATEMENT "UPDATE question SET qtext = '%q' WHERE qnumber=%d;" pszStatement = sqlite_mprintf(STATEMENT, qtext, qnumber); sqlite_exec_printf(..); can also be used similarly.. Thanks Craig :) I got it working finally. It does escape correctly if you use sqlite_step() but I had problems using sqlite.exe and .READ. I couldn't get parameters to work at all. I assume they're just not implemented in 2.x sqlite. Interesting.. I decided to take a little break from my project and look at shell.c (I currently use 2.8.13) to see what it does to process file input. Answer: Nothing much. :-) All it does is slurp input, concatenate it into one long string and then feed it to sqlite_exec(..). So it seems in theory the normal escaping mechanisms should work. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] sqlite2 api question - updates
Jay Sprenkle wrote: I'm trying to write a program using sqlite2.8. I've tried using the following sql from the command line tool and it does not escape the data correctly: update question set qtext = 'this shouldn''t fail' where qnumber=1; The escaped single quote is replaced by garbage. I've tried writing a c program but the api documentation is not clear. Should you build the sql this way: update question set qtext = ? where qnumber=1; Then set the column data parameter (pazValue) to point to the text to use for qtext? When I do this I get updates to NULL. If version 2 does not support parameters what's the correct way to escape the data? I don't know about parameters, but here is one way: char *pszStatement; #define STATEMENT "UPDATE question SET qtext = '%q' WHERE qnumber=%d;" pszStatement = sqlite_mprintf(STATEMENT, qtext, qnumber); sqlite_exec_printf(..); can also be used similarly.. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Sqllite As server
Vishal Kashyap wrote: Dear All, We have an existing Sqlite application which till now was fine running on single machine. Now we need flexibility of client server model. Is this possible with Sqlite ? . Or alternatively is it possible to use Sqlite db file from shared drives. Don't know if this is of any use.. http://www.it77.de/sqlite/sqlite.htm Look around the Wiki for SQLite, there's some good information there. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Compile SQLite
Merijn Vandenabeele wrote: I know where I can download the sources, but there's no makefile or visual studio project or anything like that included. What should I do with this bunch of headers and c-files to create a dll? Create a standard windows dll project, add all the *.c files to it create a file called sqlite.def (make sure you add it to the project), build it. sqlite.def should look something like: EXPORTS sqlite_function_call ... Where 'sqlite_function_call' is the name of the function you want to export, you'll need a line for each function you want access to in your DLL. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Compile SQLite
Merijn Vandenabeele wrote: Hi, I'd like to compile SQLite v3.3.2 using Visual Studio .NET 2003. I found a reference to a solution in the wike but I couldn't find a link to download the file. How should I compile SQLite from source? Best regards, Merijn Vandenabeele http://www.sqlite.org/sqlite-source-3_3_2.zip -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Re: Copy tables from one memory database to another with no disk access?
Igor Tandetnik wrote: did you try the really obvious way? create table db2.yourtable(...) insert into db2.yourtable select * from db1.yourtable For that to work, one first needs to attach one database to the other. ATTACH command requires a file name. Memory database does not have one. ':MEMORY:' ? -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://pse.2cah.com Controlling pseudoephedrine purchases. http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] Multi-threading.
D. Richard Hipp wrote: On Fri, 2005-07-15 at 16:41 +0530, Roushan Ali wrote: Hello all, Can we use single sqlite_open handle(global) across threads( if all database operations are serialized by using semaphore) ? Please help. Opening a database connection in one thread and using it in another will work on some operating systems but not on others. You are advised not to do it. See http://www.sqlite.org/cvstrac/tktview?tn=1272 and http://www.sqlite.org/cvstrac/chngview?cn=2521. Good sound advice, to a point. Multiple threads accessing the same connection *can* be done, its a design time issue that needs to be addressed before even a single line of code is written. I do it with my mail server using SQLite for logging purposes, I use mutex semaphores to handle the nitty gritty details. Its the usual issue of knowing what you are stepping into before you step, because some of what you step into stinks. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://www.mtsprofessional.com/ A Win32 email server that works for You.
Re: [sqlite] PHP5 && SQLite3
Keith Herold wrote: Out of curiosity, how hard would it be to build a translation layer? I suppose it's easier to keep both versions around, and upgrade when necessary, but as a technical problem, it's at least interesting? Only downwardly, of course, so there would be no expectation that 2.X could use 3.X, just the reverse. It had sounded as if only the file format was the problem; is it more than that? I'm not pushing, in any sense, just wondering if anyone has looked at this issue with an eye to resolving it. The PHP library IS the translation layer. The crux of the issue is that the formats are NOT compatible, nor are the API's. What Dr. Hipp suggested is the best possible course. Link with both API's which _DO_ have separate naming conventions making it possible to support both formats concurrently. All new databases follow Sqlite3, legacy follow Sqlite2. There are signatures in the database files to distinguish between the two. Use the tools that are available to add the layer of abstraction necessary. Don't force that on SQlite itself. Its all summed up in one sentence, which is the first one that appears at sqlite.org: "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine." The focus is there, anything beyond that is up to the implementation. -- Craig Morrison =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= http://www.mtsprofessional.com/ A Win32 email server that works for You.