Raised This Month: $7 Target: $400
 1% 

Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]


Post New Thread Reply   
 
Thread Tools Display Modes
popey456963
Member
Join Date: Mar 2016
Old 07-01-2018 , 07:28   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #261

Or, thinking about it more, if you always just search based upon a dynamic name then you could just use MySQL as a dumb key value store? Have just two columns and make it a fake schema-less DB.
popey456963 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-01-2018 , 07:40   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #262

I was thinking of creating an dynamic class that would have a member like so which is parsed through the initialiser.

<String>dynamic.Query: An INSERT INTO ... ON DUPLICATE UPDATE statement

This class would have an LinkObject method which accepts a <Dynamic>dynamic parameter which adds the dynamic parameter change hooks.

When a change hook is called the Dynamic instance is added to an array if not already in there (maybe remove hooks and readd later).

Then on each frame get the updated instances and run the query.

Edit: ive already written code to grab dynamic objects from a collection with LINQ style code for selecting elements from the database so every table row isnt in memory.

https://github.com/ntoxin66/Dynamic/...ftest.sp#L1125

So writting this around a collection is key.

The collection acts like a table and you should be able:

1. Select items to it
2. Items in it auto update like first part of this post
3. Remove items from it
__________________

Last edited by Neuro Toxin; 07-01-2018 at 07:46.
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-01-2018 , 09:25   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #263

Here is the start I've done.

https://github.com/ntoxin66/Dynamic/...e6339dae6dd438

Let me know your thoughts.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-02-2018 , 00:30   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #264

It's coming together...

https://github.com/ntoxin66/Dynamic/...s/dbscheme.inc
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-02-2018 , 23:52   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #265

I'm making good headway.

Here is an example of usage after really nutting it out.

Code:
// This is a Dynamic instance that holds the data that will be used in the query
Dynamic test = Dynamic();
test.SetString("stringvalue", "a string value");
test.SetInt("intvalue", 666);
test.SetFloat("floatvalue", 666.666666666);
test.SetBool("boolvalue", true);
test.SetString("ID", "STEAMID:XXXXXXXXXXX");

// Create a prepared query
PreparedQuery query = PreparedQuery();
query.CompileQuery("UPDATE `table` SET `stringvalue`=?, `intvalue`=?, `floatvalue`=?, `boolvalue`=? WHERE `ID`=?");
query.SendQuery(test, "default");

// Always clean up after yourself
test.Dispose();
query.Dispose();
https://github.com/ntoxin66/Dynamic/...paredquery.inc
__________________
Neuro Toxin is offline
popey456963
Member
Join Date: Mar 2016
Old 07-03-2018 , 09:05   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #266

Woah, that was impressively quick, I was travelling all of the previous days so hadn't even started.

Looks amazing! Testing it out today with in a real world scenario.

EDIT: Just realised there's no way to unserialise at the moment, so may hold off on it until that's a thing.

Last edited by popey456963; 07-03-2018 at 09:24.
popey456963 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-03-2018 , 18:23   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #267

I haven't finished it yet. It's close.

What do you mean by unserialise?
__________________

Last edited by Neuro Toxin; 07-03-2018 at 18:23.
Neuro Toxin is offline
popey456963
Member
Join Date: Mar 2016
Old 07-07-2018 , 08:10   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #268

I meant to go from a saved DB entry to a dynamic. As far as I can see this isn't possible yet?
popey456963 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-07-2018 , 20:24   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #269

I've completed updating Dynamic instances.

Code:
	char error[128];
	Database db = SQLite_UseDatabase("dynamictest", error, sizeof(error));

	test.SetString("stringvalue", "a string value 'which needs to be escaped'.", 64);
	test.SetInt("intvalue", 666);
	test.SetFloat("floatvalue", 666.666666666);
	test.SetBool("boolvalue", true);
	test.SetString("ID", "STEAMID:1234567890", 24);

	PreparedQuery query = PreparedQuery();
	query.Compile("UPDATE `table` SET `stringvalue`=?, `intvalue`=?, `floatvalue`=?, `boolvalue`=? WHERE `ID`=?");
	query.Execute(db, test);
	query.Dispose();


	db = null;
	return true;
Here is the .Execute prototype.

Code:
public bool Execute(Database db, Dynamic parameters, SQLQueryCallback callback=INVALID_FUNCTION, any data=0, int buffersize=512)
Callback is the 3rd parameter. When left as INVALID_FUNCTION Dynamic calls an internal callback to keep it threaded.
__________________

Last edited by Neuro Toxin; 07-07-2018 at 20:25.
Neuro Toxin is offline
popey456963
Member
Join Date: Mar 2016
Old 07-22-2018 , 17:49   Re: Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]
Reply With Quote #270

In the Methodmap example (2.0 on the Wiki), would you have to destroy the Dynamic object when the methodmap is no longer intended to be removed? Or, since it's attached to that object, do you no longer have to destroy it?
popey456963 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode