Re[2]: [sqlite] I'm Starving for New User Information
Hello C.Peachment, Yeah, I wasn't going to answer. Clearly this person hasn't even read the website which is where all the documentation resides. C Sunday, May 6, 2007, 10:38:59 PM, you wrote: CP> You ask too many questions in one go. I will be surprised if anyone CP> is willing to provide that much assistance all at once. CP> It appears that you need some more fundamental knowledge about CP> programming on GNU/Linux and maybe even about programming in C. CP> Some of your questions are contradictory and suggest you have not CP> done your own homework before asking others to do it for you. CP> e.g. CP> got a ".so" file. This is obviously a shared library ... CP> and CP> Is a C program that uses sqlite statically linked? CP> You ask: >>Once I've created a C program that uses sqlite can I administer its database >>with sqlite3 or do I have to write utility programs to create a database, >>tables, view table contents, etc? CP> Why not try it and see for yourself? CP> Others have done so and not all of them are smarter than you :-) CP> - CP> To unsubscribe, send email to [EMAIL PROTECTED] CP> - -- Best regards, Tegmailto:[EMAIL PROTECTED] - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] how to add a new column quickly
How about this? update tablename set newcolname=(case rowid when 1 then 1 else 2 end); best regards, Radzi - Original Message - From: "Tomash Brechko" <[EMAIL PROTECTED]> To: Sent: Saturday, May 05, 2007 8:09 PM Subject: Re: [sqlite] how to add a new column quickly On Sat, May 05, 2007 at 19:30:59 +0800, ronggui wong wrote: Thanks. But there is no typo, what I want is a general solution. 2007/5/5, Tomash Brechko <[EMAIL PROTECTED]>: >On Sat, May 05, 2007 at 14:01:56 +0800, ronggui wong wrote: >> . update tablename set newcolname=1 where ROWID=1 >> . update tablename set newcolname=2 where ROWID=2 >> . update tablename set newcolname=2 where ROWID=3 If there is no correlation between newcolname and other columns that can be expressed as a formula, but rather you want to set newcolname to some known Func(ROWID), you may register this function with sqlite3_create_function() (or its equivalent for your language bindings), and then do a single statement UPDATE tablename SET newcolname = Func(ROWID); This will be faster then repeatedly searching for a row with a given ROWID. -- Tomash Brechko - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] I'm Starving for New User Information
You ask too many questions in one go. I will be surprised if anyone is willing to provide that much assistance all at once. It appears that you need some more fundamental knowledge about programming on GNU/Linux and maybe even about programming in C. Some of your questions are contradictory and suggest you have not done your own homework before asking others to do it for you. e.g. got a ".so" file. This is obviously a shared library ... and Is a C program that uses sqlite statically linked? You ask: >Once I've created a C program that uses sqlite can I administer its database >with sqlite3 or do I have to write utility programs to create a database, >tables, view table contents, etc? Why not try it and see for yourself? Others have done so and not all of them are smarter than you :-) - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] I'm Starving for New User Information
Is there a sqlite introduction for programmers wanting to use the sqlite C API? The info on the web site is pretty sparse. There seems to be plenty of info regarding the use of sqlite3 all over the web. But not much on getting set up to write programs that use sqlite. I have some specific questions below. I am a C programmer and I want use sqlite in my programs. First question is about installation. I went to the sqlite download page and got a ".so" file. This is obviously a shared library but I can't find any installation document that confirms this. What do I do with the ".so" file? I guess I need to put it somewhere, but where? I'm using Fedora Core4 at the moment but what if I also want to use sqlite on RedHat 4? I'd eventually like to use sqlite on HPUX 11.0 but I'll be happy for the moment to get myself oriented on Linux. Are there any link instructions? How do I link a C program on Fedora Core4 Linux for example? "gcc myprog.c -o myprog sqlite.so"? Do I need to set a library path environment variable to point to where the ".so" file is located? Or what? Is a C program that uses sqlite statically linked? That is, is the final executable a self contained program that can be moved from one computer to similar computer? Or does it require supporting sqlite files/libraries to be installed on each computer where the program is run? Can I just copy a program that uses the C API to a similar computer and run it? I assume I would at least have to copy some sqlite data file as well. No? Once I've created a C program that uses sqlite can I administer its database with sqlite3 or do I have to write utility programs to create a database, tables, view table contents, etc? I'd really like to understand how sqlite works. Not internally, but things like where is the data stored? What does it mean to "install" sqlite? If I run a C program in separate directories where does the data get stored? In a common file somewhere? Or does each program have its own sqlite data file? On the sqlite web site there's a brief 5 minute getting started explanation. It explains how to get going using sqlite3. But where do I go after that for more detailed understanding? How do you backup sqlite data? Just copy a data file? Or do you use sqlite3 to dump a file of sql statements? The architecture is unclear to me. I'm hungry to learn more. Is there a summary document somewhere? I'm finding plenty of tutorials on how to use sqlite3, the command line interface. But is there anything that explains the basic architecture? Installation? administration? The sqlite C API documentation seems pretty clear. I can even find helpful documents on the web. I just can't find anything describing how to install and administer sqlite or basically how it works. thanks -- View this message in context: http://www.nabble.com/I%27m-Starving-for-New-User-Information-tf3701471.html#a10350938 Sent from the SQLite mailing list archive at Nabble.com. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Conditional table select
Dan Kennedy wrote: On Fri, 2007-05-04 at 18:22 -0400, Vitali Lovich wrote: Multiple tables contain a primary key KEY. If Table1 contains a matching KEY, then I want that row from Table1. Only if it isn't in Table1, then look in Table2 if it is there. If not in Table2 go on to Table3, etc etc. How about this: SELECT * FROM tbl1 WHERE key = $key UNION ALL SELECT * FROM tbl2 WHERE key = $key LIMIT 1; Although technically, using LIMIT without ORDER BY is a bad thing. The solution I came up with is: SELECT coalesce( (SELECT field1 FROM tbl1 WHERE key = $key), (SELECT field1 FROM tbl2 WHERE key = $key), (SELECT field1 FROM tbl3 WHERE key = $key)) , field2 FROM tbl1 WHERE key = $key; The only problem with this though is that I can only select that 1 field - if I want another, I have to do more select statements. However, if coalesce works the way I think it does, then it'll do early evaluation and stop at the first non null parameter. Also, I'm hoping that SQLite realizes that it can retrieve field2 on its first evaluation of select. Even if it can't though, I'm only expecting tbl1 to have at most maybe 10 entries. Thoughts, suggestions? Thanks - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Ticket #2339
Will the anonymous user who contributed the remark to ticket #2339 on 2007-May-06 18:03:48 that contains a 6-line patch for fixing the ticket, please identify yourself to me. Tnx. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: How to obtain the integer part of a result
A.J.Millan <[EMAIL PROTECTED]> wrote: I would like to know if there are a way to obtain a result without decimals (the integer part) in this query: CAST(expr AS INTEGER) Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] How to obtain the integer part of a result
See the "floor" function (largest integer value not greater than argument) in http://sqlite.org/contrib/download/extension-functions.tgz?get=17 On 5/6/07, A.J.Millan <[EMAIL PROTECTED]> wrote: Hi all: I would like to know if there are a way to obtain a result without decimals (the integer part) in this query: SELECT round(julianday('now')-Dat) FROM SomeTable WHERE ...; Obviously Dat contain a Julian Date (nnn.nnn) and I want the difference in days from today. None the above, neither SELECT round(julianday('now')-Dat, 0) FROM SomeTable WHERE ...; Produces the desired result. I always get xxx.0 (1 decimal). A.J.Millan ZATOR Systems - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] How to obtain the integer part of a result
Hi all: I would like to know if there are a way to obtain a result without decimals (the integer part) in this query: SELECT round(julianday('now')-Dat) FROM SomeTable WHERE ...; Obviously Dat contain a Julian Date (nnn.nnn) and I want the difference in days from today. None the above, neither SELECT round(julianday('now')-Dat, 0) FROM SomeTable WHERE ...; Produces the desired result. I always get xxx.0 (1 decimal). A.J.Millan ZATOR Systems - To unsubscribe, send email to [EMAIL PROTECTED] -