News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Caballero's drawer

Started by avcaballero, May 01, 2018, 05:49:40 AM

Previous topic - Next topic

avcaballero

Hello, this days I'm doing some examples on ODBC accesing to db, access and oracle. I have already had success, and now I am rewriting the code to polish it.

The mdb accessing has this look:

>fasm_access
mdb ODBC connection successful
KING    PRESIDENT
BLAKE   MANAGER
CLARK   MANAGER
JONES   MANAGER
FORD    ANALYST
SMITH   CLERK
ALLEN   SALESMAN
WARD    SALESMAN
MARTIN  SALESMAN
TURNER  SALESMAN
JAMES   CLERK
MILLER  CLERK
Disconnect successful


For it, I have made previously a mdb db with the Oracle alike emp table, whose structure is this:

create table emp( 
  empno    number(4,0), 
  ename    varchar2(10), 
  job      varchar2(9), 
  mgr      number(4,0), 
  hiredate date, 
  sal      number(7,2), 
  comm     number(7,2), 
  deptno   number(2,0), 
  constraint pk_emp primary key (empno), 
  constraint fk_deptno foreign key (deptno) references dept (deptno) 
);


Instead of using Microsoft Access, I have used MDB Viewer Plus, that is a free mdb viewer and editing tool. And I have fed it with some data.

I will rewrite then the oracle example.

TimoVJL

As i sometimes use oracle SQORA32.dll directly, i needed a modified odbc32.def files.
May the source be with you

avcaballero

Using the code to access mdb, already more structured, the access to oracle gives me an error, but debugging it goes fine  :rolleyes:. Well, not everything was going to be easy.

avcaballero

You aren't going to believe it  :toothy:  I had fixed some bugs but I have missed an "int 3" in the code to debug it, that's what failed, removed it and everything seems to go right with the Oracle ODBC conn. I have made it in fasm, I'm going to do it also en others compilers.

Well, right, everything is ok now  :thumbsup:

E:\>fasm_oracle
Oracle ODBC connection successful
KING    PRESIDENT
BLAKE   MANAGER
CLARK   MANAGER
JONES   MANAGER
SCOTT   ANALYST
FORD    ANALYST
SMITH   CLERK
ALLEN   SALESMAN
WARD    SALESMAN
MARTIN  SALESMAN
TURNER  SALESMAN
ADAMS   CLERK
JAMES   CLERK
MILLER  CLERK
Disconnect successful


avcaballero

Playing with windows properties I realized some years ago that it could be possible to exchange the title bar place with the windows button places. Up till W7, in W10 I have realized that is not longer possible. Just a curiosity  :bgrin:

I have this code for masm also and c in mi web page. I attached the fasm version that is what I was looking at now.

** Warning. Hitting any button do something like hiding the taskbar and others, hitting the same button again restores the original form.

jj2007


avcaballero

The code is just above the image, also in my webpage

http://abreojosensamblador.epizy.com/?Tarea=6&SubTarea=3#Taskbar

jj2007

Quote from: caballero on December 26, 2020, 10:51:51 PM
The code is just above the image, also in my webpage

http://abreojosensamblador.epizy.com/?Tarea=6&SubTarea=3#Taskbar

"Masm codigo" gives a 404. The attachment above is a standard windows template, it does not cover your taskbar demo.

avcaballero

When the page says "error 404" is because it doesn't find the object linked. In this case, it was my fault, I didn't write the "W" in "TaskWM01.asm". The source attached above is complete, you may drag and drop in the fasm editor and compile with F9, that's all, I just missed the "a.ico" file in the zip that is used in the source. Anyway, it should work the link now in my web page.

avcaballero

I have started (but not completed) the Windows version of Oracle ODBC in fasm.


TimoVJL

For oracle timestampTO_CHAR(HIREDATE,\'DD.MM.YYYY\') AS HireDateor just cut it shorter ?
May the source be with you

jj2007

Quote from: caballero on December 26, 2020, 10:43:57 PM
Playing with windows properties I realized some years ago that it could be possible to exchange the title bar place with the windows button places. Up till W7, in W10 I have realized that is not longer possible. Just a curiosity  :bgrin:

Cute :thumbsup:

But are you sure that subtracting WS_EX_APPWINDOW from the current ex style is the correct way?
        wmBoton06:
          cmp       [vbInvertTitle], 0
          jnz       wmBtn06_01
            mov       [vbInvertTitle], 1
            invoke    SetWindowText, [hBtn7], offset szRetaurarTitle
            mov       eax, [hMiWndStyle]
            sub       eax, WS_EX_APPWINDOW
            invoke    SetWindowLong, [hWnd], GWL_EXSTYLE, eax
            jmp       wmFin
          wmBtn06_01:
            mov       [vbInvertTitle], 0
            invoke    SetWindowText, [hBtn7], offset szInvertirTitle
            invoke    SetWindowLong, [hWnd], GWL_EXSTYLE, [hMiWndStyle]
          jmp       wmFin


This works fine:
GuiParas equ "Press Ctrl T", w160, h100, icon Star, b Turquoise
include \masm32\MasmBasic\Res\MbGui.asm
Event Key
  .if VKey==VK_T
xor rv(GetWindowLong, hWnd_, GWL_EXSTYLE), WS_EX_LAYOUTRTL
invoke SetWindowLong, hWnd_, GWL_EXSTYLE, eax
  .endif
GuiEnd

avcaballero

Hmmm, that's nice, I didn't know WS_EX_LAYOUTRTL = 0x0040 0000h = 100 0000 0000 0000 0000 0000b.  Now it works exchanging places for title bar and W-icons also in W10.  :thumbsup:

The key seems to be in that position of 1.

avcaballero

One more step done. As you already know, to connect to Oracle via ODBC you need a system DSN connection string, a username and a password. Instead of putting it directly in the code, I have created a combobox that I feed with the connection strings already created in the ODBC data manager and a user box and another for the password. When the "Connect" button is pressed, read from there to establish the connection. Once connected, you can disconnect or extract the data and dump it to the listview. In the Fasm program I was doing, I was stucked retrieving the information from the system DSNs to feed the combobox, so I switched to Masm, where I have been successful. The image you see is from the MASM version.

With this, the basic version of the connection to Oracle would almost be there. what would be left to do:
Implement superclass to be able to navigate between text boxes and buttons using tab.
A basic help system indicating what each thing is


This will be the basis for my final goal, which is to make a program that reads from two access files: acc_old, acc_new, and from an oracle database. The structure of the access files replicates the structure of the oracle database. Inside here are some LONG/BLOB fields that hold some code. The acc_new brings news in this code, while acc_old contains the original that helps us to find what specific novelty it brings and implement it in oracle. With the added difficulty that in Oracle you may have made your own changes to this code. And, furthermore, this code is historicized.

Depending on what comes in acc_new I will search acc_old and oracle and download everything to different folders and text files that contain said texts and thus be able to compare them easier from text files.

I am considering the possibility of also generating a mariadb or sqlite database to save all the recovered data, such as the name of the code, who it depends on, and the start and end date of existence, for each of the environments.

If I don't get bored before, I have here for a long time.

avcaballero

I would say that this basic project is already finished. Unfortunately it does not seem to be possible to use the help button with the minimize or maximize buttons in the standard title bar.