Commit graph

133 commits

Author SHA1 Message Date
Alistair Riddoch
b7fdfefbe0 Remove debug output for maintenence queries 2009-04-19 00:40:21 -07:00
Al Riddoch
ebca2d0fed 2009-01-06 Al Riddoch <alriddoch@googlemail.com>
* server/ExternalMind.cpp: Extend the time before nuking player
	  characters to an hour.
2009-01-06 17:22:11 +00:00
Al Riddoch
c075ce7a11 2008-11-18 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Disable purging the database on startup.
2008-11-18 02:36:51 +00:00
Al Riddoch
9ad447d180 2008-11-17 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, common/Database.h: Implement queries required
	  to read entity and properties from the database.
2008-11-17 01:36:24 +00:00
Al Riddoch
f1ba383c4c 2008-11-17 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Fix referrential integrity now that inherited
	  tables are not being used. Removes FIXMEs relating to that and
	  the database maintenance code which have now been fixed.
2008-11-17 00:40:21 +00:00
Al Riddoch
08ef6a1d2b 2008-11-16 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Clean up the formatting of a number of query
	  strings.
2008-11-16 23:45:51 +00:00
Al Riddoch
4b1e4af01f 2008-11-16 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Re-enable referential integrity on relational
	  tables. Clean up the query generation code.

	* server/Persistance.cpp: Correct the table names used for the
	  relation used to store character ownership.
2008-11-16 23:25:34 +00:00
Al Riddoch
a2bd97a1d9 2008-11-16 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Remove the commented out code for handling
	  tables for the obsolete removed persistence system.
2008-11-16 22:51:43 +00:00
Al Riddoch
7abe077c79 2008-11-13 Al Riddoch <alriddoch@googlemail.com>
* common/const.h: Add a constant for the name length limit of
	  rule IDs and property names.

	* common/Database.cpp: Use the name length constant for database
	  fields that will store the name.
2008-11-13 03:27:17 +00:00
Al Riddoch
725e065bec 2008-11-13 Al Riddoch <alriddoch@googlemail.com>
* server/EntityFactory.cpp: Check class names do not violate a
	  32 character limit before installing them, so they never get
	  as far as the database limit.

	* common/Database.cpp: Modify the rules table so it limits
	  the ID to the right size.
2008-11-13 03:13:41 +00:00
Al Riddoch
143d224e24 2008-11-13 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Remove some left over debug output.
2008-11-13 02:17:55 +00:00
Al Riddoch
66f1ce1fc5 2008-11-13 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Change database column types to varchar to make
	  them cheaper to update.
2008-11-13 02:14:02 +00:00
Al Riddoch
6b04cc88d7 2008-11-13 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Actually update the location information,
	  rather than just pretending.
2008-11-13 01:57:47 +00:00
Al Riddoch
585a781ef5 2008-11-13 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Handle things correctly if scheduling an update
	  or insert query while the database is offline. Just ignore it and
	  keep the query queued.
2008-11-13 01:26:16 +00:00
Al Riddoch
0e8a258cfc 2008-11-10 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Fix a problem where existing database tables
	  weren't added to the set for maintenance cycles. This should fix a
	  lot of major performance issues.
2008-11-10 03:04:33 +00:00
Al Riddoch
ebfb5ccbc4 2008-11-04 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Add the new storage tables to those that
	  are vacuumed regularly. Add an index to the name of properties
	  to make them massively more efficient to update.
2008-11-04 00:26:04 +00:00
Al Riddoch
aa39d2c526 2008-09-27 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Add an error check when escaping strings for
	  SQL queries.
2008-09-27 15:36:31 +00:00
Al Riddoch
447081ff9c 2008-09-08 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Add queries which purge the world state on
	  startup to prevent the tables from getting clogged up. Fix the
	  syntax of the query which removes deleted entity rows.
2008-09-08 17:45:36 +00:00
Al Riddoch
aea018b198 2008-09-04 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Expand the query for bootstrapping the world
	  database entry, so it more completely populates the row.
2008-09-04 14:30:01 +00:00
Al Riddoch
a2d9074fb8 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, common/Database.h: Add method to remove
	  entities from the database store. Remove the foreign key index
	  constraint from the LOC column.
