API-functions in SQLWNTM.DLL and their parameters

Discussions specific to Team Developer 5.1.

API-functions in SQLWNTM.DLL and their parameters

Postby Tommes110 » Tue Mar 25, 2008 7:21 am

Hi all together,
changing from TD 2.1 to TD 5.1 causes following problem:
I can not unlod specific Tables anymore. I use the function sqlunl from the sqlwntm.dll.
Looking a little bit closer, i found additional funktions like sqlunlA and sqlunlW.
But no documentation about their parameters.

Can anyone help me??

Thanks in advance
Tommes110
 
Posts: 11
Joined: Tue Feb 19, 2008 2:10 am

Re: API-functions in SQLWNTM.DLL and their parameters

Postby Jeff Luther » Tue Mar 25, 2008 2:22 pm

My guess is the parameters didn't change at all. The "A" version is simply the old ANSI single-char version; the "W" is the wide-char, double-char version. Welcome to UNICODE!

As to which to use, not sure. As you must be calling from v5.1, I'd guess the W version. Try it and see what happens.
Jeff Luther
 

Re: API-functions in SQLWNTM.DLL and their parameters

Postby Tommes110 » Thu Mar 27, 2008 1:22 am

Hi Jeff,
for testing the API Unload I wrote a little sample (see attached file). Under TD 2.1 it works perfectly as under TD5.1 it returns the errorcode 909.
Trying the sqlunlW did not succeed at all.

Any working Ideas??
You do not have the required permissions to view the files attached to this post.
Tommes110
 
Posts: 11
Joined: Tue Feb 19, 2008 2:10 am

Re: API-functions in SQLWNTM.DLL and their parameters

Postby jmgemperle » Fri Mar 28, 2008 3:11 am

Hi,

Yes there is indeed and odd strange problem that I can't really understand why only if you use the ANSI version of sqlunl() and will ask about this...With the "W" wide string version it is fine. Still I can see some issues in you External call definion for sqlunl() and you really need to be carefull about those especially with TD 5.1 because you might have wrong return value I could see that in my test though the UNLOAD was fine :
The prototype of sqlunl() is

---------------------------------------
SQLTAPI sqlunl(cur, cmdp, cmdl)
SQLTCUR cur; /* cursor number */
SQLTDAP cmdp; /* UNLOAD command */
SQLTDAL cmdl; /* length of above command */

typedef unsigned short ubyte2;
typedef unsigned char *ubyte1p;

define SQLTAPI byte2 SBSTDCALL
typedef ubyte2 SQLTCUR;
typedef ubyte1p SQLTDAP;
typedef ubyte2 SQLTDAL;
--------------------------------------------------
So here is the modification I did


Function: sqlunl
Description:
Export Ordinal: 0
Returns
Number: USHORT
Parameters
Number: USHORT
String: LPSTR
Number: USHORT

Function: sqlunlW
Description:
Export Ordinal: 0
Returns
Number: USHORT
Parameters
Number: USHORT
String: LPWSTR
Number: USHORT


So it works with the "W" version but indeed have error 909 when using the ANSI version and when slqunl() as a nested call of SalStrLength( strUnloadCommand ) in its call and not when it is outside??! here are the comment of what I could see


Call VisFileDelete( "ISLAND.UNL" )
! !! NOT OK ERROR 909 RETURNED
Set nError= sqlunl(SqlGetCursor( hSql ) , strUnloadCommand, SalStrLength( strUnloadCommand ) )
Call SalMessageBox( "Fehlercode: " || SalNumberToStrX( nError, 0 ), "Test Unload", MB_Ok|MB_IconAsterisk )
Call SalLoadApp( "notepad.exe", "ISLAND.UNL" )
Call VisFileDelete( "ISLAND.UNL" )
! !!duhhh??? this is ok!!
Set n=SalStrLength( strUnloadCommand )
Set nError= sqlunl(SalWindowHandleToNumber( hSql ), strUnloadCommand, n)
Call SalMessageBox( "Fehlercode: " || SalNumberToStrX( nError, 0 ), "Test Unload", MB_Ok|MB_IconAsterisk )
Call SalLoadApp( "notepad.exe", "ISLAND.UNL" )
Call VisFileDelete( "ISLAND.UNL" )
! !!OK with the "W" version also SalWindowHandleToNumber( hSql ) is OK FYI but I rather would use SqlGetCursor()
Set nError= sqlunlW(SalWindowHandleToNumber( hSql ) , strUnloadCommand, SalStrLength( strUnloadCommand ) )
Call SalMessageBox( "Fehlercode: " || SalNumberToStrX( nError, 0 ), "Test Unload", MB_Ok|MB_IconAsterisk )
Call SalLoadApp( "notepad.exe", "ISLAND.UNL" )
Call VisFileDelete( "ISLAND.UNL" )


