I need help because I do not know how to make a Tsunami files at run time in Assembler.

:confused: Fernand
Posted on 2003-01-05 22:21:32 by Fernand
Question,

What is Tsunami?
Posted on 2003-01-05 23:04:39 by NaN
Fernand



include C:\...\trm.inc
includelib C:\...\trm.lib

.data
FilePath db "C:\data", 0
P_len dd $ - FilePath
FileDef <- This is where you can set up index key definitions!
....
FD_len dd $ - FileDef

.data ?
TRMudt TRMtype<?>


.code
mov TRMudt.op, Tsu_Create
mov TRMudt.file, 0
mov TRMudt.dataptr, offset FileDef
push FD_len
pop TRMudt.datalen
mov TRMudt.keyptr, offset FilePath
push P_len
pop TRMudt.keylen
mov TRMudt.keyno, 0
invoke trm_udt, offset TRMudt ;Create if not existing


HTH

Register & support Tsunami if you can, They will help in the User Forum
https://www.trm-ug.com/join.htm

Let us know what you're trying to do!

farrier
Posted on 2003-01-06 00:47:51 by farrier
Scronty should know the answer to this too... he's the one who is doing an assembler demo using it....

Hey Phil where are ya buddy, haven't seen ya online lately...

James
Posted on 2003-01-06 06:09:49 by JamesE
Afternoon, Fernand.

Have a look at the CreateDatabase proc in the Masm32 tsunami demo.

All info required is either in the sourcecode for the demo, or in the PDF file for the Tsunami interface system.

For support in its use, there already is a Tsunami Masm32 interface support forum at http://www.trm-ug.com/ .

Cheers,
Scronty
Posted on 2003-01-06 15:19:04 by Scronty
Excuse me ... I am a new programmer in asm and I think that it is the best thing for me to learn the asm.
I want to make a program in database with the help of Stunami..
I read the trm.pdf for the VB and also the TRMDEMO.ASM...
I think that I made a mistake in my last posting, because it was not the answer I attempted to get...

I will try to explain what I want to get ....

How to build a .TSR and interfacing it in the program in asm.

About the TRMDEMO.TSR I mean, the structure of the database I want to create...like ACctNo db 6 dup (?) etc
and how i can call it from my program..

I will contribute to Stunami at the end of this month and I hope that Stunami will make a TRM_M.PDF.

Thank for all your help . I appreciate it Fernand (:confused: )
Posted on 2003-01-07 21:11:52 by Fernand
Afternoon, Fernand.

The TRMDemo application shows you how to do this.

Cheers,
Scronty
Posted on 2003-01-08 04:50:40 by Scronty
Fernand,

As an example, you can use a STRUC to define the layout of your record:



.const

Account_Str STRUCT
acct_num db 10 dup (?) ;account number
cust_num db 10 dup (?) ;customer number
....
Account_Str ends

.data?
;use the struct to define an instance of your record
Account_buf Account_Str <?>
acct_handle HANDLE ?
cust_handle HANDLE ?

.code
;get handle of data entry controls
invoke GetDlgItem, htp, IDC_ACCT_NUM
mov acct_handle, eax
invoke GetDlgItem, htp, IDC_CUST_NUM
mov cust_handle, eax
;Aquire account data from a controls
invoke SendMessage, acct_handle, WM_GETTEXT, sizeof Account_buf.acct_num, ADDR Account_buf.acct_num
invoke SendMessage, cust_handle, WM_GETTEXT, sizeof Account_buf.custt_num, ADDR Account_buf.custt_num
;Open file
mov TRMudt.op, Tsu_Open
push FD_len
pop TRMudt.datalen
mov TRMudt.keyptr, offset FilePath
push FP_len
pop TRMudt.keylen ;length of path
mov TRMudt.keyno, 0 ;Single-User
invoke trm_udt, offset TRMudt ;Open File
;Insert new record
mov TRMudt.op, Tsu_Insert
mov TRMudt.dataptr, offset Account_buf
mov TRMudt.datalen, sizeof Account_buf
invoke trm_udt, offset TRMudt ;Insert Acct File Record
:Close file
mov TRMudt.op, Tsu_Close
invoke trm_udt, offset TRMudt ;Close Acct File




If you use the tools that Scronty has given us--BIG thanks to Scronty--this can be very easy!

Does this help?

BTW, what would a .TSR file be?

