store array data in mysql using codeigniter-3 - codeigniter-3

I want to store array data in database(mysql) using codeigniter
$data['product_data'] = $this->Products_database_fe->get_by_id($id);
$data contains data which i have fetch from database.
Now $data which contain an array, and i want to store that array data in phpmyamin using codeigniter-3

Related

Does MongoDB have set for data structure?

I have a list of user ids stored in a field of MongoDB collection. Each of the user ids is an UUID. The field is an array. For example,
["59cc7562-751b-11ed-a1eb-0242ac120002", "66e6f240-751b-11ed-a1eb-0242ac120002",
"742df8ea-751b-11ed-a1eb-0242ac120002", ............,"6cf6e398-751b-11ed-a1eb-0242ac120002"]
Now, if I want to check whether a user id is in the array, i need to do loop through the array until I find the user id or reach the end of the array. This is slow. I wonder if I can use a set to store the user ids instead of an array.
I am using Next.Js in the backend. If I convert the array to a set, that would be even slower than just looping through the array since the conversion takes o(n).

How to split my data from firestore database to prevent the 2Mb limite

I touch the limite of data that firestore database can send in one time SQLite can handle datas up to 2Mb at once.
Currently I make a backup of all user data in one string like that
var allkeys=prefs.getKeys().map<String>((key){
return (key + ":" + prefs.get(key).toString());
}).toList();
firestoreInstance.collection("mycollection").doc("user").set({'array':FieldValue.arrayUnion(['$data'])});
My firestore database look like that
Collection->user-> array ->[1] "key1:value1, key2:value2, key3:value3 ... key4:value4"
Problem, some users who write lot of data, exceed the 2Mb limite and app finish to crash...
To prevent crash, I search to split the send of data
My input data is structured like that
allkeys =[key1:value1, key2:value2, key3:value3, key4:value4, key5:value5]
My first idea is to use regex to detect all keyX:valueX
like that ((?<=,)[^,]*) but it not eclude [ ]
and for each upgrade data array from firestore database
like that -> Collection->user-> array ->[1]"key1:value1"
->[2]"key2:value2"
->[3]"key3:value3"
But I don't know how to do and if it possible.
So my first question is how extract each key:value from one string
My second is how send each extracted key:value in an array of firestore database

add string to an array in Firestore - flutter

i have created an array of strings "challengeMember" in Firestore database and i want to add data to it when user clicks a button, my database:
in my code am trying to update the array, every time user join a challenge, the challenge name will be added to this array i know how to access the array using:
FirebaseFirestore.instance.collection("Users").doc(user!.uid).update({'challengeMember': widget._challengeName});
but the problem with this it is not specifying the array index and it is not checking whether the index is empty or not, so how can i dynamically access this array and keep adding values.
Firestore has a special trick to add an array, and it goes like this:
await FirebaseFirestore.instance.collection('users').doc(uid).update({
'tokens': FieldValue.arrayUnion([token]),
});
See the FieldValue documentation on how to manipulate arrays.

How to create an array of objects in data factory?

I need to have an array of objects and save it to JSON in Data Factory.
[
{"abc":123},
{"bca":123}
]
I can save it to JSON but it omits the comma (,).
This is my flow
My aggregate function
collect(#(abc=abc, ...))
This gives my an array for each object which is not what I want. I would like to wrap all the lines in one array.
Update
The image below shows the flattening of the incomming stream.
Thanks
You need to create the structure first in a Derived Column, then collect() that structure in an Aggregate.

Retreive all records from external dictionary in clickhouse

I have added MongoDB as external dictionary, I can retrieve data from mongodb using the below query.
select dictGetString('table', 'field', tuple(toUInt16(4089))) columnName
How to retrieve all records from external dictionary?
You can use a specific database to retrieve data from all dictionaries.
CREATE DATABASE dictionaries ENGINE = Dictionary;
SELECT * FROM dictionaries.<your dictionary name>;