Cheers
Jean-Marc
User avatar
jmgemperle
 
Posts: 846
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: API-functions in SQLWNTM.DLL and their parameters

Postby Tommes110 » Mon Mar 31, 2008 11:36 pm

Hi Jean-Marc,
and how is to deal with the Returncode of sqlunlW. In my cases the Returncodes where all higer than 10.000.000. Do i have to ignore these? And still i would like to have a Documentation about the Parameters of the SQLWNTM.DLL.

Thanks a lot
Tommes110
 
Posts: 11
Joined: Tue Feb 19, 2008 2:10 am

Re: API-functions in SQLWNTM.DLL and their parameters

Postby jmgemperle » Fri Apr 04, 2008 4:18 am

Hi,

You can check SQLBASE.H for the prototype of the API parameters or API.PDF in the SQLBASE ONLINE docmentation.
The test I did after modification of your application that I have also upload returns 0 when the unload is SUCCESSFULL, you should not get something different.
Please have look at the attachment I did it should work and return 0.

JM
User avatar
jmgemperle
 
Posts: 846
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: API-functions in SQLWNTM.DLL and their parameters

Postby jmgemperle » Mon May 26, 2008 1:46 am

Hi

I also ran into this issue when checking the problem...In this case parameters were wrongly defined, but I got the issue

TD-4696 :TD 5.1 External function call fails with nested function calls

see also

viewtopic.php?p=3923#p3923

Thanks
JM
User avatar
jmgemperle
 
Posts: 846
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: API-functions in SQLWNTM.DLL and their parameters

Postby jmgemperle » Mon May 26, 2008 8:30 am

Hi Jean-Marc,
and how is to deal with the Returncode of sqlunlW. In my cases the Returncodes where all higer than 10.000.000. Do i have to ignore these? And still i would like to have a Documentation about the Parameters of the SQLWNTM.DLL.

Thanks a lot



Hi,

Sorry should have answered but it is never to late.

With the sqlunlW version it all works fine to me and the return is OK. I guess the reasons you had problem is the definition of the external function call paramerters you used. I used this


Function: sqlunlW
Description:
Export Ordinal: 0
Returns
Number: USHORT
Parameters
Number: USHORT
String: LPWSTR
Number: USHORT

With it no problem and with the SP2.
And still i would like to have a Documentation about the Parameters of the SQLWNTM.DLL.

This is in the DEV.PDF that we provide with the SB CD. We no longer provide it AFAIK with TD 5.1 and don't know the reason for that as we did provide the SB PDF in previous TD version. Non the less you can get it here, painfully slow but it is here

http://support.guptatechnologies.com/Docs/SQLBaseDo ... title.html#964

Also you can check SQLBASE.H.

So about the completness of this thread for me sqlunlW is just fine and sqlunl the ANSI version is TOO AS LONG AS YOU DON'T use nested call in the ANSI external function call, the bug I entered for that thread. If you still have problem with sqlunlW let me know.

Cheers
JM
User avatar
jmgemperle
 
Posts: 846
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: API-functions in SQLWNTM.DLL and their parameters

Postby jmgemperle » Mon May 26, 2008 8:32 am

Sorry meant API.PDF not DEV.PDF that this the TD online manual.

JM
User avatar
jmgemperle
 
Posts: 846
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands


Return to Team Developer 5.1

Who is online

Users browsing this forum: No registered users and 2 guests