Re: [sqlite] Importing file from C-code
Quoting Alberto Daniotti albertodanio...@libero.it: Good Morning. I have a question. I want integrate sqlite in a c-program. I want to know if is possible import a table from a external text file without using INSERT (it's too slow) and if it's how i must do. How often would you need to do that? If it's a one-time initialization of your database, I can't imagine why using INSERT is too slow. If it really is, all you can do is to ship an existing database with the table already loaded (a SQLite database is just one file). If that is not possible, you may have to rewrite your code to avoid implicit transactions around each INSERT statement, see http://www.sqlite.org/faq.html#q19 regards, Markus -- Markus Hoenicka markus.hoeni...@cats.de (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Impossible to declare field type BIGINT PRIMARY KEY
Quoting D. Richard Hipp d...@hwaci.com: It might be possible to get BIGINT PRIMARY KEY AUTOINCREMENT to work like INTEGER PRIMARY KEY AUTOINCREMENT. Or perhaps it is not. That is unclear. Certainly it would be a rather substantial change - much, much larger than the little patch supplied on the ticket. My doubts about whether or not it will work derive from the fact that a BIGINT column can store strings and blobs in addition to integers. How do you AUTOINCREMENT a blob? I'd like to jump in here as one of the authors of libdbi and its sqlite driver. I've followed this discussion with some amusement as it perfectly reflects the pain when attempting to fit SQLite into a database abstraction layer :-) I doubt that allowing BIGINT to auto-increment is the proper solution of the underlying problem. I'd like to focus your attention again on the example of the OP: sqlite CREATE TABLE test(id INTEGER PRIMARY KEY, int INTEGER, bigint BIGINT); sqlite PRAGMA table_info(test); 0|id|INTEGER|0||1 1|int|INTEGER|0||0 2|bigint|BIGINT|0||0 We've heard in this discussion repeatedly that all integers are created equal (as far as SQLite is concerned), and that applications using SQLite should keep track of the data types themselves if size matters. However, as Richard points out, INTEGER PRIMARY KEY is different from INTEGER and from anything else. All I need as an application (or abstraction layer FWIW) author therefore is that SQLite tells me that that particular column is different. However, the example above shows that SQLite hides the fact that the INTEGER PRIMARY KEY column is internally handled differently as it disguises it as an INTEGER. If there's a way to find out at runtime that a column has been defined as INTEGER PRIMARY KEY instead of as INTEGER, all is well and I'll be able to fix the sqlite driver accordingly. regards, Markus -- Markus Hoenicka markus.hoeni...@cats.de (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Impossible to declare field type BIGINT PRIMARY KEY
Quoting Igor Tandetnik itandet...@mvps.org: Well, you get that 1 in the last column, indicating the column is in fact part of a primary key. So, if it's INTEGER, and it's the only column marked PRIMARY KEY, then it's the special one. Your reply seems to imply that I might end up having several INTEGER columns with the pk column set to 1. Does that mean that I cannot unambiguously identify that one autoincrementing column? regards, Markus -- Markus Hoenicka markus.hoeni...@cats.de (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] FreeBSD port installation error in bsd.port.mk
Hi, this is most likely not an SQLite problem, but either a problem of the SQLite3 port, or a glitch in the port system itself. To get better advice, I'd recommend to contact the port maintainer and the freebsd-users mailing list. regards, Markus Quoting Adrian [EMAIL PROTECTED]: Hello, I'm having trouble installing the SQLite3 port on FreeBSD, and I wanted to see if my issue is one that is generally known or if it is something particular on my end. If I go into the ports/databases/sqlite3 directory and try make, I get the following error: /usr/ports/Mk/bsd.port.mk, line 3240: Need an operator The offending line, according to the line number, is that with the WRKSRC in this block of code: $$//' .else .for f in ${USE_DOS2UNIX} @${ECHO_MSG} === Converting DOS text file to UNIX text file: ${f} @${REINPLACE_CMD} -i '' -e 's/ $$//' ${WRKSRC}/${f} .endfor .endif I apologize if this has nothing to do with SQLite3, since the error is in a file external to the port, but I wanted to see if it looked familiar to anyone as I haven't been able to find anything about it on my own. Please let me know if there is any further information that I can provide that might help diagnose the issue. Thanks in advance, Adrian ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] empty result sets without column names?
Quoting Igor Tandetnik [EMAIL PROTECTED]: Don't use sqlite3_get_table. Use sqlite3_column_name, sqlite3_column_origin_name et al. You can call these on a prepared statement without even having to run it, so it doesn't matter whether it returns any rows or not. If all you want is to get column names of one table, see also PRAGMA table_info. Thanks for your reply. I'm aware that PRAGMA table_info will allow us to read the column names of a particular table. However, we are trying to make column names and numbers of arbitrary queries available across all database drivers, regardless of whether the query in question returns zero or more datasets. Our sqlite3 driver currently uses sqlite3_get_table() to read the results of queries, obviously because it is convenient. I understand from your reply that we'd have to switch to the low-level interface using prepared statements in order to be able to use sqlite3_column_name() et al. I'm just wondering whether it makes more sense to make sqlite3_get_table() consistent and have it return the number of colums and their names irrespective of the number of returned rows. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] empty result sets without column names?
Quoting Nuno Lucas [EMAIL PROTECTED]: You probably want to look at the empty_result_callbacks PRAGMA. Although the manual only mention sqlite3_exec, it's also used by sqlite3_get_table(). This looks like what we need. I assume that sqlite3_get_table() returns the correct number of columns instead of 0 in our case if this PRAGMA is toggled on. Note that you will need to change your code to handle the extra row with the column names. This code is already in place as we use this extra row in those queries which do return at least one row of data. Any way, you will be better off using prepared statements. sqlite3_get_table is maintained for compatibility with really old code (there isn't a Unicode equivalent, for example). The preferred interface is using the sqlite3_prepare_v2() and related API. sqlite3_get_table() is just a wrapper around the modern interface. I wouldn't mind using prepared statements. However, libdbi keeps the results of queries ready for accessor functions which later read single rows of data. That is, to create a libdbi result set, we have to loop over all returned rows anyway and create an array of strings. Doing this ourselves in the driver would simply duplicate sqlite3_get_table() in a probably less tested fashion. How did other users switch from the old to the new interface? Does everyone build a string array from the callbacks himself these days, or did I miss some simple and obvious way to switch? regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Date arithmetic question
[EMAIL PROTECTED] writes: So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00') should return 1 even though the difference is really only 1 second? Seems goofy to me well, this is one second rounded up to the next full month...If that is the kind of information you want to compute, it's probably not that goofy after all. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] syntax error
Quoting nishit sharma [EMAIL PROTECTED]: Hi All, Sending y peoples same query with some explanation. i have a database name myds.db which is having one column as index (integer default 0) which has no values in complete database. when i used to access somthing with reference to index in command than i get the error SQL error: near index: syntax error http://sqlite.org/lang_keywords.html index is a reserved word. Just use a different column name which is not in the above list. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] sqlite db portability
Quoting Uma Krishnan [EMAIL PROTECTED]: Hello Markus, How is libdbi different from, say odbc? I've never used ODBC, but from what I read I'd say the main differences are the footprint and the scope. libdbi is language-specific (C), lightweight, and allows you to do simple things in a simple fashion. However, you're still required to handle database engine specific stuff in your code to use more advanced SQL features. ODBC seems to encapsulate all and everything, at the price of being huge. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] sqlite db portability
Shilpa Sheoran writes: Can the sqlite db file be accessed using another DB api's eg. MySQL or anyother. Not directly, but you can use a database abstraction layer like libdbi (http://libdbi.sourceforge.net) for C or the DBI/DBD stuff for Perl. Your program uses the abstraction layer's API instead of the database-specific API. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Unique ids for each record
Quoting Eric Bohlman [EMAIL PROTECTED]: (you're not going to have the *same* artist release two albums with the same name). You need track names to be unique within artists, but not Except for weird artists like Peter Gabriel. All solo albums released between 1977 and 1982 were self-titled and thus carry the same title. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Unique ids for each record
I assume you'd rather want three separate tables (artist, album, track) with an autoincrementing ID field per table. Your approach would not allow users to own more than 100 albums. regards, Markus Quoting Sreedhar.a [EMAIL PROTECTED]: Hi, I have a table with 3 columns. Artist Album and tracks. Can i fix a range of ids for each column like 1-100 for Artist 101-200 for Album and 201-300 for tracks So that I can have a unique number(id) for each record. Will there be a problem while deleting and inserting the records? Thanks and best regards, A.Sreedhar. -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] My HPUX Notes
Quoting km4hr [EMAIL PROTECTED]: I just happened to notice that I may not be executing the sqlite installation process (configure/make/make install) in a full bash environment. My usual environment is ksh. Typing in the command /bin/OpenSource/bin/bash I get a bash prompt. But apparently that doesn't put me in a full bash environment. I just noticed that unless I specify the full path to the GNU make command (/opt/OpenSource/bin/make) then the ksh version (/usr/bin/make) is executed. I wonder what I have to do to get into a true bash environment? Must be some environment viable that has to be changed. Oh well, one mystery begets another! There is no such thing as a full bash environment. bash is just another shell, just like ksh. You may experience some differences because the shells may read different startup files, so e.g. environment variables may be set differently. Some systems like FreeBSD call the GNU make binary gmake to distinguish it from the system's own make binary. You could put a symlink called gmake into /usr/bin (or /usr/local/bin, depending on your local policy) which points to /opt/OpenSource/bin/make. You can then run GNU make by using gmake instead of make in the build process from any shell you prefer. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Search engines and the Sqlite.Org website
Just out of curiosity, enter attach_get into google. The #1 hit is from SQLite: www.sqlite.org/cvstrac/attach_get/293/fx2lite.prg Go figure. regards, Markus Quoting [EMAIL PROTECTED]: I was looking into the server logs and I discovered a curious difference between MSN and Google. Over the past 7 days, the MSN bot has visited www.sqlite.org 114550 times. The Google bot, on the other hand, has only visited 4070 times. In spite of this, when I type Embedded SQL database into Google, www.sqlite.org is the #1 hit. But www.sqlite.org appears nowhere on the first 2 pages of results from MSN. Of the 114550 visits that the MSN bot made to www.sqlite.org, 42320 were to a single URL: http://www.sqlite.org/cvstrac/captcha You would think that after a few hundred visits, the bot would figure out what this page contains and move on Another 59115 hits from the MSN bot contain the name luggle.com in the URL. No such page exists on the SQLite website, so I am puzzled about why MSN finds this such an attractive place to visit. Does anybody know what luggle.com is? Here is a typical luggle.com URL: http://www.sqlite.org/cvstrac/wiki/luggle.com/attach_get/241/wiki In this URL, everything from the luggle.com onward is bogus. So the wiki server ignores it all and serves up the wiki home page. So MSN has apparently indexed the SQLite wiki homepage some 59115 times over the past 7 days. Any ideas why? Where is MSN getting this luggle.com stuff? I consider the behavior of the MSN bot to be abusive. I'm sorely tempted to ban the MSN bot from the entire sqlite.org website. If SQLite ceased to be indexed by MSN, would that seriously inconvenience any users? -- D. Richard Hipp [EMAIL PROTECTED] - To unsubscribe, send email to [EMAIL PROTECTED] - -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] database is locked
anis chaaba [EMAIL PROTECTED] was heard to say: I have multiple thread reading the database and a thread inserting in or updating the database. when i try to simulate this case by executing sqlite3 from shell by beginning a transaction from a shell and retrieving data from other shell eveything works fine. But when it's the cas from my C program it raises the error message database is locked. How can i avoid this issue? thanks a lot Do your threads share the same connection? If yes, using separate connections might help. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Abuse of the SQLite website
[EMAIL PROTECTED] was heard to say: Thoughts anyone? Are there less drastic measures that might be taken to prevent this kind of abuse? Frankly, I can't imagine someone sitting in China in front of a Win98 box and hitting the download button 25044 times. I guess this is scripted, and they will change the identifier as soon as they notice they're being blocked. I'm afraid this is not going to work. What about the spamblockers used by blogs and guestbooks, where you have to read letters or numbers from a jpeg image before proceeding. I know this is going to create an accessibility issue, but it seems to work fairly well. just my 2c, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] C++ SQLite
sebcity [EMAIL PROTECTED] was heard to say: Time constraints Good point. I've got time constraints too. Could everyone else please start to solve all my problems right now too please? Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Retrieving date
UCT vs. local time, perchance? Markus Lloyd [EMAIL PROTECTED] was heard to say: Hi, I stored a unix epoch (32 bit integer) date in the sqlite data base. I want to retrieve it in the readable date format. For that I use the following query select datetime(sdate,'unixepoch') from mytab; It shows a formatted date, but there is some changes in the hours. How can I retrieve the accurately converted date and time ? Thanks, Lloyd. __ Scanned and protected by Email scanner - To unsubscribe, send email to [EMAIL PROTECTED] - -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] problem in deleting
Narendran [EMAIL PROTECTED] was heard to say: i am deleting ,it does delete. but i am trying to delete again, no error code is returned, See http://www.sqlite.org/lang_delete.html: If a WHERE clause is supplied, then only those rows that match the expression are removed. If no rows match the where clause, no rows will be deleted. This is not an error but the expected behaviour. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQLite under linux
Lloyd [EMAIL PROTECTED] was heard to say: Unfortunately, I don't know how to install this library in my system. Please help me.. If I am dealing with the wrong file, please let me know from where I can get the needed installable library. Maybe you should tell us which system you run. Most Linux distributions offer SQLite as an easy-to-install package. E.g. on Debian you'd do something like: apt-get install libsqlite3-dev libsqlite3-0 sqlite3 Once that is installed, you'll just have to insert the sqlite header file into your sources and add -lsqlite3 to your gcc command line in order to build an app that uses SQLite. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] SQLite under linux
Martin Jenkins [EMAIL PROTECTED] was heard to say: 3. make distclean doesn't remove the installed files from usr/local I believe it is not supposed to. make distclean should remove any files from your build directory that either configure or make created. This usually returns your build directory to the state right after unpacking the sources from the tarball. make uninstall should remove installed files though. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] German umlauts (äöüß) are not displayed in sqlite - solution
What you see is not necessarily what sqlite returns. It depends on your shell whether the UTF-8 output of sqlite (or of any other app) is displayed correctly or displayed at all. To check whether the output (as opposed to the screen display) is correct, you can either pass the output to less (it will display Umlauts as something like C3B6) or redirect it into a file which you can inspect with an UTF-8 capable editor like Emacs. regards, Markus Wolfgang Qual [EMAIL PROTECTED] was heard to say: Hi list, I have a problem with german umlaut-characters (ä,ö,ü,ß) in sqlite - they are not displayed both in sqlite-command line and in sqlitebrowser. Background: I use sqlite3 as a database for the open source GIS GRASS: inside GRASS, I imported a dbf-table into the sqlite-database. Is there a way to tell sqlite/sqlitebrowser that I have data containing german umlaut characters? -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] German umlauts (äöüß) are not displayed in sqlite - solution
I don't know about sqlitebrowser. For the sqlite command line tool to display Umlauts properly, you need to tell your terminal that the data are UTF-8 encoded. On Unix-like systems it should be sufficient to start xterm with the -en UTF-8 option. Other terminal emulators like rxvt may have similar options. See the man pages for further information. regards, Markus Wolfgang Qual writes: Hi Markus, thanks for this hint. Using an editor, I saw that the Umlauts are there. But is there a way to make the Umlauts visible also on the sqlite-commandline/sqlitebrowser (for select-statements necessary)? -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Database on usbstick
eWobbuh [EMAIL PROTECTED]: Do you have any idea how many write/read actions a flashcard can take a minute before exploding ;)?? -- Visit your favourite electronics store, buy a representative sample of each make and model (say 10 each), write a short program that logs the write/read cycles until the stick fails, and prepare a complete statistical evaluation including mean, median, standard error and whatever. Let the list know what you find. As many others said before: If you want to know, just go ahead and try. Why should someone else try this for you? regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Database on usbstick
I have to admit that I'm a bit pissed of by your refusal to try out even the tiniest bit of what you want to know. I assume your bit-wise questions mean that you want to know one thing: is my database app fast enough using SQLite off a thumbdrive? Just estimates: 2min: download SQLite 3min: compile and install SQLite 10min: hack a Perl script that fills a database with random data 1 times 10min: hack another Perl script that reads the data 1 times 10min: run your tests using time or a good ol' stopwatch That is, within thirty-odd minutes you'd know more about this particular issue than the rest of the list together. Instead, you try to make others think about your problem for half a day. regards, Markus Zitat von eWobbuh [EMAIL PROTECTED]: If you'll give me money i'll try that. Im not asking to try it for me, just wondering if anyone knows approx. -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] need to form an frame work for database independent API
Vivien Malerba [EMAIL PROTECTED] was heard to say: I'm working on libgda and libgnomedb which are abstraction libraries for SQlite, postgreSQL, MySQL, Oracle, ... There is a BDB adaptator but it needs some work. Please wisit http://www.gnome-db.org (the website is very outdated but development is still going on), or download the latest versions from CVS. FWIW there is also libdbi (http://libdbi.sourceforge.net), a database abstraction layer written in C. There are several database drivers available (see http://libdbi-drivers.sourceforge.net), including SQLite, SQLite3, MySQL, PostgreSQL, Firebird, Ingres, Sybase, MS SQL, mSQL, as well as work in progress for Ingres and Oracle. I strongly support Vivien's suggestion to extend existing abstraction layers instead of developing yet another one. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Purging the mailing list roles. Was: Please Restore Your Account Access
Clay Dowling [EMAIL PROTECTED] was heard to say: You might want to consider reworking the check mechanism, using the capture mechanism that a lot of web forums and blogs use. Users must type in text presented on a web page in the form of a graphic. That will put a stop to the automated signup pretty quickly. ...and it will exclude the visually impaired just as quickly. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] Creating a (really) big table
James Biggs [EMAIL PROTECTED] was heard to say: Hi. My problem is that i want to create a table which should have around 1000 columns. Obviously, to add them manually would take a lot of time. Is there a way to make this automatically? Any program or a command? I have looked around but not much luck. Thanks for looking What about writing a small Perl|Ruby|Python script to generate a SQL command that you feed to sqlite? regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] Creating a (really) big table
James Biggs [EMAIL PROTECTED] was heard to say: I can do for example $dbh-do( CREATE TABLE my_table (etc etc etc)); but i don't know a Perl command for creating a table with many columns. I did not find one in the docs either. Thanks Something along these lines (untested!!) should work: my $command = CREATE TABLE my_table (; foreach my $counter (1..999) { $columns .= INT column . $counter . , ; } $command .= INT column1000); print $command; You may need to name your columns more intelligently. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] Creating a (really) big table
Markus Hoenicka [EMAIL PROTECTED] was heard to say: Sorry for the typo, fixed below my $command = CREATE TABLE my_table (; foreach my $counter (1..999) { $command .= INT column . $counter . , ; } $command .= INT column1000); print $command; -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] sqlite and cygwin
Arjen Markus [EMAIL PROTECTED] was heard to say: You should be able to do that via the instructions for Linux, as the Cygwin environment is a lot like that. Basically yes. I've used the configure script like this: $ ../sqlite/configure --enable-utf8 This works ok. You should be careful though as the result is something like a Cygwin/Win32 hybrid. All paths are handled Windows-style which makes things a bit odd on Cygwin. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] absolute vs. relative path to database on Cygwin
Markus Hoenicka writes: amead writes: It's a bit of a long-shot, but have you tried the 'cygdrive' path syntax? $ sqite /cygdrive/c/cygwn/usr/local/share/refdb/db/refdb (assuming you installed Cygwin on C:\cygwin) Actually I did not try this yet. I'll do so tomorrow, as I don't have any windoze stuff at home (fortunately). My gut feeling says it is going to work. Well, that doesn't work, but the following does: sqlite c:/cygwin/usr/local/share/refdb/db/refdb i.e. absolute paths require a DOS-style drive letter. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
[sqlite] switching off large file support?
Hi, in an attempt to investigate the absolute vs. relative path problem on Cygwin I've played with a few build possibilities. Interestingly, sqlite now builds Unix-style on Cygwin, something that failed in the past. This requires the following definition in Makefile: TCC = gcc -g -O2 -DOS_UNIX=1 -DOS_WIN=0 -DHAVE_USLEEP=1 -I. -I${TOP}/src i.e. pretty close to what you'd get on any run-of-the-mill Linux or BSD. However, trying to open a database fails with the following error message: Unable to open database sqlitetest: kernel lacks large file support I understand that this is a limitation of the underlying Windows OS shining through, so this isn't exactly surprising. What surprises me is that it is apparently not possible to switch off large file support by using this definition, as suggested by os.h: TCC = gcc -g -O2 -DOS_UNIX=1 -DOS_WIN=0 -DSQLITE_DISABLE_LFS -DHAVE_USLEEP=1 -I. -I${TOP}/src I still get the same complaint about large file support. Does anyone know what's going on? Has anyone else attempted to build SQLite natively as a Unix app on Cygwin? regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] switching off large file support?
Hi, sorry for the noise. Switching off large file support works as advertized. However, make clean is not clean enough to remove the previous configuration. Large file support is off if I start from scratch using the compiler switch suggested in os.h. Now I bump into the locking issue that we've been talking about a while ago. I'm using now an all-Unix-style SQLite build on Cygwin, and attempting to access a database results in: SQL error: database is locked Has anyone ever got close to fixing this locking issue on Cygwin? regards, Markus Markus Hoenicka [EMAIL PROTECTED] was heard to say: What surprises me is that it is apparently not possible to switch off large file support by using this definition, as suggested by os.h: -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] absolute vs. relative path to database on Cygwin
amead writes: It's a bit of a long-shot, but have you tried the 'cygdrive' path syntax? $ sqite /cygdrive/c/cygwn/usr/local/share/refdb/db/refdb (assuming you installed Cygwin on C:\cygwin) Actually I did not try this yet. I'll do so tomorrow, as I don't have any windoze stuff at home (fortunately). My gut feeling says it is going to work. How did you make it on Windows? I wonder if there is a switch in there somewhere that is tripping you up. Making is a matter of configure make. It works like a charm. However, if you closely inspect os.c, you'll notice that the platform-specific code bypasses most of the functionality that Cygwin offers. All file accesses use native Windows calls, and I believe this is why paths with a leading slash fail. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
[sqlite] absolute vs. relative path to database on Cygwin
Hi, I've just built 2.8.15 on Cygwin which worked without a hitch (thanks to those who added Cygwin support in the past). However, I came across a problem that makes working with databases a bit inconvenient. It seems like the library does not understand absolute paths, only relative paths. You can simply test this with the command line tool sqlite: [EMAIL PROTECTED] ~/lit $ sqlite /usr/local/share/refdb/db/refdb SQLite version 2.8.15 Enter .help for instructions sqlite select * from CITSTYLE; Unable to open database /usr/local/share/refdb/db/refdb: unable to open databa se: /usr/local/share/refdb/db/refdb [EMAIL PROTECTED] ~/lit cd / [EMAIL PROTECTED] / $ sqlite usr/local/share/refdb/db/refdb SQLite version 2.8.15 Enter .help for instructions sqlite select * from CITSTYLE; [lots of entries] cd - [EMAIL PROTECTED] ~/lit $ sqlite ../../../usr/local/share/refdb/db/refdb SQLite version 2.8.15 Enter .help for instructions sqlite select * from CITSTYLE; [lots of entries] The same problem occurs if I use an application linked against libsqlite. If I set the absolute path to the database file, the app fails. If I start the app in / and pass the relative path, the app works ok. I'm currently away from my Linux/BSD boxes, so I can't tell whether this problem is specific to Cygwin. Can anyone help? regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
Re: [sqlite] absolute vs. relative path to database on Cygwin
Christian Smith writes: This looks like a cygwin and/or your cygwin environment problem. sqlite works fine with absolute path on my Linux box, with 2.8.15. We're using sqlite with absolute paths in production code across Solaris, Linux, Windows, HP-UX and AIX with no problems. Thanks for checking. I have tried older versions of SQLite (up to 2.8.11) on FreeBSD and Linux in the past and I can't remember having any problems. Absolute paths of course work on Cygwin in general, so I assume there is some DOSism in the Windows-specific code that screws up the Unix-style Cygwin port. I'll try to track this down. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de
[sqlite] FreeBSD and SQLite
Al Rider writes: I tried to compile and install SQLite without any success. You might want to be a tad more specific at this point. What kind of error messages did you get? Is there anyone successfully running SQLite on a FreeBSD machine? If so, would you email me and give me some help with it. I've been compiling SQLite on FreeBSD since 2.7.x without any problems. I'm currently running 2.8.11 (due to some lazyness), but I assume 2.8.13 would compile just as well. If the port/package (as mentioned by Stephane) doesn't help, feel free to drop me a line to sort this out. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with mhoenicka) http://www.mhoenicka.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]