1. EuCom

Matt, I just wanted to mention that there is a problem in call_interface_ptr(),
actually the problem is really in fptr.e in call_stdcall_proc():

First argument of MediaDet_WriteBitmapBits is
double which is 8 bytes long. call_interface_ptr() expects
that all arguments are 4 bytes long because it uses poke4().
It should use poke() and should take another argument:
params_sizes. We are unable to call function with parameters which are char (=1
byte) for example.
I think that it would be simplest if it would imitate the way Euphoria dll
calling functions work: define_c_func...
As I said I found workround but future people using EuCom will probably get
confused over this.

frame_pos_bytes = atom_to_float64 (frame_pos)
retVal = call_interface_ptr (this, vtbl, MediaDet_WriteBitmapBits,
    -- split double into two atoms.
bytes_to_int (frame_pos_bytes [1..4]) & bytes_to_int (frame_pos_bytes
    [5..8])
    & {dest_width, dest_height, dest_fname_ptr})

new topic     » topic index » view message » categorize

2. Re: EuCom

Tone Škoda wrote:
> 
> Matt, I just wanted to mention that there is a problem in
> call_interface_ptr(),
> actually the problem is really in fptr.e in call_stdcall_proc():
> 
> First argument of MediaDet_WriteBitmapBits is
> double which is 8 bytes long. call_interface_ptr() expects
> that all arguments are 4 bytes long because it uses poke4().
> It should use poke() and should take another argument:
> params_sizes. We are unable to call function with parameters which are char
> (=1 byte)
> for example.
> I think that it would be simplest if it would imitate the way Euphoria dll
> calling
> functions work: define_c_func...
> As I said I found workround but future people using EuCom will probably get
> confused
> over this.
> 
> frame_pos_bytes = atom_to_float64 (frame_pos)
> retVal = call_interface_ptr (this, vtbl, MediaDet_WriteBitmapBits,
>     -- split double into two atoms.
>     bytes_to_int (frame_pos_bytes [1..4]) & bytes_to_int (frame_pos_bytes
>     [5..8])
>     & {dest_width, dest_height, dest_fname_ptr})
> 


Thanks,  I hadn't run into any functions like this before, so I didn't
really consider it.  But I'll think about how to solve this.  I don't
really like duplicating the define_c_* API, because it means I'll have to 
keep track of all that, but it may be the only way.  

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. EuCom

