Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: DBI Update dynamically

by thanos1983 (Parson)
on Feb 24, 2018 at 00:10 UTC ( [id://1209875]=note: print w/replies, xml ) Need Help??


in reply to Re: DBI Update dynamically
in thread DBI Update dynamically

Hello again Anonymous Monk,

Since there is no limit on how many tables can SQLite see here Limits In SQLite, why not create different table for each user and then use the REPLACE that fellow Monk poj proposed. By doing so you can have different number of columns for each user based on their requirements.

Hope this helps. BR / Thanos

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^3: DBI Update dynamically
by stevieb (Canon) on Feb 24, 2018 at 01:02 UTC

    I feel that having a different table for each user completely removes the entire purpose of a single source of information.

    Now, it feels like I'm missing something here, but to maintain such a structure (especially to simply fetch information across all tables) would be a nightmare.

    I'm not saying its right or wrong, I'm saying it feels like a kludge that actually goes against any efficiencies and scalability.

    The real solution I think is to add a bit more code and do the UPDATE accordingly. That'll keep the DB consistent, and allow OP to still dyanmically do things in a way that would be scalable going forward. I just got to a hotel after a three hour drive so I need more time to digest this (perhaps OP can share more insight into the reason for needing this extreme conciseness) before I have any formal solution.

    Could be trivially easy to add another column to the table, perhaps even comma separated that explains which columns each user can populate by name, then grab that info based on the userid, dump it into a hash, and then you know which columns user X has, and just dump undef, NULL or whatever to the others (again, using UPDATE).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1209875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found