Re: [sqlite] binding paramters for SELECT
On 8/8/06, Dixon <[EMAIL PROTECTED]> wrote: I have prepared the following wide text string: L"SELECT ROWID FROM indext WHERE state='1' AND clientName='?' ORDER BY size DESC" with sqlite3_prepare16, I then call sqlite3_bind_parameter_count on the resulting statement. I get 0 back when I expected 1. Is this an invalid way to specify a placeholder for a variable that I will bind later? You don't need to enclose ? with any quotes. Try it like this: WHERE state='1' AND clientName=? -- Nemanja Corlija <[EMAIL PROTECTED]>
[sqlite] ANN:SQLtTableImprot - Free SQLite to SQLite Table Import Tool
SQLtTableImprt is a little tool for importing a table from one SQLite database into another SQLite database. - This can easily be done in SQL with ATTACH DATABASE. - SQLtTableImprt automates the process. - Windows only. - Should work with any SQLite Type 3 database that the Window's file system can connect to. - Blobs are OK. - Download: http://www.sqlight.com/sqlttableimprt/ - Free. StanD sd _ at _ sqlight _ dot _ com
Re: [sqlite] primary key information
another way "SELECT rowid FROM MyTable LIMIT 1" the column name returned will be the Integer Primary Key StanD sd at sqlight.com - Original Message - From: "Mario Frasca" <[EMAIL PROTECTED]> To:Sent: Monday, August 07, 2006 9:33 AM Subject: Re: [sqlite] primary key information Nemanja Corlija wrote: I think in any other case unique index would be created as expected. sqlite> drop table test; sqlite> create table test (ni integer, pk_name varchar(32) primary key, info integer); sqlite> pragma index_list(test); 0|sqlite_autoindex_test_1|1 sqlite> pragma table_info(test); 0|ni|integer|0||0 1|pk_name|varchar(32)|0||1 2|info|integer|0||0 sqlite> that seems to be correct... interesting, thanks, Mario -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.7/410 - Release Date: 8/5/2006
Re: [sqlite] Insert delay!
Cesar David Rodas Maldonado wrote: Yeah John I am studying Math and computer science (but i am in the first year, and this is very boring) in National University Of Paraguay. When I finish my idea i will share my code. Thanks For understand my English John! On 8/5/06, John Stanton <[EMAIL PROTECTED]> wrote: Cesar David Rodas Maldonado wrote: > I was thinking a lot in the next month in how can I do the delay insert and > I found something for do that, is basic because I don't have a lot of > knowledge, I'm just start the University. > > OK, I need with SQLite to select all the time as possible, and delay the > Insert, I don't care the time that took insert something. These is my > needs with SQLite. Is something Interesting on my idea? If there is one I > will share my idea. > Your English is not very clear, but as I understand your idea it could be realized by performing your INSERTs in a thread, ideally set to a low priority and fed from a FIFO queue. You need to be aware of the locking constraints. Have success with your studies. Are you studying Math and Computer Science? You are welcome. I look forward to seeing your code. Math and CS can be very exciting, so stick at it. I have a daughter who has been studying Math and Computer Science and is now in an cutting edge PhD program and very happy. The best is yet to come for you.
Re: [sqlite] what tier architecture?
John Newby wrote: Hi, this is probably a stupid question and it has nothing to do with SQlite per se so I apologise in advance for hijacking the emails withmy question plus I don't even know if this is the right place to ask the question. I have created a GUI to SQLite using VB.Net for my University project and it interfaces with the SQLite .dll file. I have to now write about the architecture of my product but I am unsure as what it would be, after reading this website I am even more confused :- http://www.javaworld.com/javaworld/jw-01-2000/jw-01-ssj-tiers.html Could it be one tier as both the DBMS and GUI are as one or could it be two tier as the GUI could be the client and the DBMS the server or could it be three tier as the GUI could be the client and the DBMS the server and database? I'm really confused, so any help or information on this subject would be really appreciated. Many thanks John I would regard what you have developed as one tier. You do not have a server and consequently do not realise the two or three tier model. A two tier model has "fat" client and a server whereas a three tier has a "thin" client, and application server and a dbms server. The way you describe your application is that it is integrated and stand alone. If you have intercept locks within in to resolve contentions between multiple users of the database you can describe it as having multi-user capability.
Re: [sqlite] About Triggers
chetana bhargav uttered: Hi, I have few questions regarding triggers, * If we want to have trigger for some condition and if multiple applications create a trigger for the same condition providing different C callback functions (which I guess is possible through sqlite3_create_function), will the trigger be fired to all the registered apps. Triggers are created at the schema level. As such, they don't callback to through the C API other than by creating a trigger body to call your custom function. If a database has more than once trigger for an event, they will all get called AFAIK. Make sure that any callback functions are registered in any threads that use the database. Callbacks are per-connection. Each thread will also get other threads' callbacks if registered, or an error is such a function is not defined. Make sure your callbacks are thread-safe! * Is it possible to get the rowid for which the trigger is fired, The trigger will have OLD.rowid (delete, update) or NEW.rowid (update, insert) for the row triggering the trigger. The rowid can then be passed into your callback as an argument. -- /"\ \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \
RE: [sqlite] Replace of substring in sqlite-table - how can I do this?
Hi Wolfgang, Regarding: "...thank you very much for your reply. But is there no command within sqlite to do this? In my case, only substrings of the cells of one column need to be changed!" Sqlite was designed as a small SQL library -- extremely small, considering its capabilities -- implementing most of the SQL92 standard. The SQL commands are designed to store and retrieve data. The idea is that one incorporates this library into one's own program, using a compatible programming language of one's choice. Using your chosen programming language, you perform the sorts of data transformations you write about. So I don't think many would think it a shortcoming of sqlite that it doesn't provide general programming capabilities, but rather that it avoids *duplication* by *not* including such things. Not only can you include sqlite in a program written in C, perl, VB, etc., but you can link an sqlite database to Open Office or Microsoft Access as "front ends" to your database in order to manipulate data. Note that there is ALSO an sqlite command line *utility*, which is a useful program allowing one to enter sqlite commands without writing a program or linking another "front end", but it's not intended to be a general data manipulation package. That being said, you may want to be sure to look at page: http://www.sqlite.org/lang_expr.html including the "substr()" and concatenate expressions. The "regex()" function is not included in the command-line utility, but you can link in one of your choice. Sqlite also allows you to define your own SQL-callable functions within your program.
Re: [sqlite] what tier architecture?
Hi Jay, I will be writing about the technical details within the implementation stage of my report, but I wanted to write about the architecture in the design part of the report. Thanks for your advice. John On 07/08/06, Jay Sprenkle <[EMAIL PROTECTED]> wrote: On 8/7/06, John Newby <[EMAIL PROTECTED]> wrote: > Hi, this is probably a stupid question and it has nothing to do with SQlite > per se so I apologise in advance for hijacking the emails withmy question > plus I don't even know if this is the right place to ask the question. > > I have created a GUI to SQLite using VB.Net for my University project and it > interfaces with the SQLite .dll file. > > I have to now write about the architecture of my product but I am unsure as > what it would be, after reading this website I am even more confused :- > > http://www.javaworld.com/javaworld/jw-01-2000/jw-01-ssj-tiers.html Why is this particular guys method of dividing things up of particular interest? You can arbitrarily diving things up any way you like. IMHO if the paper is about the technical details of the implementation I would break it up into functional groupings of interest to the reader of the paper. Major functionality and/or which part comes from which library and what you wrote yourself to glue it together. As per usual, when people ask "What's the best ?" I have to ask "For what?" If you're trying to plow snow a Porsche isn't useful. If you're trying to win a race a snow plow won't work too well.
Re: [sqlite] About Triggers
- Last time I tried, the triggers are triggered only for the calling thread which registered the function. Can you elobarate more on this. ( For me if two threads register for the same trigger condition, with different callback functions, do both the functions get called) Cheers, Chetan Roberto <[EMAIL PROTECTED]> wrote: - Last time I tried, the triggers are triggered only for the calling thread which registered the function. - When the trigger is fired, you can refer to any field in the table. HTH. On 07/08/06, chetana bhargav wrote: > Hi, > > I have few questions regarding triggers, > > * If we want to have trigger for some condition and if multiple applications > create a trigger for the same condition providing different C callback > functions (which I guess is possible through sqlite3_create_function), will > the trigger be fired to all the registered apps. > > * Is it possible to get the rowid for which the trigger is fired, > > > - > See the all-new, redesigned Yahoo.com. Check it out. > - Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta.
Re: [sqlite] what tier architecture?
Hi Michael, thanks for your help, it is much appreciated. Thanks again John On 07/08/06, Michael Ruck <[EMAIL PROTECTED]> wrote: From your description I would consider this a one-tier architecture. Ussually the tiers are defined as follows: - Presentation GUI, all user interaction. - Business Logic Logic, which can not be expressed by constraints in the database. Interaction with other (software) systems and some more logic. - Data (access) layer This one is hard IMHO. In most cases this resembles a mapper, which maps from relational tables to objects used in the business logic. Additionally you have a set of predefined functions, which perform queries upon the data sources and return the results as objects. In most cases these are only access layers, which use a database server and stored procedures. HTH, Mike -Ursprüngliche Nachricht- Von: John Newby [mailto:[EMAIL PROTECTED] Gesendet: Montag, 7. August 2006 16:43 An: sqlite-users@sqlite.org Betreff: [sqlite] what tier architecture? Hi, this is probably a stupid question and it has nothing to do with SQlite per se so I apologise in advance for hijacking the emails withmy question plus I don't even know if this is the right place to ask the question. I have created a GUI to SQLite using VB.Net for my University project and it interfaces with the SQLite .dll file. I have to now write about the architecture of my product but I am unsure as what it would be, after reading this website I am even more confused :- http://www.javaworld.com/javaworld/jw-01-2000/jw-01-ssj-tiers.html Could it be one tier as both the DBMS and GUI are as one or could it be two tier as the GUI could be the client and the DBMS the server or could it be three tier as the GUI could be the client and the DBMS the server and database? I'm really confused, so any help or information on this subject would be really appreciated. Many thanks John
Re: [sqlite] Insert delay!
Yeah John I am studying Math and computer science (but i am in the first year, and this is very boring) in National University Of Paraguay. When I finish my idea i will share my code. Thanks For understand my English John! On 8/5/06, John Stanton <[EMAIL PROTECTED]> wrote: Cesar David Rodas Maldonado wrote: > I was thinking a lot in the next month in how can I do the delay insert and > I found something for do that, is basic because I don't have a lot of > knowledge, I'm just start the University. > > OK, I need with SQLite to select all the time as possible, and delay the > Insert, I don't care the time that took insert something. These is my > needs with SQLite. Is something Interesting on my idea? If there is one I > will share my idea. > Your English is not very clear, but as I understand your idea it could be realized by performing your INSERTs in a thread, ideally set to a low priority and fed from a FIFO queue. You need to be aware of the locking constraints. Have success with your studies. Are you studying Math and Computer Science?
Re: [sqlite] what tier architecture?
On 8/7/06, John Newby <[EMAIL PROTECTED]> wrote: Hi, this is probably a stupid question and it has nothing to do with SQlite per se so I apologise in advance for hijacking the emails withmy question plus I don't even know if this is the right place to ask the question. I have created a GUI to SQLite using VB.Net for my University project and it interfaces with the SQLite .dll file. I have to now write about the architecture of my product but I am unsure as what it would be, after reading this website I am even more confused :- http://www.javaworld.com/javaworld/jw-01-2000/jw-01-ssj-tiers.html Why is this particular guys method of dividing things up of particular interest? You can arbitrarily diving things up any way you like. IMHO if the paper is about the technical details of the implementation I would break it up into functional groupings of interest to the reader of the paper. Major functionality and/or which part comes from which library and what you wrote yourself to glue it together. As per usual, when people ask "What's the best ?" I have to ask "For what?" If you're trying to plow snow a Porsche isn't useful. If you're trying to win a race a snow plow won't work too well.
AW: [sqlite] what tier architecture?
>From your description I would consider this a one-tier architecture. Ussually the tiers are defined as follows: - Presentation GUI, all user interaction. - Business Logic Logic, which can not be expressed by constraints in the database. Interaction with other (software) systems and some more logic. - Data (access) layer This one is hard IMHO. In most cases this resembles a mapper, which maps from relational tables to objects used in the business logic. Additionally you have a set of predefined functions, which perform queries upon the data sources and return the results as objects. In most cases these are only access layers, which use a database server and stored procedures. HTH, Mike -Ursprüngliche Nachricht- Von: John Newby [mailto:[EMAIL PROTECTED] Gesendet: Montag, 7. August 2006 16:43 An: sqlite-users@sqlite.org Betreff: [sqlite] what tier architecture? Hi, this is probably a stupid question and it has nothing to do with SQlite per se so I apologise in advance for hijacking the emails withmy question plus I don't even know if this is the right place to ask the question. I have created a GUI to SQLite using VB.Net for my University project and it interfaces with the SQLite .dll file. I have to now write about the architecture of my product but I am unsure as what it would be, after reading this website I am even more confused :- http://www.javaworld.com/javaworld/jw-01-2000/jw-01-ssj-tiers.html Could it be one tier as both the DBMS and GUI are as one or could it be two tier as the GUI could be the client and the DBMS the server or could it be three tier as the GUI could be the client and the DBMS the server and database? I'm really confused, so any help or information on this subject would be really appreciated. Many thanks John
[sqlite] what tier architecture?
Hi, this is probably a stupid question and it has nothing to do with SQlite per se so I apologise in advance for hijacking the emails withmy question plus I don't even know if this is the right place to ask the question. I have created a GUI to SQLite using VB.Net for my University project and it interfaces with the SQLite .dll file. I have to now write about the architecture of my product but I am unsure as what it would be, after reading this website I am even more confused :- http://www.javaworld.com/javaworld/jw-01-2000/jw-01-ssj-tiers.html Could it be one tier as both the DBMS and GUI are as one or could it be two tier as the GUI could be the client and the DBMS the server or could it be three tier as the GUI could be the client and the DBMS the server and database? I'm really confused, so any help or information on this subject would be really appreciated. Many thanks John
Re: [sqlite] Replace of substring in sqlite-table - how can I do this?
Hi Peter, thank you very much for your reply. But is there no command within sqlite to do this? In my case, only substrings of the cells of one column need to be changed! Best regards, Wolfgang Am Montag 07 August 2006 pH:19:16 nachmittags/abends schrieb Peter Cunderlik: > On 8/7/06, wqual <[EMAIL PROTECTED]> wrote: > > Hi list, > > I have sqlite 3.2.1 installed on my computer. Now, I need to replace some > > substrings in my sqlite-table (for example, replace 'strasse' with 'str.' > > , german 'ä' with 'ae' etc.). Can I search for the substrings and replace > > them by another one? I do not know, what would be the right syntax for > > this purpose and I would be really grateful for some hints... > > The most flexible replace would be to use the sqlite3 command line > utility to .dump your database or a table and replace the strings in > the dump directly. The dump follows the sql syntax, so you could > import the modified dump into your existing DB. > > Search for .dump on http://www.sqlite.org/sqlite.html . > > Peter
Re: [sqlite] primary key information
Nemanja Corlija wrote: I think in any other case unique index would be created as expected. sqlite> drop table test; sqlite> create table test (ni integer, pk_name varchar(32) primary key, info integer); sqlite> pragma index_list(test); 0|sqlite_autoindex_test_1|1 sqlite> pragma table_info(test); 0|ni|integer|0||0 1|pk_name|varchar(32)|0||1 2|info|integer|0||0 sqlite> that seems to be correct... interesting, thanks, Mario
Re: [sqlite] Replace of substring in sqlite-table - how can I do this?
On 8/7/06, wqual <[EMAIL PROTECTED]> wrote: Hi list, I have sqlite 3.2.1 installed on my computer. Now, I need to replace some substrings in my sqlite-table (for example, replace 'strasse' with 'str.' , german 'ä' with 'ae' etc.). Can I search for the substrings and replace them by another one? I do not know, what would be the right syntax for this purpose and I would be really grateful for some hints... The most flexible replace would be to use the sqlite3 command line utility to .dump your database or a table and replace the strings in the dump directly. The dump follows the sql syntax, so you could import the modified dump into your existing DB. Search for .dump on http://www.sqlite.org/sqlite.html . Peter
[sqlite] Replace of substring in sqlite-table - how can I do this?
Hi list, I have sqlite 3.2.1 installed on my computer. Now, I need to replace some substrings in my sqlite-table (for example, replace 'strasse' with 'str.' , german 'ä' with 'ae' etc.). Can I search for the substrings and replace them by another one? I do not know, what would be the right syntax for this purpose and I would be really grateful for some hints... Best regards, Wolfgang
[sqlite] About Triggers
Hi, I have few questions regarding triggers, * If we want to have trigger for some condition and if multiple applications create a trigger for the same condition providing different C callback functions (which I guess is possible through sqlite3_create_function), will the trigger be fired to all the registered apps. * Is it possible to get the rowid for which the trigger is fired, - See the all-new, redesigned Yahoo.com. Check it out.
Re: [sqlite] primary key information
On 8/7/06, Mario Frasca <[EMAIL PROTECTED]> wrote: I was a bit wondering: does the declaration 'primary key' actually produce an indexing? or does that happen only if I explicitly ask for a (unique) index? It usually does create unique index for you. But in this case, INTEGER PRIMARY KEY, it only creates an alias to rowid, which is something that sqlite uses internally to identify rows and this index is always present. So in this case it doesn't create any new index-es, but rather references an existing one. I think in any other case unique index would be created as expected. -- Nemanja Corlija <[EMAIL PROTECTED]>
Re: [sqlite] primary key information
Nemanja Corlija wrote: If you turn the headers on (.header ON) you'll see that the last column of table_info() output is "pk". This column indicates weather or not the table column in question is part of primary key. Though that last column of table_info() pragma is missing from documentation at http://www.sqlite.org/pragma.html#schema very nice, thanks: elif engine == 'sqlite': cr.execute("pragma table_info(%s)" % tablename) pkeys = [fielddef[1] for fielddef in cr.fetchall() if fielddef[5] ==1] pass I was a bit wondering: does the declaration 'primary key' actually produce an indexing? or does that happen only if I explicitly ask for a (unique) index? Mario
Re: [sqlite] primary key information
On 8/7/06, Mario Frasca <[EMAIL PROTECTED]> wrote: hallo, list... how do I get primary key information about a table? [EMAIL PROTECTED]:~$ sqlite3 /data/mariof/test.db SQLite version 3.3.6 Enter ".help" for instructions sqlite> drop table test; sqlite> create table test (pk integer primary key, name varchar(32), info integer); sqlite> create unique index itest on test (name); sqlite> pragma index_list(test); 0|itest|1 sqlite> pragma table_info(test); 0|pk|integer|0||1 If you turn the headers on (.header ON) you'll see that the last column of table_info() output is "pk". This column indicates weather or not the table column in question is part of primary key. Though that last column of table_info() pragma is missing from documentation at http://www.sqlite.org/pragma.html#schema -- Nemanja Corlija <[EMAIL PROTECTED]>
[sqlite] primary key information
hallo, list... how do I get primary key information about a table? [EMAIL PROTECTED]:~$ sqlite3 /data/mariof/test.db SQLite version 3.3.6 Enter ".help" for instructions sqlite> drop table test; sqlite> create table test (pk integer primary key, name varchar(32), info integer); sqlite> create unique index itest on test (name); sqlite> pragma index_list(test); 0|itest|1 sqlite> pragma table_info(test); 0|pk|integer|0||1 1|name|varchar(32)|0||0 2|info|integer|0||0 sqlite> pragma foreign_key_list(test); sqlite> I would have expected to see something like this: sqlite> pragma index_list(test); 0|test_pkey|1 1|itest|1 that is, that primary keys be treated as unique indices with a standard naming pattern. what is the deal? thanks, Mario
Re: [sqlite] From Windows file format to MacOSX (ok!)
Ok, it seems to work when I set the PRAGMA right away, then create a table and insert one or two rows. I then exit the sqlite3 command line, export my data from access to sqlite3 through an ODBC adaptor. It is readable on the MacOSX side. Now, I have to figure how to use it in a CoreData application, but that's something for the Cocoa dev mailing list! Thanks for the help! Alex -- Alexander Lamb [EMAIL PROTECTED] On Aug 5, 2006, at 8:49 AM, Alexander Lamb wrote: Well, it didn't seem to work when I copied the file to MacOSX. It said (after accepting to go into command line mode) "invalid file format". I don't have an intel box to test now, so I will try again on monday at the office. My other option is to save the data in 2.8 format and convert from 2.8 to 3.1 with the dump command as explained in the documentation. I installed the 2.8 version from darwinports on MacOSX. Obviously, I would rather have the first solution working. Thanks, Alex -- Alexander Lamb [EMAIL PROTECTED] On Aug 4, 2006, at 6:11 PM, [EMAIL PROTECTED] wrote: Alexander Lamb <[EMAIL PROTECTED]> wrote: Well, I am afraid it didn't work. Somehow, the legacy_file_format info is not "sticky". The "legacy_file_format" pragma does not appear to be sticky, but it is. The value reported back by PRAGMA legacy_file_format is incorrect. But the legacy file format did get set. Mario Frasca <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: Adding DATE and TIMEINTERVAL types to SQLite would require an incompatible file format change. well, yes, that was already clear. but: where is the type of the data being stored? aren't there a few spare bits to use for 'future additions', that is, new data types? sure, a file containing date data would not be understood by executables where this has not been defined, but maybe it is possible to do it so that they see a 'text'... or maybe not... Mario: Look back over this thread, and others before it, and observe all the grief that gets caused by file format changes. I've learned my lesson: No more file format changes except too fix a serious bug. -- D. Richard Hipp <[EMAIL PROTECTED]>
Re: [sqlite] date data types
Kees Nuyt wrote: Will PRAGMA table_info(tablename); do? >>> from pysqlite2 import dbapi2 >>> db = dbapi2.connect('/data/mariof/test.db') >>> cr = db.cursor() >>> cr.execute('pragma table_info(test3)') >>> cr.fetchall() [(0, u'd', u'date', 0, None, 0), (1, u'h', u'time', 0, None, 0), (2, u't', u'timestamp', 0, None, 0), (3, u'i', u'interval', 0, None, 0)] so yes, it does. many thanks. but I still don't understand... casting a value to the type of the declaration sounds to me quite in conflict with the dynamic typing of sqlite. on the other hand I don't see in which way adding these three types (time being assimilated in interval) would break the design. just wondering. Mario