[sqlite] coding style
Hello, May be it's a kind of trivial question but I would like to know if it is possible to get some details about sqlite (source) coding style, some guidelines (tabs, spaces, indentation, etc.). I would like to follow it in my customization in some files. Could you give me some info? Best regards -- Mateusz Łoskot, mateusz (at) loskot (dot) net Registered Linux User #220771, Debian (Sarge)
Re: [sqlite] problems compiling demo example with version 2.8.15
On Dec 4, 2004, at 11:42 AM, Ulrik Petersen wrote: Hello, I want to compile the simple demo example for version 3 from the documentation with version 2.8.15. I use 2.8.15, because my embedded sqlite in php works with 2.8.x. I changed all functions sqlite3... to sqlite... . That is not quite enough, since some of the parameters have changed as well. I suggest you Read The Fine Manual to sort out what needs to be changed: http://www.sqlite.org/c_interface.html You only have to read the docs for a few calls, namely the ones in the example program. The document you link to is about the 2.x interface. I made this very mistake recently when building an interface against SQLite for CMUCL; the sqlite3 C interface document is at http://www.sqlite.org/capi3ref.html instead. -- Randall Randall <[EMAIL PROTECTED]> Property law should use #'EQ , not #'EQUAL .
Re: [sqlite] problems compiling demo example with version 2.8.15
Hello Daniel, > Hello, > I want to compile the simple demo example for version 3 from the > documentation with version 2.8.15. I use 2.8.15, because my embedded > sqlite in php works with 2.8.x. > I changed all functions sqlite3... to sqlite... . That is not quite enough, since some of the parameters have changed as well. I suggest you Read The Fine Manual to sort out what needs to be changed: http://www.sqlite.org/c_interface.html You only have to read the docs for a few calls, namely the ones in the example program. This isn't much help, I realize, but there is wisdom in RTFM'ing before asking a forum, as Eric S. Raymond has so cogently written about: "How To Ask Questions the Smart Way": http://www.catb.org/~esr/faqs/smart-questions.html HTH Ulrik P. >From the quoted document: Before You Ask Before asking a technical question by email, or in a newsgroup, or on a website chat board, do the following: 1. Try to find an answer by searching the Web. 2. Try to find an answer by reading the manual. 3. Try to find an answer by reading a FAQ. 4. Try to find an answer by inspection or experimentation. 5. Try to find an answer by asking a skilled friend. 6. If you are a programmer, try to find an answer by reading the source code. When you ask your question, display the fact that you have done these things first; this will help establish that you're not being a lazy sponge and wasting people's time. Better yet, display what you have learned from doing these things. We like answering questions for people who have demonstrated that they can learn from the answers. -- Ulrik Petersen, Denmark
Re: [sqlite] commas in columns and temporary tables
Taj, > Hi Ulrik, > >>>Now, that's all fine and everything for interactive SQL, but when I'm >>>using this in a program (written in Delphi), the comma messes up the >>>returned values (since they are comma seperated) >>> >>> >> >>You can do escaping that replaces the comma with something else when >>writing to the table, then converts it back after you have gotten the >> info >>from the comma-separated format. >> >>For example, URLs regularly use %XX to escape characters such as space, >>where XX is the hexadecimal ASCII value. So "space" (ASCII 32) will be >>"%20". Just remember to escape not only the comma, but also the >>percentage sign or whatever signals your escape sequences. >> >> > Ahh! That's a good idea! What characters would I need to escape? Comma, > obviously, percentage, what else would freak SQLite out? I guess that > when stuff is returned from the database or inserted into it, I should > escape it or unescape the text? A NUL (ASCII 0) would also freak SQLite out, unless you are storing as a BLOB in SQLite 3. Yes, you should escape when inserting and unescape after getting back from the table. Dennis suggested inserting "double quotes" around the text. That is simpler, and may work - try it first. It is standard practice in comma-separated-value files to embed fields in "double quotes" if you want to escape commas inside of it. You say that the DLL uses regular expressions to comma-delimit the table. Depending on how the DLL does it, it is maybe possible to specify a language in regular expressions that takes care of not splitting on a comma if that comma is embedded in double quotes. HTH Ulrik -- Ulrik Petersen, Denmark
[sqlite] problems compiling demo example with version 2.8.15
Hello, I want to compile the simple demo example for version 3 from the documentation with version 2.8.15. I use 2.8.15, because my embedded sqlite in php works with 2.8.x. I changed all functions sqlite3... to sqlite... . If I compile, I get these eroor messages: sq.c: In function `main': sq.c:22: Warnung: passing arg 2 of `sqlite_open' makes integer from pointer without a cast sq.c:22: error: too few arguments to function `sqlite_open' sq.c:22: Warnung: assignment makes integer from pointer without a cast sq.c:34:2: Warnung: no newline at end of file Have I to change something else? I appreciate any help. Thanks, Daniel #include #include static int callback(void *NotUsed, int argc, char **argv, char **azColName){ int i; for(i=0; i