[sqlite] Syntax for sql 'insert' for text with comma
Hi, I would like to insert into sometable values ( someid , text ) ; but 'text' contains a few commas, and then it would look like (...) values ( someid , text , text2 , text3 ) ; Is there a syntax to do that properly, maybe like C string constants ("text,\"text\",text\n")? Thanks, Maurício ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Are these new functions?
Thanks. There's a nice sqlite example in the homepage called "sqlite in 5 minutes or less". I think it would be nice to update it to follow the recomendations on the page you pointed me to. Best, M. > http://www.sqlite.org/releaselog/3_6_0.html > >> >> I'm having a linking problem and I suspect that the fault goes to the >> version of sqlite3 that comes with my distribution. It's 3.5.9. These >> functions seems to be missing: (...) ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Are these new functions?
Hi, I'm having a linking problem and I suspect that the fault goes to the version of sqlite3 that comes with my distribution. It's 3.5.9. These functions seems to be missing: sqlite3_initialize sqlite3_next_stmt sqlite3_os_end sqlite3_os_init sqlite3_shutdown I wasn't able to find the old version end check if those functions were already there. Does anyone knows if those are new functions? If someone use my source with a newer version (3.6.4), is there a risk of problems (since, for instance, she would not be able to call sqlite3_initialize)? Thanks, Maurício ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Checking column constraints
(I should have said "which tables has a database"... Sorry.) Suppose I've created a table with create table mytable (id unique, somethingelse) Is it possible somehow to check after reopening the database that mytable 'id' column was created with the 'unique' constraint? I want to use that to check if an existing database was properly initialized. Maurício > Hello Mauricio, > > i do not understand your question. Perhaps you will want to rephrase it. > The table "sqlite_master" can tell you how the tables were created. See > http://www.sqlite.org/sqlite.html or http://www.sqlite.org/faq.html, and > search for "sqlite_master". > > Martin > > Mauricio wrote: >> Hi, >> >> Is there any function or sql command that >> allows me to check which tables has a table >> and what are the constraints to those >> columns? >> >> Thanks, >> Maurício >> >> ___ >> 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] Checking column constraints
Hi, Is there any function or sql command that allows me to check which tables has a table and what are the constraints to those columns? Thanks, Maurício ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] unresolved external symbol
Hi list. I'm currently making modifications to a project, and want to add SQLite3 to it. I'm using VS6, have the sqlite3.h and sqlite3.c in the same directory, and this is the code: #include "sqlite3.h" bool TestSQLite() { sqlite3 *db; int rc; rc = sqlite3_open("test.sqlite",&db); return true; } but when I build, get the following error Configuration: mfc01 - Win32 Release Compiling... mfc01Dlg.cpp Linking... mfc01Dlg.obj : error LNK2001: unresolved external symbol _sqlite3_open However, if I just compile, everything goes ok. Any help? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] unresolved external symbol
Hi list. I'm currently making modifications to a project, and want to add SQLite3 to it. I'm using VS6, have the sqlite3.h and sqlite3.c in the same directory, and this is the code: #include "sqlite3.h" bool TestSQLite() { sqlite3 *db; int rc; rc = sqlite3_open("test.sqlite",&db); return true; } but when I build, get the following error Configuration: mfc01 - Win32 Release Compiling... mfc01Dlg.cpp Linking... mfc01Dlg.obj : error LNK2001: unresolved external symbol _sqlite3_open However, if I just compile, everything goes ok. Any help? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] How to save memory in Sqlite
Toms, I don't have a big RAM memory as well! :) It's a very limited device!! Thanks! Mauricio On Fri, Jun 27, 2008 at 11:09 AM, toms <[EMAIL PROTECTED]> wrote: > Hi > In order to avoid fragmentation, we use sql as a buffer: all I/O have > been rewritten to use a buffer instead a file writting. > The previous solution (which cause fragmentation then) was to load a DB > from file, creta a :memory: db, and then copy all data and structure > from file DB --> mem DB. > But once released, the file DB created the fragmentation. > I don' t know if there are other ideas, but at least this was ok for us :) > > Mauricio Aniche a écrit : > > Hey guys, > > > > I just ported Sqlite to my device. I want to know any feature I can turn > > on/off in order to save memory! I have only 2mb of disk space, so any > byte > > is important! :) > > > > Do you guys have any tip for me? > > > > Thanks in advance, > > Mauricio > > ___ > > 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] How to save memory in Sqlite
Hey guys, I just ported Sqlite to my device. I want to know any feature I can turn on/off in order to save memory! I have only 2mb of disk space, so any byte is important! :) Do you guys have any tip for me? Thanks in advance, Mauricio ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] using sqlite3 in php
You can use the PDO extension. http://php.net/pdo http://www.php.net/manual/en/ref.pdo-sqlite.php Maurício M. Maia www.semjanelas.net jack wu wrote: apparently sqlite3 is not available in php5. i am wondering if there is anyway to work around it. i have a c++ program which works with sqlite3, but i would also like my php script to use the same database. jack.
Re: [sqlite] Linux Newbie...
Claudio, you need to execute like: $ ./sqlite3-3.2.1.bin PS: If you want, send a private message to me, so I help you *in portuguese* :) Maurício. Claudio Bezerra Leopoldino wrote: Hi! I've used the windows command line SQLite utility without problems, but the linux version GZ file doesn't worked in mine tests. I extracted the file with gunzip, but the binary file doesn't worked. It can be a very basic problem to an esxperient linux user, but i couldn't execute the binary file. I got only "command not found". May someone tell me a clue to execute the SQLite utility in linux environment? Or a need to compile the source code to use the utility? Thanks, Cláudio == [EMAIL PROTECTED] SQLite]$ ls -l total 372 -rwxr-xr-x 1 bezerral Afp10-GP 374132 Mai 19 15:22 sqlite3-3.2.1.bin [EMAIL PROTECTED] SQLite]$ [EMAIL PROTECTED] SQLite]$ sqlite3-3.2.1.bin bash: sqlite3-3.2.1.bin: command not found [EMAIL PROTECTED] SQLite]$ [EMAIL PROTECTED] SQLite]$ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/
Re: [sqlite] Lock files....
Fred Williams wrote: I picked SQLite for its minuscule (by today's standards) footprint, simplicity, and ease of deployment. Why do I get the feeling I've bought into a product like any model in the American car market. With each passing interation the vehicle gets bigger, fatter, and less efficient. This continues until the model bears absolutely no resemblance to the original. But, it does have electric fold down rear seats to the advantage of the totally clueless. I don't think version 3 has compromised the core premise offered by SQLite, but I agree with your analogy as something to watch for in the future. For instance: the new locking scheme in version 3 is irrelevant to me, since SQLite is embedded in my application and I run it as a single thread. However, I can see that attempts to prevent locking when accessing the db file by multiple threads are something that benefit the core product feature set and are real issues when you write multithreaded code. On the other hand, when (if) changes are made in order to make multiple programs access a shared db file then I believe we begin to risk code bloat, as in these scenarios one should clearly use a client/server database scheme and there are several good ones already available and proven. There is no need to bloat SQLite to cover this usage scenarior imo. But of course the code is highly modular. I like the fact that you can ommit some features when compiling by editing sqlite.h (ommit_authorization, etc.) This is a very good design decision, as it allows developers to continue embedding without some of the optional features AND makes it possible to add these features in a very simple way, without a formal plugin mechanism or something like that. So if anything I would request that some of the optional features were always implemented as modules that could be selected at compile time (when possible of course), and everyone would be happy. Regards, Mauricio
Re: [sqlite] Script perl e python, I can't open database from sqlite
D. Richard Hipp wrote: Mauricio Piacentini wrote: I will update SQLiteBrowser to use version 3 when it leaves beta status The more people use SQLite version 3, the faster it will leave beta status Oh, ok. Good to know. I will then try to release a beta version asap, to help testing. Can you rig SQLiteBrowser so that it links against both 2.8 and 3.0 and uses whichever is appropriate for the database it is reading? I already have a version linked to both versions of the library. I was planning to make it able to convert from 2 -> 3, but operate in 3.x format only from now on. I will investigate what it takes to make it able to operate with both formats, however. Regards, Mauricio
Re: [sqlite] Script perl e python, I can't open database from sqlite
SQLite version 3.0.4 Enter ".help" for instructions qlite> .databases Error: file is encrypted or is not a database sqlite> .tables Error: file is encrypted or is not a database But if I open this database with sqlitebrowser I don't have errors. Why sqlite doesn't open it ??? This error is under linux and windows. Your Perl module and SqliteBrowser are both still using SQLite version 2.8.x, so they produce databases in the SQLite 2.1 format. You are trying to read these with SQLite version 3, that's the reason why it does not work. I will update SQLiteBrowser to use version 3 when it leaves beta status, probably after the next release. Regards, Mauricio
Re: [sqlite] Tcl interface updated to require TCL version 8.4
Mosley, Harlan R. wrote: I have been considering sqlite for my windows application, and I am an individual who has not the resources to upgrade, so I continue to use TclPro 1.4 (8.3.2) because of the tools in the TcLPro package. I would not be able to use the latest sqlite because of this, but probably could still consider 2.8.15. Just to let you know you don't necessarily need TCL to use the base SQLite code and packages, to the best of my knowledge. I at least do not have it installed on Windows (but I compile the sources embedded into my project.) Just remove the tclsqlite.c source file from your build. Of course you will not be able to run the TCL tests, but you can definately run your SQLite-enabled program without having TCL installed. Regards, Mauricio
Re: [sqlite] Database locked
> I am trying to import a csv file (ip-to-country to be especific) to a > table > on sqlite db...It has 5+ lines. Tried to use php and it takes like If you are using SQLite 2.8.x you can try importing the file with SQLite Database Browser (sqlitebrowser.sourceforge.net). Use the FILE->IMPORT->CVS TO TABLE menu item. Give it a few minutes to insert all data, it should work. Regards, Mauricio Tabuleiro
Re: [sqlite] Cloudscape?
It's written in Java, so I'd guess it won't be easily embeddable in things not written in Java. So I'd guess there's not that much overlap: if you're writing in Java and want an embeddable database, then cloudscape is going to be useful new option; otherwise sqlite will be one of the databases to consider. Just want to point out that there is already HSQLDB for java-embedding, it is a very successful project, easy to use and very reliable. Available at sourceforge. SQLite is of course not really affected by these tools as it runs as native code. HSQLDB is however surprisingly effective and easy to use if you are looking for an SQLite equivalent for Java programs (around 100Kb for embedded classes) Regards, Mauricio Tabuleiro
Re: [sqlite] Dealing with 2 versions of SQLite
Darren Duncan wrote: > That doesn't sound right. sqlite3_open() *should* return an error when you try opening a 2.x database, citing that the file is not a SQLite (v3) database file. > > Incidentally, I would expect that the simple solution is to do this: When given a file name to open, first try to open it with the v3 binary; if that returns an error citing 'not a SQLite database', then try opening it with the v2 binary; if neither fails to work, then the file isn't v3 or v2. Otherwise, based on which open() worked, your program logic now knows which binary/functions to use for further interactions with the file. That's a good strategy, but with the current build you will only get the error after performing your first SQL operation on the db, not immediately after opening it. Just to be absolutely sure I just retested with the official sqlite3 binary posted a couple of minutes ago (3.03), using a database in the old format. Some operations do not trigger an error, probably because they only setup internal states and do not actually touch the data. I found for example that: pragma show_datatypes = ON; does not trigger any errors, and this is what I had in my code immediately after opening. However, pragma synchronous = ON; does trigger the error, as well as any attempt to get data from the db (or the schema). So the strategy I have now is: a) use sqlite3_open b) trigger "pragma synchronous = ON;" c) collect an error message, if it is 26 then d) use sqlite_open (old format) e) trigger "pragma synchronous = ON;" again f) watch for any error messages here. g) if it opens without errors, maybe offer the user the option to convert to sqlite3 format. This will probably be a common scenario for several programs, so maybe detecting a database in the old format and returning the appropriate error directly in sqlite3_open could save some time. Regards, Mauricio
Re: [sqlite] Dealing with 2 versions of SQLite
D. Richard Hipp wrote: SQLite 2.8 and SQLite 3.0 can peacefully coexist. They can even be linked together into the same binary. I have just done this for inclusion in the next version of the SQLite DB Browser, and it works great. The only problem is how to identify the file format when I open a new file, is there a way? When I open a SQLite 2.8.x db with sqlite3_open() I do not get any errors. I can even call sqlite3_exec() on it with some pragma commands, no errors returned. However when I attempt to retrieve more info (the table structure) I get error code 26, the error message explains that the db is encrypted or malformed. Is there a way to detect that I am opening a 2.8.x db? I guess I could read the signature from file, but I was hoping maybe for an error message in sqlite3_open. Not really critical but would be nice to have, and in this way we could offer to convert automatically to the new format (by doing a dump to a temp file followed by an import to a new db). Regards, Mauricio
Re: [sqlite] Changing of Column Type
Tito Ciuro wrote: Erwin, Please refer to: http://www.sqlite.org/faq.html#q13 If you are using SQLite 2.8.x then a similar solution is used by the modify table wizard in SQLite Database Browser if you prefer a GUI way to do this alteration. Make a backup of your db data first, of course. Regards, Mauricio
[sqlite] ANN: SQLite Database Browser 1.1
SQLite Database Browser is a freeware, public domain, open source visual tool used to create, design and edit database files compatible with SQLite 2.x. It is hosted at sourceforge, and the home page for the project lives at http://sqlitebrowser.sourceforge.net/ Source is available of course, as well as pre-compiled binaries for Linux, Windows and Mac OSX. The following features were added in the 1.1 update: - SQL query window: enter SQL commands and see the output and error codes directly in a browser view. - SQL log: lists all SQL commands issued by the browser application and/or by the user. Useful as a tool to analyze and learn SQL. - Abitility to open database files specified with a command line parameter (sqlitebrowser mydb) and/or drag and drop. - Added experimental modify table wizard, since SQLite does not support the ALTER TABLE SQL command. Use it with care. Works correctly for all tables originally created in SQLiteBrowser. - The browser uses a transaction in the background to undo changes made to a database before they are commited to disk. All changes are now temporary until the user decides to SAVE the file. - Added CSV import/export capabilities: a wizard makes it possible to configure table importing from a CSV file (delimiters, etc.) Supports most CSV format variations, including files generated by MS Excel and Access. - Added SQL dump import/export capabities. Useful to store an SQL format backup of your database, or to interchange data with MySQL or Oracle, for example. - Added text import/export capabilities directly to from a text file to db records. - Modified record browsing interface. The spreadsheet interface now redraws faster (and clips longer records accordingly) Double click a cell to edit the record on a separate window. This allows better support for longer records including line breaks, for example. and many other small enhancements and bug fixes. Enjoy. Regards, Mauricio Piacentini Tabuleiro
Re: [sqlite] SQLite Browser (Mac OS 10.3)
Yes... in OS X, everything that happens is written on in an app called Console. I write the author a while back too and he asked that I attempt to launch it again with Console running and then send him whatever errors/messages appear, but... strangely... I am still getting nothing in the Console... as I did then. I answered to the original request at Sourceforge forums, so we can take it from there. Just wanted to point out that the MacOSX Console is not the same as the Terminal window, this is a common confusion for users coming from Unix/Linux. I answered this at the sqlitebrowser foruns, and there is a new binary for OSX 10.3 available as well (compiled with the latest Qt.) It works ok in the machines I tested, but then again the old one also worked. This new build however has some Qt fixes and official support for Panther, so you could try it and report if the problem continues. I don't know why it does not work on your machine, and you gave me no new information that we can use to find the source of the problem. The only possible clue for this come from the Console, really. Try monitoring the system.log. Another generic way to cause this problem in all OSX bundles is if for some reason the name of the executable inside the bundle does not match the one specified in the plist, for example because of an error in the decompression, or if you rename the executable. It would also be better to move the discussion to the sqlitebrowser foruns. We would be able to benefit other users of the tool if we can find out why it does not work on your particular setup, and the problem is not related to the main SQLite library, and of little interest to other users of this list. Thanks! Regards, Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [sqlite] SQLite Browser (Mac OS 10.3)
Yes... in OS X, everything that happens is written on in an app called Console. I write the author a while back too and he asked that I attempt to launch it again with Console running and then send him whatever errors/messages appear, but... strangely... I am still getting nothing in the Console... as I did then. I answered to the original request at Sourceforge forums, so we can take it from there. Just wanted to point out that the MacOSX Console is not the same as the Terminal window, this is a common confusion for users coming from Unix/Linux. The Console is a separate application that logs system level errors that would prevent an app from launching, like the lack of shared libraries, etc. Make sure you are really checking Console.app and not the terminal window. As someone wrote already, shared libraries are definately a weak spot under OSX. Some consider their implementation simply broke. I would not go as far, but there are certainly something not right about them specially if you are launching from the Finder. I believe the standard SQLite distribution does not compile as a shared library under OSX exactly because of this problems, can anyone confirm this? Regards, Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [sqlite] SQLite Browser (Mac OS 10.3)
[EMAIL PROTECTED] wrote: ...on Mac OS 10.3? What error you get? None. That's what's strange about it. It won't even launch. It starts in the dock but dies one second (literally) later. I can run it on MacOSX 10.3.2. However the version of Qt used to compile the binaries does not support Panther officially, so the widgets do not look correct, specially buttons. There might be other subtle issues with Panther. I will try to find time to compile a newer version against the latest Qt, but please post a request directly to the sourceforge foruns if you have not done so. If you are not using the binaries and have compiled from source you probably do not have Qt setup correctly for static compilation, or your environment is not setup correctly to use Qt shared libraries from the Finder. Since this list is dedicated to SQLite I would recommend checking the Qt forums, or posting to the sqlitebrowser message boards. Regards, Mauricio Piacentini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[sqlite] Re: performance on Mac OS 9
I don't see the same issue here under OS9. Performance is roughly the same as under OSX in my tests under OS9 or Classic. I have however compiled both the Carbon and Classic versions using CodeWarrior, but in theory it should not make a difference (not sure how you have created your OS9 library.) I am not using SQLite standalone as well, but as part of another program, embedded. Just tried a SELECT with LIKE on a 40MB database, and it completed OK in roughly 1 sec, looks like the same time as the OSX build. Maybe you are running out of real memory under OS9? The system may be using VM on disk, which can be very slow under OS8 and 9. Try to increase the initial memory allocation for your SQLite binary or program, or disable VM, and see if it makes a difference. Regards, Mauricio Piacentini Tabuleiro - Original Message - Subject: performance on Mac OS 9 -- I've been working on a Mac OS X version of SQLite and things are very quick. But now I'm trying similar code on OS 9 I can hear the disk churning away and a query that takes 1-2 seconds on OS X takes 50 seconds on OS 9. ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]