|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jan 17, 2009 12:55 am
Map database , COM connections, Vijilante's toolbox |
This is based off Vijilante's toolbox.
Code: |
#VAR MapCon {%comcreate("ADODB.Connection")}
#CALL @MapCon.Open(%concat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=",%pref(MapFile))) |
obviously no longer works since it's no longer in mdb format. So, what provider should I use? Or more specifically, how can I get this to work?
Charneus |
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Sat Jan 17, 2009 5:48 am |
After integrating access to Sqlite3 using Dharkael's toolkit described here, you can access the map database directly using something like this:
Code: |
#VAR commap %comcreate( "Sqlite.zMUD.wsc")
;;
#CALL %comset( commap, CMUDFormat, 1) //Force returned data as database records.
;;
$sql = "SELECT * FROM [ObjectTbl] WHERE [Name] = ?"
;;
$rec = @commap.Execute($sql,"New Orchard Entrance (G)")
;;
#ECHO %db($rec,Name)
|
This will return the database record for that particular room and it should display the room name in this instance. |
|
_________________ Sic itur ad astra. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jan 17, 2009 6:25 am |
Mmm, you need to use Sqlite. But tools are coming in future versions to allow you to do this sort of thing directly through zScript, without having to call COM, so code with that in mind.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Jan 17, 2009 5:19 pm |
Indeed.. you can also access SQLite via lua using the instructions I describe here.
But when the mapper is rewritten, there'll be many more features for accessing the map DB. Similarly I expect the same thing to occur when Database component is rewritten. |
|
_________________ Asati di tempari! |
|
|
|
|
|