2008-09-04 09:33:16 +00:00
Al Riddoch
6ded0c65f7 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Bootstrap the world entry in the entity
	  database table at creation time.
2008-09-03 23:36:50 +00:00
Al Riddoch
15901bc72a 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Fix the SQL syntax when updating properties.
2008-09-03 10:15:09 +00:00
Al Riddoch
adc72a7cec 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Remove debug output.
2008-09-03 00:11:15 +00:00
Al Riddoch
e690fd0b9b 2008-09-02 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Escape strings before inserting them into
	  the database.
2008-09-02 18:31:18 +00:00
Al Riddoch
5e9d6f3e77 2008-08-28 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Add the location data to the database
	  insert query.

	* server/Persistance.cpp: Modify the entity database table so it
	  has the right columns.

	* server/StorageManager.cpp: Correctly check the orientation
	  valid flag before using it.
2008-08-28 10:32:03 +00:00
Al Riddoch
d3f19deda1 2008-08-27 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, common/Database.h: Modify the Entity database
	  functions to include a chunk of text for location data.

	* server/StorageManager.cpp: Implement naive storage of location
	  data to the database.
2008-08-28 09:43:50 +00:00
Al Riddoch
9e864bb6fe 2008-08-24 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Implement updating modified properties.

	* server/StorageManager.cpp: Tweak test properties values
	  so we can tell if one has been updated.
2008-08-24 23:01:32 +00:00
Al Riddoch
3867b2d078 2008-08-24 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp: Return 0 from a function stub that should
	  return something.
2008-08-24 21:58:11 +00:00
Al Riddoch
fb278302b0 2008-08-23 Al Riddoch <alriddoch@googlemail.com>
* common/Property.h: Add helper functions to make it easy and clear
	  to manipulate flags.

	* common/Database.cpp, common/Database.h: Expand the entity database
	  table to include LOC and update sequence number. Implement new
	  functions that insert test entity data into entity and property
	  tables.

	* rulesets/LocatedEntity.h: Add an accessor providing direct access to
	  the properties dictionary for persistence.

	* server/Persistance.cpp: Remove the bounding box chunk from the
	  entity table schema.

	* server/StorageManager.cpp: Implement inserting and updating rows
	  into the Entity and Propertiy tables.
2008-08-23 17:53:43 +00:00
Al Riddoch
2a555e48a1 2008-08-18 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, server/Persistance.cpp: Implement creating
	  table for properties.
2008-08-19 23:45:43 +00:00
Al Riddoch
6e29a1ae8d 2008-08-18 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, server/Persistance.cpp: Adject code to take
	  into account changed return value. Add call to create Entity
	  table, and fix the query string in the implementation.
2008-08-19 22:07:16 +00:00
Al Riddoch
351cb2ef42 2008-08-18 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, common/Database.h: Change the return type
	  of a method to fit the preferred convention. Add an experimental
	  API for new Entity persistence.
2008-08-19 21:43:14 +00:00
Al Riddoch
44a7b3c1cd 2008-04-28 Al Riddoch <alriddoch@googlemail.com>
* common/Database.cpp, common/globals.cpp, common/id.cpp,
	  common/log.cpp, modules/DateTime.cpp, rulesets/Container.h,
	  rulesets/Statistics.h, server/CommListener.cpp,
	  server/CommServer.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp:
	  Add includes required for recent compilers which include less
	  stuff implicitly in standard headers.
2008-04-28 17:26:08 +00:00
Al Riddoch
024752c0dc 2007-12-21 Al Riddoch <alriddoch@zepler.org>
* common/terrain_utils.h, common/Makefile.am: Remove the persistence
	  code used to save terrain data.

	* common/Database.cpp, common/Database.h: Remove the object
	  relational API for persisting entity data, and put the code
	  beyond use.
2007-12-21 16:42:35 +00:00
Al Riddoch
292f16d1ea 2007-12-07 Al Riddoch <alriddoch@zepler.org>
* common/Database.h, common/Database.cpp: Add a new decoder for atlas
	  objects, and use it when getting the full contents of a table
	  full of Atlas data.

	* server/Persistance.cpp, server/Persistance.h: Modify the API
	  for getting the rules table to use atlas objects rather than
	  messages.

	* server/EntityFactory.cpp: Re-enable loading rules from the
	  Database, now that the data is available from the peristence
	  API in the right format.
