Should I be using XML to store configuration values in a database?



There are a couple of answers on SE comparing single-row table vs. name-value-pair table used for config settings, but I haven't seen anyone arguing for using XML (or JSON) as a name-value pair model.

Option A

UserID     AppID     ParamID    Value
1          1         10         5.40
1          1         11         John Smith
2          1         10         4.40
2          1         11         Jane Smith

Option B

UserID     AppID     Settings
1          1        
<params><param><ID>10</ID><value>5.40</value></param><param><ID>11</ID><value>John
Smith</value></param></params>
2          1        
<params><param><ID>10</ID><value>4.40</value></param><param><ID>11</ID><value>Jane
Smith</value></param></params>

Option A is plain key-value pair solution, and Option B uses only one serialized XML settings per user/app.

Is there any value in using XML instead of a plain key-value pair?


Related to : Should I be using XML to store configuration values in a database?
Store settings in database or XML in PHP?
Programming Languages

I'm working on an app using CakePHP, and I have some generic settings that admins can change that affect the whole site, but I'm not quite sure how to handle saving/editing the data. These settings are for site-control related things, such as enabling/disabling new user registrations, enabling/disabling creating of new posts/topics, etc...

Since these aren't specific to individual users and there is only 1 set of values for the entire site, is it more advantageous to just use an XML file or should I create a table (which would only have 1 row)?

If I go with the XML route, are there any security related issues I should be aware of?

I saw this post but the accepted answer was on a per-user basis. This is only 1 set for the entire site.


input values didn't store in mysql database pls help me...
Programming Languages

Here i have create form with simple login web...

when i run the code,couldn't store user input values at the back-end.

here is full code for your reference..

dp.php:

<?php
$dbc = mysqli_connect('localhost', 'root', '', 'list')or
trigger_error(mysqli_error());
$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$email = $_POST['email_id'];
$password = $_POST['password'];
$query = "INSERT INTO login_list (first_name, last_name,
email,password) VALUES      ('$first_name', '$last_name',
'$email','$password')";
mysqli_query($dbc, $query)
or trigger_error(mysqli_error($dbc));

echo 'login created';

mysqli_close($dbc);
?>

Which approach would be better for persisting these overridable configuration keys and values? A simple key-value store, or a graph database?
Programming Languages

I'm creating a system where there are config keys and values. So for example:

config.key = 10

Is an example of a configuration key and a value. These keys can also have overrides based on "dimensions". So for example, if we wanted to apply config.key to applications with the dimension foo, the overridden key would essentially be:

config.key.foo = 20

In future we may have multiple dimensions in arbitrary order, so this could be a possibility in future:

config.key.foo.bar = 30

A more concrete example would be if we had a key/toggle called display.pintrest.feed that has a boolean value. So the default value would be false, but you could have overrides like so:

display.pintrest.feed = false
display.pintrest.feed.femaleUser = true

Here femaleUser is a dimension (so we want to set the value of this config to true for only female users).

This is essentially what I am trying to do. My question is regarding persistence. What would be the best way to persist this kind of data? This is data that will be queried somewhat frequently but written to less often. The naive solution would be to use MySQL or PostgreSQL and create a table like this:

+----------------------------------+-------+
|                Key               | Value |
+----------------------------------+-------+
| config.key                       | 10    |
| config.key.foo                   | 20    |
| display.pintrest.feed            | true  |
| display.pintrest.feed.femaleUser | false |
+----------------------------------+-------+

But we lose the type safety of Value and also have a single point of failure. We also have a lot of redundancy (the base part of the configuration key is repeated each time). So I wondered about perhaps representing it as a graph so that I could write it to a graph database. I was thinking of modeling it like so:

enter image
description here

Is this viable or overkill?

I don't mind using a simple key-value store either but it should be fault-tolerant and should be able to be clustered. Also we only really care about eventual consistency (i.e., don't mind it taking time to propagate changes to all the nodes).

So my question is what kind of data store should back this kind of data? Is a simple key-value store enough or should I go for a graph database? My rationale for the latter is simply to mitigate the redundancy from keys but I don't know if that's strong rationale.


How to get values from database[Cursor Adapter] and store it to an array in java?
Programming Languages

I would like to get the values from database of a particular column by executing a query. Is it possible to do it after we do it to the Cursor Adapter or can we attain the values well before itself. Kindly help on this with a snippet or a guide.


How to store multiple JSON values in to single row of database?
Programming Languages

I will get input in JSON formate, that value should store in mysql database. My question is i want to store more than 1 image url in single row.Is it posiible? and how? Below code is the input in json formate.I want to store multiple image data in single row?

{
"session_id": "192urjh91f",
"description": "description of the post",
"location": "12.00847,-71.297489",
"place_id": "917439",
"images": [
    "url1",
    "url2",
    "url3"
],
"audio": "audio url",
"tags": [
    "1234",
    "31332",
    "12412"
],
"people": [
    "user_id",
    "user_id1",
    "user_id2"
]

}


Should I be using XML to store configuration values in a database?
Programming Languages

There are a couple of answers on SE comparing single-row table vs. name-value-pair table used for config settings, but I haven't seen anyone arguing for using XML (or JSON) as a name-value pair model.

Option A

UserID     AppID     ParamID    Value
1          1         10         5.40
1          1         11         John Smith
2          1         10         4.40
2          1         11         Jane Smith

Option B

UserID     AppID     Settings
1          1        
<params><param><ID>10</ID><value>5.40</value></param><param><ID>11</ID><value>John
Smith</value></param></params>
2          1        
<params><param><ID>10</ID><value>4.40</value></param><param><ID>11</ID><value>Jane
Smith</value></param></params>

Option A is plain key-value pair solution, and Option B uses only one serialized XML settings per user/app.

Is there any value in using XML instead of a plain key-value pair?



Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .