[Tutor] make a sqlite3 database from an ordinary text file
Dennis Lee Bieber
wlfraed at ix.netcom.com
Sun Jun 19 15:26:46 EDT 2022
On Mon, 20 Jun 2022 00:07:42 +0530, Manprit Singh
<manpritsinghece at gmail.com> declaimed the following:
>Dear sir ,
>
>One more query ....
>How can i use column name in text file as colum names in sqlite3 database .
>I tried using python but failed.
Show us the code, and the traceback... Otherwise we have no real idea
of what you might be doing...
Not to mention -- you are opening yourself up for an SQL injection
attack by doing what I think you mean.
ANYTHING involving the database schema should NEVER rely upon user
input values. Only the DATA, and that via the adapter's form of
parameterization (SQLite3 using ?, others have different syntax). This way
the adapter can do escaping and quoting if needed to ensure that the value
is treated solely as data, and not something that could be interpreted as
another SQL statement.
If you need to generate SQL statements from user specified fields, you
should present a menu to the user of the fields that are defined in the
database, and use the user input (position/index #) to select from the
known field names.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the Tutor
mailing list