2007-12-07 17:42:58 +00:00
Al Riddoch
7bf1f62855 2007-12-06 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Remove an assert, and only shutdown the
	  database connection if one currently exists.
2007-12-06 02:49:32 +00:00
Al Riddoch
fcc53b259e 2007-12-05 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Fix the logic for creating per instance
	  databases.
2007-12-05 23:54:22 +00:00
Al Riddoch
a479ebf547 2007-12-05 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp, common/Database.h: Add a new API for
	  attempting to bootstrap an instance database from the master.

	* server/Persistance.h, server/Persistance.cpp: Make some of the
	  functions in the persistence API non-static, so they work
	  more cleanly and consistently. Use the new return codes
	  specified in the config header. If an instance can't get a database
	  connection, use the master database to try and create one.

	* server/server.cpp: Use the persistence code the way it is
	  intended to be used.
2007-12-05 23:40:05 +00:00
Al Riddoch
8026e6ae90 2007-12-05 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp, common/Database.h: Remove the flag specifying
	  that the database should be created at connection time, as we
	  basically can't do this. Make the default database name depend on
	  instance name currently in use.

	* common/accountbase.cpp, tools/cydumprules.cpp, tools/cyloadrules.cpp:
	  Fix code for the change to the database API.
2007-12-05 22:43:46 +00:00
Al Riddoch
0cf37361c3 2007-12-05 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Allow per-instance database configuration.
2007-12-05 01:29:05 +00:00
Al Riddoch
fb998f7426 2007-11-05 Al Riddoch <alriddoch@zepler.org>
* client/client.cpp, common/Database.cpp: Use less verbose function
	  template to read config values.
2007-11-05 19:35:32 +00:00
Al Riddoch
87ecdcad4b 2007-07-30 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/Database.cpp,
	  common/accountbase.cpp, common/system.cpp, rulesets/Character.cpp,
	  rulesets/Motion.cpp, rulesets/Plant.cpp, rulesets/Py_Location.cpp,
	  rulesets/Py_Mind.cpp, rulesets/Py_Operation.cpp,
	  rulesets/Py_Point3D.cpp, rulesets/Py_Statistics.cpp,
	  rulesets/Py_Task.cpp, rulesets/Py_TerrainProperty.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Py_Vector3D.cpp,
	  rulesets/Py_WorldTime.cpp, rulesets/Python_API.cpp,
	  rulesets/TerrainProperty.cpp, server/Admin.cpp,
	  server/CommServer.cpp, server/Connection.cpp,
	  server/EntityFactory.cpp, server/WorldRouter.cpp,
	  tools/cycmd.cpp, tools/cyconvertrules.cpp, tools/cyctrl.cpp:
	  Remove unnecessary () from conditional expressions, where operator
	  binding is clear.
2007-07-30 18:12:50 +00:00
Al Riddoch
e7d031876e 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* common/log.cpp, common/log.h, common/BaseEntity.cpp,
	  common/BaseEntity.h: Switch to taking a C++ string reference rather
	  than a char *, for the rest of the logging and error related
	  calls.

	* common/Database.cpp, common/log.cpp, common/log.h,
	  rulesets/PythonMindScript.cpp, server/Account.cpp,
	  server/Admin.cpp, server/Connection.cpp, server/Player.cpp,
	  tools/cyisoload.cpp: Convert over to using the new API correctly.
