Home mm2k6 Help Files Commands Database Commands
18 | 03 | 2018
Database Commands

/SQLQuery {SQL Statement}{Array Name}{Database Connect String}{DB User}{DB Password} runs the SQL select against the database and returns two arrays. The result set is stored in an array with each result set column in the array columns and each result set row in an array row. The second array named with Columns appended to the name lists the column names.

/SQLExecute {SQL Statement}{Database Connect String}{DB User}{DB Password} runs the provided statement against the database. This is useful for running insert, update and delete statements but can be used for any kind of statement where you don't require a return.

/ArrayDBSave {ArrayName}{Database Connect String}{DB User}{DB Password} saves the named array in a database table called Array which must have columns of ArrayName,singleDimension,RowNumber, ColumnNumber,ElementText. At present ElementText can be up to 10255 characters long.

/ArrayDBRead {ArrayName}{Database Connect String}{DB User}{DB Password} reads the data matching the named array. The array must be defined with the /array command before the read and the dimensions must at least match the data stored.

The Database Connect String controls which database is used. If left out it defaults to using mm2k6Arrays.mdb in the default session folder (pointed to by @sessionpath(). The default case also does not require DB User and DB Password either.

 If you include it the type of database if tries to use is controled by a 3 letter prefix followed by a colon and then the appropriate connect string info.

For text database files it is the path to the folder where the text files are and the Schema.ini file is. For example if these are in your session folder {txt:@sessionpath()} would work. For text files the table name is the text file name so an query example would look like:

/sqlquery {select * from ClanDB.txt where ClanNumber = 21}{clans}{@sessionpath()}

If instead you have a table called clan in the mm2k6Arrays.mdb this would be:

/sqlquery {select * from clan where ClanNumber = 21}{clans}

Prefix DB Type Connect String
txt: Text path to folder with Schema.ini and text files txt:@sessionpath()
dsn any DSN

For System DSN dsn:DSN=myDsn;Uid=myUsername;Pwd=;

For file DSN dsn:FILEDSN=c:\myDsnFile.dsn;Uid=myUsername;Pwd=;

xls Excel

xls:pathIncludingFileName for example
/sqlquery {select * from array}{stuff}{xls:@sessionpath()stuff.xls}
This require the "database" table be a defined name in the spreadsheet

mdb MS Access mdb:pathToMDBfileWithFileName
mys MySql mys:Port=1234;Host=myServerAddress;Database=myDataBase;
mss MS Sqlsever msq:Server=myServerAddress;Database=myDataBase;User ID=myUsername;