Using Project and C/C++ API - getting First Chance exception ... - Datatype misalignment error

Hi,

I'm creating a UL application using the C/C++ API.
I created a project in Sybase Central and typed in the following SQL
statement.

select UPrice, ItemDesc from Inventory where SKU = ?

SKU, UPrice and ItemDesc are varchar types (different lengths for each).

I run ulgen and get the .cpp, .hpp and .h files using the string below.
'ulgen -c "dsn=BDC" -t c++ -j Inventory -u InventoryPubAPI -f InventoryAPI'

All looks good until I try to open the Record set.

-----
  int nlength = cs_ItemSKU.GetLength();
  if ( GetDPSQL.Open( &ULConn_conn, cs_ItemSKU.GetBuffer( nlength ) ) )
-----
where cs_ItemSKU is a CString type and GetDPSQL is the ULRecordSet type.

Doing a debug-step through shows that the error occurs in the Sybase
generated code:
-------
bool GetDescAndPrice::Open( ULConnection* conn,
    ul_char * Input1 )
{
    ((SQLDA  *)&_in_sqlda)->sqlvar[0].sqldata = (void *)Input1;
    ((SQLDA  *)&_in_sqlda)->sqlvar[0].sqlind = (short int *)((UL_NULL));
    if( IsOpen() ) {
 return ul_false;
    }
    if( !checkParameters() ) {
 return ul_false;
    }
    _cinfo = ulpp_open_GetDescAndPrice( (conn)->GetCA(),
((SQLDA*)&_in_sqlda) );
.....
-----
The last line is where the program throws a 'First Change Exception ....
Datatype misalignment error' message.

In my own code I tried replacing the second parameter in the Open method
with a simple 'UL_TEXT("100")'.
But that didn't do anything different...same error.

I'm stuck as to what I should do next to solve this problem.
Thanks.






0
Thomas
8/12/2002 6:06:58 PM
sybase.sqlanywhere.ultralite 2982 articles. 0 followers. Follow

1 Replies
928 Views

Similar Articles

[PageSpeed] 42
Get it on Google Play
Get it on Apple App Store

Please always include the version and MORE importantly the BUILD number for
each post (ie 8.0.1.3023  dbeng8 -v shows you this).

Can you try something for me.

>   if ( GetDPSQL.Open( &ULConn_conn, cs_ItemSKU.GetBuffer( nlength ) ) )

Create a char and copy the SKU into it, and then pass it to the method.

char sku[20]
strcpy (...)
>   if ( GetDPSQL.Open( &ULConn_conn, sku ) )


--
David Fishburn
NEW - Certified ASA Developer Version 8
Sybase - iAnywhere Solutions
Professional Services
Please only post to the newsgroup

EBFs and Maintenance Releases
http://downloads.sybase.com/swx/sdmain.stm
Developer Community / Whitepapers
http://www.ianywhere.com/developer
CaseXpress - to report bugs
http://casexpress.sybase.com

"Thomas Fujita" <thomas_fujita@apexsi.com> wrote in message
news:4xmdkziQCHA.298@forums.sybase.com...
> Hi,
>
> I'm creating a UL application using the C/C++ API.
> I created a project in Sybase Central and typed in the following SQL
> statement.
>
> select UPrice, ItemDesc from Inventory where SKU = ?
>
> SKU, UPrice and ItemDesc are varchar types (different lengths for each).
>
> I run ulgen and get the .cpp, .hpp and .h files using the string below.
> 'ulgen -c "dsn=BDC" -t c++ -j Inventory -u InventoryPubAPI -f
InventoryAPI'
>
> All looks good until I try to open the Record set.
>
> -----
>   int nlength = cs_ItemSKU.GetLength();
>   if ( GetDPSQL.Open( &ULConn_conn, cs_ItemSKU.GetBuffer( nlength ) ) )
> -----
> where cs_ItemSKU is a CString type and GetDPSQL is the ULRecordSet type.
>
> Doing a debug-step through shows that the error occurs in the Sybase
> generated code:
> -------
> bool GetDescAndPrice::Open( ULConnection* conn,
>     ul_char * Input1 )
> {
>     ((SQLDA  *)&_in_sqlda)->sqlvar[0].sqldata = (void *)Input1;
>     ((SQLDA  *)&_in_sqlda)->sqlvar[0].sqlind = (short int *)((UL_NULL));
>     if( IsOpen() ) {
>  return ul_false;
>     }
>     if( !checkParameters() ) {
>  return ul_false;
>     }
>     _cinfo = ulpp_open_GetDescAndPrice( (conn)->GetCA(),
> ((SQLDA*)&_in_sqlda) );
> ....
> -----
> The last line is where the program throws a 'First Change Exception ....
> Datatype misalignment error' message.
>
> In my own code I tried replacing the second parameter in the Open method
> with a simple 'UL_TEXT("100")'.
> But that didn't do anything different...same error.
>
> I'm stuck as to what I should do next to solve this problem.
> Thanks.
>
>
>
>
>
>


0
David
8/19/2002 1:13:02 PM
Reply:

Similar Artilces:

C Components Using Watcom C/C++ Compiler
This is a cryptographically signed message in MIME format. --------------ms2646818B6AC700D6597C3859 Content-Type: multipart/mixed; boundary="------------E0BFC7D7A6CA166C48EDA143" This is a multi-part message in MIME format. --------------E0BFC7D7A6CA166C48EDA143 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Does anyone have an example of C skeleton files and Watcom C/C++ make file to compile and load C components into Jaguar using the Watcom C/C++ compiler/Linker? --------------E0BFC7D7A6CA166C48EDA143 Content-Type: text/x-vcard; ch...

About C and C++
Hello, I will resume it like this: On the criterias of "complexity" and "difficulty", the C and C++ programming languages are more complex and difficult than Object Pascal for example, so since they are more complex and difficult they are likely to create something like a darwinian filter who don't let the weaker humans among us humans to cross or to climb the social ladder, this is why i think that C and C++ do participate to social darwinism, this is why i say that C and C++ are bad. Thank you, Amine Moulay Ramdane. Amine Moulay Ramdane wrote: > He...

C++ or C#
HI, I have still seen that many big companies are still using C++ as their primary language of choice instead of C#. Like IBM stilll prefers C++ over c#. Any reason ???HighOnCodingWanna get high! Well not everybody has the .net framework installed. C++ will work on any platform, c# will not yet because the framework has not been ported to all platforms yet (e.g. mac). Also you have to think of the expense of a large company to retrain ALL its coders to use the new framework. Not exactly practical in the short term David LeggDave Legg Considering that they have a huge c...

C or C++
What's the difference in using C or C++ for ultralite developments?. Novice user. Thank you The ONLY difference is YOUR preference. There is no speed difference between the two. If you are very used to C++ but not used to SQL, then the C++ API maybe a better choice. If you are familiar with SQL, the embedded SQL may make more sense. -- David Fishburn Sybase - iAnywhere Solutions Professional Services Please only post to the newsgroup EBFs and Whitepapers http://www.sybase.com/products/mobilewireless/anywhere/ "Lorenzo Mota" <lorenzomota@aol.com> wro...

Newbie Question: Import C++ DLL and using it in a C++.NET Project
Hi, I am using Microsoft Visual Studio 2005. I am trying to create a C++ application (Win32 project/application) that imports functions from a DLL. The DLL, which I did not create, is a Win32 DLL (that uses MFC in a static library). The DLL .h and .cpp files do not contain any classes. Just functions with __declspec (dllexport).  I think that my problem is that I am very new  to .NET (I am not sure I should post this question in a different form[:'(]). Here is what I have done:I tried creating a new solution and adding the DLL project to it and then building the project (to gen...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

Help me start setting up very old Borland C++ project using C++ Builder
Hi, I am very new to this both C++ and C++ Builder community. My questions may sound silly but they are not to me. I have been assigned to modify a very old project with the code library. I do not have any system/builder information like what compiler and interfaces or any third party assemblies this project incorporated with. All I have is the list of .cpp, .dfm, .obj and .h files. By this list I assumed this project should have been compiled in C++ compiler. So I have downloaded the free Borland C++ compiler and installed it. After setting up the compiler I did try compiling my pro...

What available C/C++ APIs ?
Hello folks, I was wondering how can I query my ASE150 server from within a C/C++ code ? Is there any available API ? Should I consider using common interfaces such As unixODBC, or use a fast direct way ? Please I need some enlightenment on how to go about it, Any hint would be very appreciated. Thanks, Hello, There are two C APIs, CT-Library and DB-Library (known collectively as "Open Client" or the "SDK"). DB-Library is in support only mode meaning that no new features are added to it, Sybase only fixes bugs for it. So it is recommended that all deve...

Link error in VS2005 using component C++ API
First off, is VS2005 supported as a dev environment when developing applications using the C++ Component API for UltraLite? If so, then: The following two lines of code compile and link successfully in EVC++ 4.0: static const ul_char * ConnectionParms = UL_TEXT("DBF=tutcustomer.udb;schema_file=tutcustomer.usm"); ULValue lp(ConnectionParms); The same code, however, gives the following link error in VS2005: Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl ULValue::ULValue(wchar_t const *)" (__imp_??0ULValue@@QAA@...

How to run UNIX commands using C language ( C Language not C# langauge)
I am running Windows XP Professional and I want to run some UNIX commands from C langauge. Commands like semget and someother commands. Is there any tool that I can use with windows XP to run C language and use UNIX commands instead of installing the UNIX operating system. Thanks, HighOnCodingWanna get high! I think installing Linux is the way to go but have you looked at  http://www.cygwin.com?Cygwin is a Linux environment that run on Windows.  Check it out.    It's all over and I'm standin' prettyIn this dust that was a cityIf I could find a souvenier...

Landing c-c-breaking changes that remove c-c-only code from m-c
Thanks to the work that Anne has done on the Encoding Standard specification and the work that Masatoshi Kimura and I have done to progressively implement the specification in Firefox, we are now at a point where there's a whole bunch of internationalization-related dead code in Firefox. The code is still used by mailnews, though. I am not done preparing the removal patches yet, but with my current patch queue I can already get 149 KB off of Android ARMv7 optimized apk size and 138 KB off of Android ARMv7 optimized libxul size. (I'm not sure what sort of size wins are conside...

Landing c-c-breaking changes that remove c-c-only code from m-c
Thanks to the work that Anne has done on the Encoding Standard specification and the work that Masatoshi Kimura and I have done to progressively implement the specification in Firefox, we are now at a point where there's a whole bunch of internationalization-related dead code in Firefox. The code is still used by mailnews, though. I am not done preparing the removal patches yet, but with my current patch queue I can already get 149 KB off of Android ARMv7 optimized apk size and 138 KB off of Android ARMv7 optimized libxul size. (I'm not sure what sort of size wins are conside...

How Can I use the compliers used under Dev-C++ in C++ builder?
How Can I use the compliers (for instance GCC, ...) used under Dev-C++ in C++ builder? In my program,I used boost lambda expression under Dev-C++ due to the fact that C++ builder 2009 do not support such expression. But Dev-C++ do not support RAD(rapid application development). It is hard to establish the common graphic GUI under windows.So I want to use the compliers of Dev-C++ in C++ builder. And I do not know how to manage it. Where can I get the related materials or advices? Can any one with kindness help me? Il Tue, 11 Aug 2009 23:29:59 -0700, lserjt lserjt <> ha scritto:...

Upgrading C/C++ interface using dblib to use ctlib.
Can anyone direct me to good doc, perhaps sample code, etc., dealing with ctlib? I have a C/C++ interface written to dblib that must be upgraded to go against ctlib. Thank you. On Tue, 11 Nov 2003 08:56:30 -0800, wrote: > Can anyone direct me to good doc, perhaps sample code, etc., dealing with > ctlib? I have a C/C++ interface written to dblib that must be upgraded to > go against ctlib. Thank you. There's sample code in .../OCS/samples/ctlibrary. There's also a migration guide (of sorts) in the OCS docs: http://sybooks.sybase.com/onlinebooks/group-cn/c...

Instant C++ C# to C++ Converter
We've just released version 1.0 of the Instant C++ C# to C++ converter.  Instant C++ converts to either C++/CLI (2005) or Managed C++ (2003).Instant C++ converts C# projects, folders, files, and snippets. David Antonwww.tangiblesoftwaresolutions.comInstant C#: VB.NET to C# ConverterInstant VB: C# to VB.NET ConverterInstant C++: C# to C++ ConverterInstant J#: VB.NET to J# ConverterClear VB: Cleans up outdated VB.NET code David Antonhttp://www.tangiblesoftwaresolutions.comConvert VB to C#, C++, or JavaConvert C# to VB, C++, or JavaConvert C++ to C#, VB, or JavaConvert Java to C#, C++, or...

Web resources about - Using Project and C/C++ API - getting First Chance exception ... - Datatype misalignment error - sybase.sqlanywhere.ultralite

Misalignment Among Senior Leaders Led to Current Problems at Porter Novelli
No permanent successors announced for a string of departed execs, but Omnicom bats away rumors that it will fold shop into another unit.

Issues with Equity Misalignment
Q: In our startup we have 4 founders, two of whom are not full time. We’ve all put in a good sum of cash thus far. The two founders with the ...

Deep Misalignment Between Corporate Economic Performance, Shareholder Return and Executive Compensation ...
New study finds deep misalignment between corporate economic performance, shareholder return and executive compensation.

A Misalignment Primer
Using this criteria, a currency is misaligned if s deviates from the μ + p – p* . One difficulty is that μ has to be estimated . Typically, estimates ...

Medicare Blood Money: The Healthcare Industry's Misalignment of Profits and Humane Medical Treatment
Medicare Blood Money: The Healthcare Industry's Misalignment of Profits and Humane Medical Treatment

The Misalignment of Lauryn Hill with the World
Artists sometimes insert presages of early death into their work—Marina Abramovic can’t stop imagining (and staging) her demise—but the grim ...

Andreessen: VC-entrepreneur misalignment is a myth
... along the way, the incentives of both parties should be well aligned – if everyone’s being honest with themselves. Where Andreessen sees misalignment ...

A giant misalignment in a multiple planet system
A long-standing puzzle in the study of exoplanets is the formation of hot Jupiters, gas giant planets that snuggly orbit their host star. To ...

Deep Misalignment Between Corporate Economic Performance, Shareholder Return and Executive Compensation ...
TheBlaze is a news, information and opinion site brought to you by a dedicated team of writers, journalists & video producers. Our goal is to ...

Sight misalignment blamed for errant shell
Sight misalignment blamed for errant shell

Resources last updated: 12/17/2015 2:53:41 PM