insert command fail via CTlib in C 
Author Message
 insert command fail via CTlib in C

Hi !

First of all, it would have been much better if you also had
incl. your error message ! :-)

Quote:
> void InsertSQL(char qstr[])

Are you sure qstr is "correct" ?

Quote:
> {
>   CS_COMMAND *cmd;
>   CS_RETCODE    ret, res_type;

>   /**** init the io ****/
>   fflush(stdout);

>   /**** Allocate a command structure. ****/
>   ct_cmd_alloc(dbproc, &cmd);

What about dbproc ? Are you connected ? :-)

If you use InsertSQL many times, inside one transaction/connection
you can save about 15% (time) if you only allocate an command structure
once,
instead of many times in one transaction. (ref Sybase).

Quote:

>   /**** Initiate a language command. ****/
>   ct_command(cmd, CS_LANG_CMD, qstr, CS_NULLTERM, CS_UNUSED);

To make sure qstr has nothing to do with it, test it like this:

Quote:
>   ct_command(cmd, CS_LANG_CMD, "insert table1 value ......", CS_NULLTERM, CS_UNUSED);
>   /**** Send the command. ****/
>   ct_send(cmd);
>   if ((ret = ct_results(cmd, &res_type))!= CS_SUCCEED)
>   {
>      switch (ret)
>      {
>         case CS_END_RESULT:
>              /**** Everything went fine. ****/
>              break;

>         case CS_FAIL:
>              /**** Something terrible happened. ****/
>              printf("%s\n", qstr);
>              errorhand("ct_results() returned FAIL.");
>              break;

>          default:
>              /**** We got an unexpected return value. ****/
>              errorhand("ct_result returned unexpected return code");
>              break;
>      }
>   }
> }

Else, everything look okey for me ... :-)
but remember to drop the cmd buffer ...

Good luck !
Erlend :-)



Sun, 27 Aug 2000 03:00:00 GMT
 insert command fail via CTlib in C

Hi !

Quote:
> > If you use InsertSQL many times, inside one transaction/connection
> > you can save about 15% (time) if you only allocate an command
> > structure once, instead of many times in one transaction. (ref
> > Sybase).

> Thanks for your help first. Could you please point out where I can
> find the reference about what you said above? Thanks again.

I have got this from a Powerpoint presentation from Sybase
in Norway (in Norwegian ! :-(

From my own experience, insert 1300 rows in 10
different tables, I have experienced 30% ! :-)
Still working on the tuning part ... :-)

But if you realy want improvments, try to use CS_RPC_CMD,
instead of CS_LANG_CMD (20-50% !!) Then you have to use
inexpensive commands like ct_param with stored procedures !!!!
Remember with CS_RPC_CMD, Sybase server don't have to:

PARSE, VALIDATE, COMPILE, OPTIMIZE, PERMISSIONS, EXECUTE

on the comand string (CS_LANG_CMD) !! That takes time !!!

If you have 10.0 CT-Lib files, you can also get 30% more
speed to go over to 11.1-x CT-Lib  files !!! But then you must
have Sybase 11-11.5 !  :-) (Sticky binds, sticky param with 11.x are
something that gives even more speed...) :-))

I have not worked with 11.x CT-Lib, but soone I will.

Have a nice tuning day ! :-)
Erlend :-)



Mon, 28 Aug 2000 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. insert command fail via CTlib in C

2. rcmd command is failing via exec xp_cmdshell

3. SQL Insert command via ASP

4. Insert JPG in SQL via ODBC linked table in Access fails

5. Insert First Row via AddNew Fails Silently

6. SQL command INSERT fails

7. Command batches from CTLIB

8. Actuate to ASA 6.0 via CTLib

9. variable binding for insert/updates in ctlib

10. Inserting multiple rows using ctlib

11. Inserting data into mutliple tables using SQL Insert Command

12. Error inserting records using INSERT-SQL command


 
Powered by phpBB® Forum Software