To Matt Lewis,
I wanted to use ADO to access .mdb files because it is simpler and faster
than
ODBC.
With TBROWSE.EXE I generated msado15.ew for file C:\Program Files\Common
Files\System\ado\msado15.dll.
I was really surprised it generated wrapper for me automatically.
I then run program which has only this line:
include msado15.ew
(I copied all include files from EuCom to my program's directory)
and it gives me this Windows error:
"The instruction at ... referenced memory at ... Memory could  not be read
from."
I then tried it with another file, msadox.dll, and it displayed the same
Windows error.
I am using WinXP, EuCom v2.0a.

Matt, if you could fix this bug then EuCom would really be useful!


By the way,
I try to run SHEET.EXW and Interpreter gives me this error:

C:\EUPHORIA\samples\OLD ON CD ALREADY\eucom2a\activex.ew:672 in function
get_ax_obj_ix()
subscript value 0 is out of bounds, reading from a sequence of length 0
    ax_ix = 0

... called from C:\EUPHORIA\samples\OLD ON CD ALREADY\eucom2a\activex.ew:869
in function get_handle_ax()
    ax_ix = 0
    obj_ix = <no value>
    ok = <no value>
    this = <no value>
    pwindow = <no value>
    phwnd = <no value>
    hwnd = <no value>

... called from C:\EUPHORIA\samples\OLD ON CD
ALREADY\eucom2a\activex.ew:1155 in procedure set_visible_ax()
    ax_ix = 0
    visible = 0
    hwnd = <no value>
    ok = <no value>

... called from C:\EUPHORIA\samples\OLD ON CD ALREADY\eucom2a\SHEET.EXW:41


Tone ©koda

new topic     » goto parent     » topic index » view message » categorize

4. Re: EuCom

I'll also need to have Internet Explorer browser control in my program,
that will also require EuCom's help. Anyone done this already?
These things would be easily done
within Visual Basic or Visual C++, so will I have to switch to them?

----- Original Message -----
From: <10963508 at europeonline.com>
To: "EUforum" <EUforum at topica.com>
Subject: EuCom


>
> To Matt Lewis,
> I wanted to use ADO to access .mdb files because it is simpler and faster
> than
> ODBC.
> With TBROWSE.EXE I generated msado15.ew for file C:\Program Files\Common
> Files\System\ado\msado15.dll.
> I was really surprised it generated wrapper for me automatically.
> I then run program which has only this line:
> include msado15.ew
> (I copied all include files from EuCom to my program's directory)
> and it gives me this Windows error:
> "The instruction at ... referenced memory at ... Memory could  not be read
> from."
> I then tried it with another file, msadox.dll, and it displayed the same
> Windows error.
> I am using WinXP, EuCom v2.0a.
>
> Matt, if you could fix this bug then EuCom would really be useful!
>
>
> By the way,
> I try to run SHEET.EXW and Interpreter gives me this error:
>
> C:\EUPHORIA\samples\OLD ON CD ALREADY\eucom2a\activex.ew:672 in function
> get_ax_obj_ix()
> subscript value 0 is out of bounds, reading from a sequence of length 0
>     ax_ix = 0
>
> ... called from C:\EUPHORIA\samples\OLD ON CD
ALREADY\eucom2a\activex.ew:869
> in function get_handle_ax()
>     ax_ix = 0
>     obj_ix = <no value>
>     ok = <no value>
>     this = <no value>
>     pwindow = <no value>
>     phwnd = <no value>
>     hwnd = <no value>
>
> ... called from C:\EUPHORIA\samples\OLD ON CD
> ALREADY\eucom2a\activex.ew:1155 in procedure set_visible_ax()
>     ax_ix = 0
>     visible = 0
>     hwnd = <no value>
>     ok = <no value>
>
> ... called from C:\EUPHORIA\samples\OLD ON CD ALREADY\eucom2a\SHEET.EXW:41
>
>
> Tone ©koda
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: EuCom

So Matt is on holiday I guess.
For anyone intereseted, to use SHEET.EXW you have to first register
sgrid.ocx.
You do that with this:
regsvr32 sgrid.ocx
Jonas, this sheet demo looks same to your control, I'm just interested, why
did you write your own control?
I'll try to debug eucom a little we'll see how succesfull ill be.

----- Original Message -----
From: <10963508 at europeonline.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: EuCom


>
> I'll also need to have Internet Explorer browser control in my program,
> that will also require EuCom's help. Anyone done this already?
> These things would be easily done
> within Visual Basic or Visual C++, so will I have to switch to them?
>
> ----- Original Message -----
> From: <10963508 at europeonline.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, July 13, 2002 10:29 AM
> Subject: EuCom
>
>
> > To Matt Lewis,
> > I wanted to use ADO to access .mdb files because it is simpler and
faster
> > than
> > ODBC.
> > With TBROWSE.EXE I generated msado15.ew for file C:\Program Files\Common
> > Files\System\ado\msado15.dll.
> > I was really surprised it generated wrapper for me automatically.
> > I then run program which has only this line:
> > include msado15.ew
> > (I copied all include files from EuCom to my program's directory)
> > and it gives me this Windows error:
> > "The instruction at ... referenced memory at ... Memory could  not be
read
> > from."
> > I then tried it with another file, msadox.dll, and it displayed the same
> > Windows error.
> > I am using WinXP, EuCom v2.0a.
> >
> > Matt, if you could fix this bug then EuCom would really be useful!
> >
> >
> > By the way,
> > I try to run SHEET.EXW and Interpreter gives me this error:
> >
> > C:\EUPHORIA\samples\OLD ON CD ALREADY\eucom2a\activex.ew:672 in function
> > get_ax_obj_ix()
> > subscript value 0 is out of bounds, reading from a sequence of length 0
> >     ax_ix = 0
> >
> > ... called from C:\EUPHORIA\samples\OLD ON CD
> ALREADY\eucom2a\activex.ew:869
> > in function get_handle_ax()
> >     ax_ix = 0
> >     obj_ix = <no value>
> >     ok = <no value>
> >     this = <no value>
> >     pwindow = <no value>
> >     phwnd = <no value>
> >     hwnd = <no value>
> >
> > ... called from C:\EUPHORIA\samples\OLD ON CD
> > ALREADY\eucom2a\activex.ew:1155 in procedure set_visible_ax()
> >     ax_ix = 0
> >     visible = 0
> >     hwnd = <no value>
> >     ok = <no value>
> >
> > ... called from C:\EUPHORIA\samples\OLD ON CD
ALREADY\eucom2a\SHEET.EXW:41
> >
> >
> > Tone ©koda
> >
> >
>
>
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: EuCom

Thanks, looking forward to see it.
I am using your ODBC library but it's slow for what I'm doing, maybe you'll
have some tips how to speed this up:
I have table with 700 records.
If buffer size is default 2048 it takes 881 seconds (14 minutes!) to update
every record using code below. If I change buffer size to 10240 same code
takes 17.68 seconds! Great imporvement but I noticed hard drive does more
work now.

I have this function to test speed:

procedure test_odbc_speed ()
    atom t1
    object sr_data
    STRING guid

    sr_data = execDirectODBC (H_Fazzt_Conn, "SELECT * FROM
SelectiveReception")
    if not sequence (sr_data) then
        odbcError (-sr_data)
        return
    end if

    puts (1, "start test\n")
    t1 = time ()
    for i = 1 to length (sr_data) do
        guid = sr_data [i] [SR_GUID]
        Void = execDirectODBC (H_Fazzt_Conn,
            "UPDATE SelectiveReception SET Ignore = 2 WHERE (GUID = '" &
guid & "')")
    end for
    ? time () - t1
end procedure



----- Original Message -----
From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, July 15, 2002 1:59 PM
Subject: RE: EuCom


>
>
> > -----Original Message-----
> > From: 10963508 at europeonline.com [mailto:10963508 at europeonline.com]
>
> > To Matt Lewis,
> > I wanted to use ADO to access .mdb files because it is
> > simpler and faster
> > than
> > ODBC.
> > With TBROWSE.EXE I generated msado15.ew for file C:\Program
> > Files\Common
> > Files\System\ado\msado15.dll.
> > I was really surprised it generated wrapper for me automatically.
> > I then run program which has only this line:
> > include msado15.ew
> > (I copied all include files from EuCom to my program's directory)
> > and it gives me this Windows error:
> > "The instruction at ... referenced memory at ... Memory could
> >  not be read
> > from."
> > I then tried it with another file, msadox.dll, and it
> > displayed the same
> > Windows error.
> > I am using WinXP, EuCom v2.0a.
> >
> > Matt, if you could fix this bug then EuCom would really be useful!
>
> Sorry, didn't check my email over the weekend.  I've never tried to wrap
ADO
> before (I've done Access itself, though).  I'll check this out and see
what
> I can come up with.  I'll also look into IE for you.
>
> Matt Lewis
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

7. Re: EuCom

Yes that was just example, in reality I need to go thru every record in
table from first till last and check some fields, and depending on value of
those fields set value of other field in same record. That's all I want to
do. And I can't do it in Euphoria, ODBC API is so complicated it's driving
me nuts :(. Lost whole week trying to figure it out.
MFC wrapps ODBC API with 4000 lines file, that gives you idea how
complicated is ODBC API.
I thought about wrapping MFC dll, but MFC uses C++ classes so how would that
work?

Your example probably wouldn't speed things much up as you said, but using
SQLSetPos with SQL_UPDATE would.
I have this C++ code (below, it's easier in this case to test it in C++) and
it doesn't work, last SQLSetPos() fails. It gets correct data from table,
but it's unable to update it with new data. I followed example and
instructions from MSDN exactly and it still doesn't work :(.

Now I have these options:
- Write this whole part in C++ and make dll out of it (I can't use ADO in
C++(had some problems), so I would need to use MFC, complications again).
- You will fix EuCom and I will use ADO.
    (BTW Eucom crashed with Windows error on WinXP and other computer which
has Win98 installed when I run comtest.exw.)
- Wrap MFC dll?
- Continue to investiagte how to use ODBC API correctly :( :( :(.

void test2 ()
{
    SQLRETURN ret;
    SQLHENV hEnv;
    SQLHDBC hDbc;
    SQLHSTMT hStmt;
    SQLUSMALLINT RowStatusArray[10], Action, RowNum;
    SQLCHAR  NameArray[11][51];
    SQLINTEGER NameLenOrIndArray[11];
    //
    // Connect to database:
    //=>
        SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv);
     SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
     SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc);
        SQLSMALLINT pcbConnStrOut;
        ret = SQLDriverConnect(hDbc,
      NULL,
      (SQLCHAR*)"DSN=EON Files Sorter Test;uid=sa;pwd=;database=EON Files
Sorter Test",
      SQL_NTS,
      (SQLCHAR*)NULL,
      0,
      &pcbConnStrOut,
      (SQLUSMALLINT)SQL_DRIVER_NOPROMPT);
        assert (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO);
        SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt);
    //
    // Prepare some things:
    //=>
        // Set the SQL_ATTR_ROW_BIND_TYPE statement attribute to use
column-wise binding.
        // Declare the rowset size with the SQL_ATTR_ROW_ARRAY_SIZE
statement attribute.
        // Set the SQL_ATTR_ROW_STATUS_PTR statement attribute to point to
the row status
        // array.
        SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, (void
*)SQL_CURSOR_KEYSET_DRIVEN, 0);
        SQLSetStmtAttr(hStmt, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN,
0);
        SQLSetStmtAttr(hStmt, SQL_ATTR_ROW_ARRAY_SIZE, (void *)10, 0);
        SQLSetStmtAttr(hStmt, SQL_ATTR_ROW_STATUS_PTR, RowStatusArray, 0);
        // Bind arrays to the CustID, Name, Address, and Phone columns.
        SQLBindCol(hStmt, 2, SQL_C_CHAR, NameArray, sizeof(NameArray[0]),
NameLenOrIndArray);
    //
    // Get data from database?:
    //=>
        // Execute a statement to retrieve rows from the Customers table.
        ret = SQLExecDirect(hStmt, (unsigned char *)"SELECT * FROM
SelectiveReception", SQL_NTS);
        assert (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO);
        ret = SQLFetchScroll(hStmt, SQL_FETCH_NEXT, 0);
        assert (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO);
    //
    // Update database:
    //=>
        strcpy ((char *)NameArray [0], "new value");
        ret = SQLSetPos(hStmt, 0, SQL_UPDATE, SQL_LOCK_NO_CHANGE);
        assert (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO);
        SQLCloseCursor(hStmt);
}


----- Original Message -----
From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, July 15, 2002 8:04 PM
Subject: RE: EuCom


>
>
> > -----Original Message-----
> > From: Tone 10963508 at europeonline.com [mailto:10963508 at
> > europeonline.com]
>
> > procedure test_odbc_speed ()
> >     atom t1
> >     object sr_data
> >     STRING guid
> >
> >     sr_data = execDirectODBC (H_Fazzt_Conn, "SELECT * FROM
> > SelectiveReception")
> >     if not sequence (sr_data) then
> >         odbcError (-sr_data)
> >         return
> >     end if
> >
> >     puts (1, "start test\n")
> >     t1 = time ()
> >     for i = 1 to length (sr_data) do
> >         guid = sr_data [i] [SR_GUID]
> >         Void = execDirectODBC (H_Fazzt_Conn,
> >             "UPDATE SelectiveReception SET Ignore = 2 WHERE
> > (GUID = '" &
> > guid & "')")
> >     end for
> >     ? time () - t1
> > end procedure
>
> I assume this is just an example, because you could really speed this
query
> up simply by running the query:
>
> "UPDATE SelectiveReception SET Ignore = 2"
>
> There are some more general things you can do to speed up processing.
> Although I never wrote a nice wrapper for it, you'll want to use
> SQLPrepare/SQLExecute for your UPDATE.  It will save time parsing.  You'll
> need to use a parameter (SQLBindParameter) for GUID, and set that each
time.
> I suspect that the total volume of hard drive access isn't really any
> different for either case.
>
> SQLBindParameter allows you to set up a buffer for a parameter and poke
the
> value in.  You don't need to do any sort of parsing each time to run the
> query.  All of the functions and constants should already be declared in
> odbc.ew.  So something like this:
>
> -- start code
> atom hstmt
> hstmt = allocHandleODBC( SQL_HANDLE_STMT, H_Fazzt_Conn )
> atom sql_ptr
> sequence sql
> sql = "UPDATE SelectiveReception SET Ignore = 2 WHERE GUID = ?"
> sql_ptr = allocate_string(sql)
>
> -- the ODBC driver will parse the query here
> VOID = c_func( SQLPrepare, {hstmt,sql_ptr,length(sql)+1})
> free(sql)
>
> -- sr_data is the result of your query
> guid_ptr = allocate_string(sr_data[1][SR_GUID)
> strlen_ptr = allocate(4)
> poke4(strlen_ptr( length( sql ) + 1 )
>
> -- bind guid_ptr to the '?' in the SQL statement
> VOID = c_func(SQLBindParameter,{hstmt,1,SQL_PARAM_INPUT,
>        SQL_C_CHAR,SQL_VARCHAR,length(sql)+1,0,guid_ptr, srtlen_ptr})
>
> for i = 1 to length(sr_data) do
>     -- updates the parameter each time
>     poke(guid_ptr,sr_data[i][SR_GUID)
>     VOID = c_func( SQLExecute,{hstmt})
> end for
>
> -- end sample
>
> You may need to play around with some of the parameters passed to
> SQLBindParameter:
>
> From:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
> bcsqlbindparameter.asp
>
> SQLRETURN SQLBindParameter(
>      SQLHSTMT     StatementHandle,
>      SQLUSMALLINT     ParameterNumber,
>      SQLSMALLINT     InputOutputType,
>      SQLSMALLINT     ValueType,
>      SQLSMALLINT     ParameterType,
>      SQLUINTEGER     ColumnSize,
>      SQLSMALLINT     DecimalDigits,
>      SQLPOINTER     ParameterValuePtr,
>      SQLINTEGER     BufferLength,
>      SQLINTEGER *     StrLen_or_IndPtr);
>
> Matt Lewis
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu