Re: [sqlite] Reading a text file and insert to sqlite tables
On 09-12-10 18:53, yazdan asgari wrote: > > --- On Thu, 12/9/10, luuk34<luu...@gmail.com> wrote: > > From: luuk34<luu...@gmail.com> > Subject: Re: [sqlite] Reading a text file and insert to sqlite tables > To: "General Discussion of SQLite Database"<sqlite-users@sqlite.org> > Date: Thursday, December 9, 2010, 9:21 AM > > > > On 09-12-10 18:13, yazdan asgari wrote: >> Hi >> I use C Programming Language and I also know that I could use INSERT >> command. But my problem is whether any one could show me a simple code which >> demonstrate how an INSERT command should be written during reading a text >> file. I have searched Google but I could not find any useful link. >> Yazdan >> > u did not search correctly: > http://www.google.com/search?hl=en=off=1G1ACAW_NLNL390=sqlite+c++example+insert+data=Search=f===_rfai= > > 1st link points to: > http://www.lemoda.net/sqlite/c-insert/ > > Hi > Thanks for your quick reply. I saw the linked that you said but my problem is > to INSERT data during reading a long text file in which every line consists > of several queries. I could read this file and write to an output file but I > am not able to write a sqlite command (INSERT in this case) in order to put > data in desired tables. > > i fixed te top-quoot, because i think bottom-quoot is easier to read. But reading you question again, i dont seem to understand your problem... sorry ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reading a text file and insert to sqlite tables
Hi Thanks for your quick reply. I saw the linked that you said but my problem is to INSERT data during reading a long text file in which every line consists of several queries. I could read this file and write to an output file but I am not able to write a sqlite command (INSERT in this case) in order to put data in desired tables. --- On Thu, 12/9/10, luuk34 <luu...@gmail.com> wrote: From: luuk34 <luu...@gmail.com> Subject: Re: [sqlite] Reading a text file and insert to sqlite tables To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> Date: Thursday, December 9, 2010, 9:21 AM On 09-12-10 18:13, yazdan asgari wrote: > Hi > I use C Programming Language and I also know that I could use INSERT command. > But my problem is whether any one could show me a simple code which > demonstrate how an INSERT command should be written during reading a text > file. I have searched Google but I could not find any useful link. > Yazdan > u did not search correctly: http://www.google.com/search?hl=en=off=1G1ACAW_NLNL390=sqlite+c++example+insert+data=Search=f===_rfai= 1st link points to: http://www.lemoda.net/sqlite/c-insert/ ___ 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
Re: [sqlite] Reading a text file and insert to sqlite tables
On 09-12-10 18:13, yazdan asgari wrote: > Hi > I use C Programming Language and I also know that I could use INSERT command. > But my problem is whether any one could show me a simple code which > demonstrate how an INSERT command should be written during reading a text > file. I have searched Google but I could not find any useful link. > Yazdan > u did not search correctly: http://www.google.com/search?hl=en=off=1G1ACAW_NLNL390=sqlite+c++example+insert+data=Search=f===_rfai= 1st link points to: http://www.lemoda.net/sqlite/c-insert/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reading a text file and insert to sqlite tables
Hi I use C Programming Language and I also know that I could use INSERT command. But my problem is whether any one could show me a simple code which demonstrate how an INSERT command should be written during reading a text file. I have searched Google but I could not find any useful link. Yazdan --- On Thu, 12/9/10, Simon Slavin <slav...@bigfraud.org> wrote: From: Simon Slavin <slav...@bigfraud.org> Subject: Re: [sqlite] Reading a text file and insert to sqlite tables To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> Date: Thursday, December 9, 2010, 2:57 AM On 9 Dec 2010, at 9:58am, yazdan asgari wrote: > I want to write a program in order to insert data to a sqlite database from a > text file. The text file contains data in each line as below which repeats > about 200 lines: > > P05075 > 01-JAN-1988 > 16 > TOBACCO RATTLE VIRUS (STRAIN PSG). > CORNELISSEN B.J.C., LINTHORST H.J.M., BREDERODE F.T., BOL J.F.; > NUCL. ACIDS RES. 14:2157-2169(1986). > 141 > 16297 > 93420 > MTCVLKGCVNEVTVLGHETCSIGHANKLRKQVADMVGVTRRCAENNCGWFVCIIINDFTFDVYNCCGRSHLEKCRKRVEARNREIWKQIRRIQAESSSATRKKSHNSKNSKKKFKEDREFGAPKRFLRDDVPLGIDQLFVF > ... > > > I want to read this file and insert each line into a value of a database > (database contains 3 tables). I can write a code to read text file but I do > not know how to insert these data to sqlite tables during reading process. > Could any one suggest me a simple program to do this? Just use the INSERT command, which is part of the SQL standard. http://www.sqlite.org/lang_insert.html How to access SQLite from your programming language depends on what programming language you're using. If Google doesn't find anything helpful for you, tell us what language you're using and we might be able to help. However, if you are doing this once only, to get your database started, it will be simpler to convert your text file to .csv format, and use the SQLite command-line tool to make a table out of it. http://www.sqlite.org/sqlite.html Simon. ___ 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
Re: [sqlite] Reading a text file and insert to sqlite tables
On 9 Dec 2010, at 12:33pm, pyt...@bdurham.com wrote: > Simon, > >> convert your text file to .csv format, and use the SQLite command-line tool >> to make a table out of it. > > Will this technique work with multi-line fields (fields with newlines) > or blobs? The answer seems to depend on which operating system you're using, and which character you're using for newlines (return or newline or both). Can I suggest you make up a tiny example file, something like 1,"hello" 2,"good bye" and try it ? Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reading a text file and insert to sqlite tables
Simon, > convert your text file to .csv format, and use the SQLite command-line tool > to make a table out of it. Will this technique work with multi-line fields (fields with newlines) or blobs? Thank you, Malcolm ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reading a text file and insert to sqlite tables
On 9 Dec 2010, at 9:58am, yazdan asgari wrote: > I want to write a program in order to insert data to a sqlite database from a > text file. The text file contains data in each line as below which repeats > about 200 lines: > > P05075 > 01-JAN-1988 > 16 > TOBACCO RATTLE VIRUS (STRAIN PSG). > CORNELISSEN B.J.C., LINTHORST H.J.M., BREDERODE F.T., BOL J.F.; > NUCL. ACIDS RES. 14:2157-2169(1986). > 141 > 16297 > 93420 > MTCVLKGCVNEVTVLGHETCSIGHANKLRKQVADMVGVTRRCAENNCGWFVCIIINDFTFDVYNCCGRSHLEKCRKRVEARNREIWKQIRRIQAESSSATRKKSHNSKNSKKKFKEDREFGAPKRFLRDDVPLGIDQLFVF > ... > > > I want to read this file and insert each line into a value of a database > (database contains 3 tables). I can write a code to read text file but I do > not know how to insert these data to sqlite tables during reading process. > Could any one suggest me a simple program to do this? Just use the INSERT command, which is part of the SQL standard. http://www.sqlite.org/lang_insert.html How to access SQLite from your programming language depends on what programming language you're using. If Google doesn't find anything helpful for you, tell us what language you're using and we might be able to help. However, if you are doing this once only, to get your database started, it will be simpler to convert your text file to .csv format, and use the SQLite command-line tool to make a table out of it. http://www.sqlite.org/sqlite.html Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Reading a text file and insert to sqlite tables
Dear Friends I want to write a program in order to insert data to a sqlite database from a text file. The text file contains data in each line as below which repeats about 200 lines: P05075 01-JAN-1988 16 TOBACCO RATTLE VIRUS (STRAIN PSG). CORNELISSEN B.J.C., LINTHORST H.J.M., BREDERODE F.T., BOL J.F.; NUCL. ACIDS RES. 14:2157-2169(1986). 141 16297 93420 MTCVLKGCVNEVTVLGHETCSIGHANKLRKQVADMVGVTRRCAENNCGWFVCIIINDFTFDVYNCCGRSHLEKCRKRVEARNREIWKQIRRIQAESSSATRKKSHNSKNSKKKFKEDREFGAPKRFLRDDVPLGIDQLFVF ... I want to read this file and insert each line into a value of a database (database contains 3 tables). I can write a code to read text file but I do not know how to insert these data to sqlite tables during reading process. Could any one suggest me a simple program to do this? Thanks for your helps. Best regards Yazdan ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users