2007-07-29 12:22:58 +00:00
Al Riddoch
2069f3dd4c 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* common/log.cpp, common/log.h: Switch to taking a C++ string reference
	  rather than a char *, as it is not really an optimisation, and it
	  makes the code simpler to read and write.

	* client/BaseClient.cpp, client/ClientConnection.cpp,
	  common/AtlasFileLoader.cpp, common/BaseEntity.cpp,
	  common/Database.cpp, common/globals.cpp, common/id.cpp,
	  common/inheritance.cpp, common/log.cpp, common/log.h,
	  rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
	  rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Pedestrian.cpp,
	  rulesets/Py_Object.cpp, rulesets/Py_RootEntity.cpp,
	  rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
	  rulesets/Python_API.cpp, rulesets/Thing.cpp, server/Account.cpp,
	  server/Admin.cpp, server/ArithmeticFactory.cpp,
	  server/CommClient.cpp, server/CommListener.cpp,
	  server/CommMDNSPublisher.cpp, server/CommServer.cpp,
	  server/Connection.cpp, server/EntityFactory.cpp,
	  server/Persistance.cpp, server/Restoration.cpp,
	  server/ScriptFactory.cpp, server/TaskFactory.cpp,
	  server/WorldRouter.cpp, server/server.cpp: Convert over to using
	  new API correctly.

	* data/mason.xml: Add biomass and transient to fircone, making its
	  script obsolete:
2007-07-29 03:33:33 +00:00
Al Riddoch
28f2462b7e 2007-04-02 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Improve error reporting when dealing with
	  persistence tables.
2007-04-01 23:33:06 +00:00
Al Riddoch
c1fde0fd8d 2007-02-20 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Improve the presentation of Database error
	  messages.

	* server/server.cpp: If connecting to the database fails, just
	  disable it, and report plenty of error information.
2007-02-20 01:12:48 +00:00
Al Riddoch
29f3a129e3 2006-12-31 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp: Replace asserts with critical error messages,
	  so tests can run without a Database connection.

	* tests/EntityPropertytest.cpp: Re-write test cases to deal with
	  modified behavoir if the Entity reference is null.
2006-12-31 15:56:35 +00:00
Al Riddoch
dc9a57c92e 2006-12-06 Al Riddoch <alriddoch@zepler.org>
* tests/Databasetest.cpp: Add a unit test for the features of
	  Database that can be checked without an RDBMS to connect to.

	* common/Database.h, common/Database.cpp: Provide a function to
	  cleanup the Database singleton, for easier testing.

	* common/Database.cpp: Assert that the connection to the database
	  has been created before calling any functions in the database
	  client lib using that connection.
2006-12-06 08:11:23 +00:00
Al Riddoch
9a56dac06c 2006-10-26 Al Riddoch <alriddoch@zepler.org>
* Add RCS Id keywords to every file, for better version tracking.
2006-10-26 00:48:00 +00:00
Al Riddoch
a884fa4866 2006-05-06 Al Riddoch <alriddoch@zepler.org>
* common/Database.cpp, common/newid.cpp, server/server.cpp:
	  Modify new ID checks so that code still runs when database is
	  unavailable, and events requiring new IDs fail cleanly.

	* server/Connection.cpp: Report a failure to create a player
	  account if no ID available.

	* rulesets/BaseMind.cpp: When processing appearance ops, handle
	  stamp more efficiently, report an error if ID is missing
	  from argument.

	* server/IdlePSQLConnector.cpp, server/IdlePSQLConnector.h:
	  Implement re-connecting to the Database if connection is lost.

	* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Thing.cpp:
	  Ensure STAMP is present on appearance op args.

	* server/CommListener.cpp, server/CommListener.h,
	  server/CommPeerListener.cpp, server/CommPeerListener.h,
	  server/CommSlaveListener.cpp, server/CommSlaveListener.h,
	  server/CommUnixListener.cpp, server/CommUnixListener.h:
	  Add a return value to method for creating new client socket
	  objects, and use it to return failure if no ID is available
	  from the database for a new object.

	* rulesets/Py_Point3D.cpp, rulesets/Py_Vector3D.cpp,
	  rulesets/Python_API.cpp: Add "new" method for class wrappers, and
	  call the in place constructor from new rather than init. Re-write
	  internal function for creating new instances so it uses the "new"
	  method.

	* rulesets/Py_Statistics.cpp: Remove some obsolete code inadvertedly
	  copied from another file. Comment out some unused code to get rid
	  of a warning.

	* server/CommPSQLSocket.cpp: Clear the database connection from
	  destructor.

	* tests/python_class.cpp: A new test for experimenting with new
	  Python wrappers.
2006-05-06 21:36:57 +00:00