Also, what would TRM_M.PDF be? A help file with MASM syntax? If you look at the PowerBasic file it will be trivial to translate.

farrier
Posted on 2003-01-08 05:05:50 by farrier
Thank all for your help
That true the TRMDemo application shows you how to do this.
But when you are a new user of asm it is very difficult for us...

PS A big thank to farrier for your help [:alright:]
Posted on 2003-01-08 09:00:00 by Fernand
Im interested in this data base engine that Scronty has been involved with, but Im still not 100% clear if its free for use in business software or not??

Is there limitations here that im missing?

Thanks.
:NaN:
Posted on 2003-07-20 22:04:40 by NaN
Nevermind, found the "appendix A" in the PDF's ;)

From what i can see this will work well for my needs. Im thinking i might wrap it up into an object with my OOP model. Then i can start dealing with multiple databases with ease...

However, if i understand the rules here. I dont think i will be able to share the source with you, since its not a complete "packaged.exe". An OOP class would only make a wrapper out of it.... someone correct me if im wrong here.

:NaN:
Posted on 2003-07-20 22:32:34 by NaN
NaN,

I've been using Tsunami Record Manager for a small commercial app for about 7 months now and I'm really impressed! If I can help in any way, let me know. I've already made most of the stupid mistakes at least twice! Now I automatically get that little electric shock twinge if I even try to make those same mistakes.

As for distributing your source, I don't think there would be any restriction. The only thing you are allowed to distribute is the TRM.DLL But anyone can download the version 2.5 software, and as long as you use only features in the 2.5 DLL there shouldn't be a problem with anyone modifying your code.

I chose to do things differently than Scronty did. It made things more readable and serviceable for me.

Again, if I can help, let me know.

farrier
Posted on 2003-07-25 21:51:15 by farrier
I will probably take you up on that. ;)

My project is a *big* one. My goal is to devise a project database, for engineering projects at work. The way typical engineering projects go is the Engineer designs the key components (mostly by hand on paper, or in Excel sheets). The CAD drafting team drafts up formal blue prints. Alot of cross reference exists between the drawings and the Excel sheets, however, drafters manually copy and enter these values from hand mark-ups.

This system works, until the project direction shifts, and you have to change a bunch of things. Then your retracing your old steps changing all those text items on a print. Which can take weeks.

I want to devise a way to link AutoCad and Excel together via a master database. I will need to think of unique but simple keys for autocad text entities to hold on to, and i will need to devise look up tables in the data base such that one change in an excel sheet can be looked up, and all drawings affected is automatically changed.

For me this is a big chunk of work. Especially since im very novice in databases. But from what i can tell from this database, it should do the trick... if I get my design layed out just right ;)

Anywho, this is what im up to. If i ask questions later you should at least know the context of what im doing ;)

Thanks for your thoughts..
:alright:
NaN
Posted on 2003-07-26 09:56:13 by NaN
I found more time reciently to give it a deeper look. I gave the PDF a good hard read as well and feel good about most things. However, im still grey on the "concepts" more than i am the programming. Never was a big database person. Im most attracted to this engine simply cause its more api based and less SQL looking :eek:

Can some one cut it clear to me the roll between "Key Indexes", "Keys", "Key Segments", and similar.

All tuts and books talk SQL with tables and keys.. I barely got my head around that ;)

I want a simple database with a few record types: Text / Project / Other. Would this be done with segments? With indexes acting as tables for each?


Here is the basic idea of a database system i want to build:


TextRecord STRUC (Primary Key == Record Unique ID)

DataString db 64 dup ? ; Arbitrary text
DataTypeKey db 16 dup ? ; For another database
DataType dd ? ; For type of other database
DataDrawing dd 16 dup ? ; Drawing name
DataGroup dd ? ; For grouping the specific text into series

TextRecord ENDS



And a supporting record structure for project files:



ProjectRecord STRUC
FileName db 16 dup ?
FileType dd ?
PercentComplete dd ?
ProjectRecord STRUC




In AutoCad, i plan to stuff the Primary Unique ID into the text entities.
When processed, the ID-KEY is used on the master text db, and the record is
gotten directly for the data it is to display in the drawing (DataString).

For other tools, i may want to process these records by their drawing/group,
say the code is "2nd floor offices". If some records have the
datatype code = "FIXTURES", i want to use the DataTypeKey to search a
different database in a different file for fixture records:



