1

I'm working on creating a checkbook app for android using a database to record transactions. The design I'd envisioned was/is to allow the user the ability to create different "accounts" (savings account, checking account, etc) under whatever name they choose and use that as the database table name. However, using preparedStatements doesn't work when I try to create a table. So I'm wondering if I'm going to need to sanitize the input manually or if I'm missing something. This is my first Java/android database program and I've got no formal education in databases so its possible I completely missed something. **edited to reflect more accurately what I meant by account. As this will be on an android device I have no interest in multiuser setup.

1
  • Unless you are storing heterogeneous data, I do not see the point on why you would create a new table for each user. Although if you still want to create new table, you could do that by using sqllitehelper. It has a overriden method for createtable. Use this instead of prepared statements. Commented Apr 11, 2011 at 22:13

1 Answer 1

1

Probably, you don't need a table for each user. You should revise your database structure.

Sign up to request clarification or add additional context in comments.

4 Comments

Sorry I was more clear, but its not based on users but accounts as in savings account or checking account.
Also, you still don't need a table named specially for device. You can has an general "account" table which contains the data from the user.
So, create a table named "account" then provide a column that would seperate deposits and withdrawls from different accounts? For example, to show only deposits and withdrawls from the savings account, SELECT * FROM accounts WHERE accountType = "savings".
Cool. I plan on providing a list of the accounts so I'm thinking of using a table for just the account names then providing a foreign key reference in the accounts table. Any problems that you foresee?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.