FixtureRecord STRUC
Name db 16 dup ? (primary key)
Manufacture db 16 dup ?
Model dd 16 dup ?
Class dd ?
Watts dd ?
Volts dd ?
Lumens dd ?
FixtureRecord ENDS




So with all this, the tool would then itterates through a
group code, checking if this text record refers to a fixture, and then
finding the type of light fixture and summing up the load in watts the
fixuture type is rated for.

I have many other simular ideas for other electrical assets
that appear in drawings. But for now i want to get past go ;)


That being said, how would a knowledged TSunami programmer
set up the database? This is an example of the 'challange' im facing.
In the end i would want (hopefully) specific databases (such as text
records and Project files) in one project data file, and other more
general databases (such as fixture types) to be left outside the
project scope for reuse in other projects.


I know im dumping alot on to you guys reading this. If you can help, i dont need you to burn out showing me code. Pseudo code or similar would be enough to get my head aligned ;) . I just need to know more or less the TSunami calls required to build such a scheme, and the calls to transverse different databases in the above two cases.

As always, thanks for your patience ;)
:alright:
NaN
Posted on 2003-08-11 21:56:11 by NaN
NaN,

You're off to a good start! The important things to consider when designing a system for me are:

1) What information do I need to keep track of,
2) How will I retrieve this info when I need it.

1) will determine how the data structures are defined, and you have started that
2) will determine your use of indexes, keys and key segments.


Can some one cut it clear to me the roll between "Key Indexes", "Keys", "Key Segments", and similar.


Why key segments? For example in one of my files, one of the elements is a SYSTEMTIME structure, and I defined the key as follows:


Location_Str STRUCT
trans_num dd ? ;tracking number
arriv_date SYSTEMTIME <?> ;arrival date and time
locat_num db 25 dup (?) ;location of delivery
operator db 25 dup (?) ;delivery agent
Location_Str ENDS

File defination string


LocFileDef db 1 ;Page Size
db 0 ;Compression
db 5 ;Number of key segments, 4 keys, 5 key segments
;First Key Def
db "TRANSACTION NUMBER "
db 1 ;Key number
pos1 dw 1 ;Segment Positon within record structure
len1 db 4 ;Segment Length
db NO_DUPLICATES or NO_COMPRESSION or BINARY_KEY
;Second Key Def
;2 Segments:
;1) SYSTEMTIME.wYear + SYSTEMTIME.wMonth 4 Bytes
db "ARRIVAL DATE YEAR & MONTH"
db 2 ;KEY NUMBER 2, SEGMENT 1
pos2 dw 1 + 4
len2 db 4
db BINARY_KEY or NO_COMPRESSION or CASE_SENSITIVE
;2) SYSTEMTIME.wDay 2 Bytes
db "ARRIVAL DATE DAY "
db 2 ;KEY NUMBER 2, SEGMENT 2
pos2_1 dw 1 + 4 + 6 ;6 IS OFFSET INTO SYSTEMTIME FOR DAY
len2-1 db 2
db BINARY_KEY or NO_COMPRESSION or CASE_SENSITIVE
;Third Key Def
db "LOCATION "
db 3
pos3 dw 1 + 4 + sizeof SYSTEMTIME
len3 db 25
db NO_COMPRESSION
;Fourth Key Def
db "OPERATOR "
db 4
pos4 dw 5 + sizeof SYSTEMTIME + 25
len4 db 25
db NO_COMPRESSION
LFD_len dd $ - LocFileDef



Key number 2 has 2 segments, since the SYSTEMTIME structure inserts the DayOfWeek between
the month and day. The first segment consists of wYear + wMonth; then segment 2 consists of
wDay. So when I search for a certain date or date range, I use a structure:



Search_date STRUC
SD_Year WORD
SD_Mon WORD
SD_Day WORD
Search_date ENDS


This matches the layout of the key definition for date.

You could also combine two or more data elements to speed a search. You could use 2 segments
to look up a customer.

For example: lastname + first_name

Or: Watts + Volts

to search quickly for a certain combination of data elements.

hth

Ask more questions.

farrier
Posted on 2003-08-12 09:37:06 by farrier
Well on the 4th pass re-reading your reply.. it finaly sank in :alright: ( Me = thick ;) )

Thanks for this, its exactly what i needed. I dont think i have any more questions at the moment, but im sure there will be more. I now have to re-think my design strategy for future considerations, as well any my immediate plans.

Thanks again!
:alright:
NaN
Posted on 2003-08-12 19:29:08 by NaN