Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit550de5d

Browse files
author
Byron Nikolaidis
committed
Minor fixes to compile on unix for v6-40-0002
1 parenta75f2d2 commit550de5d

File tree

8 files changed

+149
-137
lines changed

8 files changed

+149
-137
lines changed

‎src/interfaces/odbc/execute.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ RETCODE SQL_API SQLCancel(
372372
staticchar*func="SQLCancel";
373373
StatementClass*stmt= (StatementClass*)hstmt;
374374
RETCODEresult;
375+
#ifdefWIN32
375376
HMODULEhmodule;
376377
FARPROCaddr;
378+
#endif
377379

378380
mylog("%s: entering...\n",func);
379381

‎src/interfaces/odbc/misc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
portion of the registry. You may have to manually add this key.
2727
This logfile is intended for development use, not for an end user!
2828
*/
29-
//#define MY_LOG
29+
#defineMY_LOG
3030

3131

3232
/*Uncomment Q_LOG to compile in the qlog() statements (Communications log, i.e. CommLog).

‎src/interfaces/odbc/options.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636

3737
externGLOBAL_VALUESglobals;
3838

39+
RETCODEset_statement_option(ConnectionClass*conn,
40+
StatementClass*stmt,
41+
UWORDfOption,
42+
UDWORDvParam);
43+
44+
3945

4046
RETCODEset_statement_option(ConnectionClass*conn,
4147
StatementClass*stmt,

‎src/interfaces/odbc/qresult.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ QR_inc_base(QResultClass *self, int base_inc)
7777
/************************************/
7878

7979
QResultClass*
80-
QR_Constructor()
80+
QR_Constructor(void)
8181
{
8282
QResultClass*rv;
8383

‎src/interfaces/odbc/qresult.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct QResultClass_ {
9898
#defineQR_get_status(self)(self->status)
9999

100100
//Core Functions
101-
QResultClass*QR_Constructor();
101+
QResultClass*QR_Constructor(void);
102102
voidQR_Destructor(QResultClass*self);
103103
charQR_read_tuple(QResultClass*self,charbinary);
104104
intQR_next_tuple(QResultClass*self);

‎src/interfaces/odbc/results.c‎

Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -740,139 +740,6 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
740740
}
741741
}
742742

743-
RETCODE
744-
SC_fetch(StatementClass*stmt)
745-
{
746-
staticchar*func="SC_fetch";
747-
QResultClass*res=stmt->result;
748-
intretval,result;
749-
Int2num_cols,lf;
750-
Oidtype;
751-
char*value;
752-
ColumnInfoClass*ci;
753-
// TupleField *tupleField;
754-
755-
stmt->last_fetch_count=0;
756-
ci=QR_get_fields(res);/* the column info */
757-
758-
mylog("manual_result = %d, use_declarefetch = %d\n",stmt->manual_result,globals.use_declarefetch);
759-
760-
if (stmt->manual_result|| !globals.use_declarefetch) {
761-
762-
if (stmt->currTuple >=QR_get_num_tuples(res)-1||
763-
(stmt->options.maxRows>0&&stmt->currTuple==stmt->options.maxRows-1)) {
764-
765-
/*if at the end of the tuples, return "no data found"
766-
and set the cursor past the end of the result set
767-
*/
768-
stmt->currTuple=QR_get_num_tuples(res);
769-
returnSQL_NO_DATA_FOUND;
770-
}
771-
772-
mylog("**** SQLFetch: manual_result\n");
773-
(stmt->currTuple)++;
774-
}
775-
else {
776-
777-
// read from the cache or the physical next tuple
778-
retval=QR_next_tuple(res);
779-
if (retval<0) {
780-
mylog("**** SQLFetch: end_tuples\n");
781-
returnSQL_NO_DATA_FOUND;
782-
}
783-
elseif (retval>0)
784-
(stmt->currTuple)++;// all is well
785-
786-
else {
787-
mylog("SQLFetch: error\n");
788-
stmt->errornumber=STMT_EXEC_ERROR;
789-
stmt->errormsg="Error fetching next row";
790-
SC_log_error(func,"",stmt);
791-
returnSQL_ERROR;
792-
}
793-
}
794-
795-
num_cols=QR_NumResultCols(res);
796-
797-
result=SQL_SUCCESS;
798-
stmt->last_fetch_count=1;
799-
800-
for (lf=0;lf<num_cols;lf++) {
801-
802-
mylog("fetch: cols=%d, lf=%d, stmt = %u, stmt->bindings = %u, buffer[] = %u\n",num_cols,lf,stmt,stmt->bindings,stmt->bindings[lf].buffer);
803-
804-
/*reset for SQLGetData */
805-
stmt->bindings[lf].data_left=-1;
806-
807-
if (stmt->bindings[lf].buffer!=NULL) {
808-
// this column has a binding
809-
810-
// type = QR_get_field_type(res, lf);
811-
type=CI_get_oid(ci,lf);/* speed things up */
812-
813-
mylog("type = %d\n",type);
814-
815-
if (stmt->manual_result) {
816-
value=QR_get_value_manual(res,stmt->currTuple,lf);
817-
mylog("manual_result\n");
818-
}
819-
elseif (globals.use_declarefetch)
820-
value=QR_get_value_backend(res,lf);
821-
else {
822-
value=QR_get_value_backend_row(res,stmt->currTuple,lf);
823-
}
824-
825-
mylog("value = '%s'\n", (value==NULL)?"<NULL>":value);
826-
827-
retval=copy_and_convert_field_bindinfo(stmt,type,value,lf);
828-
829-
mylog("copy_and_convert: retval = %d\n",retval);
830-
831-
switch(retval) {
832-
caseCOPY_OK:
833-
break;/*OK, do next bound column */
834-
835-
caseCOPY_UNSUPPORTED_TYPE:
836-
stmt->errormsg="Received an unsupported type from Postgres.";
837-
stmt->errornumber=STMT_RESTRICTED_DATA_TYPE_ERROR;
838-
SC_log_error(func,"",stmt);
839-
result=SQL_ERROR;
840-
break;
841-
842-
caseCOPY_UNSUPPORTED_CONVERSION:
843-
stmt->errormsg="Couldn't handle the necessary data type conversion.";
844-
stmt->errornumber=STMT_RESTRICTED_DATA_TYPE_ERROR;
845-
SC_log_error(func,"",stmt);
846-
result=SQL_ERROR;
847-
break;
848-
849-
caseCOPY_RESULT_TRUNCATED:
850-
stmt->errornumber=STMT_TRUNCATED;
851-
stmt->errormsg="The buffer was too small for the result.";
852-
result=SQL_SUCCESS_WITH_INFO;
853-
break;
854-
855-
caseCOPY_GENERAL_ERROR:/* error msg already filled in */
856-
SC_log_error(func,"",stmt);
857-
result=SQL_ERROR;
858-
break;
859-
860-
/* This would not be meaningful in SQLFetch. */
861-
caseCOPY_NO_DATA_FOUND:
862-
break;
863-
864-
default:
865-
stmt->errormsg="Unrecognized return value from copy_and_convert_field.";
866-
stmt->errornumber=STMT_INTERNAL_ERROR;
867-
SC_log_error(func,"",stmt);
868-
result=SQL_ERROR;
869-
break;
870-
}
871-
}
872-
}
873-
874-
returnresult;
875-
}
876743

877744

878745
// Returns data for bound columns in the current row ("hstmt->iCursor"),

‎src/interfaces/odbc/statement.c‎

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,142 @@ char rv;
566566
returnrv;
567567
}
568568

569+
570+
RETCODE
571+
SC_fetch(StatementClass*self)
572+
{
573+
staticchar*func="SC_fetch";
574+
QResultClass*res=self->result;
575+
intretval,result;
576+
Int2num_cols,lf;
577+
Oidtype;
578+
char*value;
579+
ColumnInfoClass*ci;
580+
// TupleField *tupleField;
581+
582+
self->last_fetch_count=0;
583+
ci=QR_get_fields(res);/* the column info */
584+
585+
mylog("manual_result = %d, use_declarefetch = %d\n",self->manual_result,globals.use_declarefetch);
586+
587+
if (self->manual_result|| !globals.use_declarefetch) {
588+
589+
if (self->currTuple >=QR_get_num_tuples(res)-1||
590+
(self->options.maxRows>0&&self->currTuple==self->options.maxRows-1)) {
591+
592+
/*if at the end of the tuples, return "no data found"
593+
and set the cursor past the end of the result set
594+
*/
595+
self->currTuple=QR_get_num_tuples(res);
596+
returnSQL_NO_DATA_FOUND;
597+
}
598+
599+
mylog("**** SQLFetch: manual_result\n");
600+
(self->currTuple)++;
601+
}
602+
else {
603+
604+
// read from the cache or the physical next tuple
605+
retval=QR_next_tuple(res);
606+
if (retval<0) {
607+
mylog("**** SQLFetch: end_tuples\n");
608+
returnSQL_NO_DATA_FOUND;
609+
}
610+
elseif (retval>0)
611+
(self->currTuple)++;// all is well
612+
613+
else {
614+
mylog("SQLFetch: error\n");
615+
self->errornumber=STMT_EXEC_ERROR;
616+
self->errormsg="Error fetching next row";
617+
SC_log_error(func,"",self);
618+
returnSQL_ERROR;
619+
}
620+
}
621+
622+
num_cols=QR_NumResultCols(res);
623+
624+
result=SQL_SUCCESS;
625+
self->last_fetch_count=1;
626+
627+
for (lf=0;lf<num_cols;lf++) {
628+
629+
mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n",num_cols,lf,self,self->bindings,self->bindings[lf].buffer);
630+
631+
/*reset for SQLGetData */
632+
self->bindings[lf].data_left=-1;
633+
634+
if (self->bindings[lf].buffer!=NULL) {
635+
// this column has a binding
636+
637+
// type = QR_get_field_type(res, lf);
638+
type=CI_get_oid(ci,lf);/* speed things up */
639+
640+
mylog("type = %d\n",type);
641+
642+
if (self->manual_result) {
643+
value=QR_get_value_manual(res,self->currTuple,lf);
644+
mylog("manual_result\n");
645+
}
646+
elseif (globals.use_declarefetch)
647+
value=QR_get_value_backend(res,lf);
648+
else {
649+
value=QR_get_value_backend_row(res,self->currTuple,lf);
650+
}
651+
652+
mylog("value = '%s'\n", (value==NULL)?"<NULL>":value);
653+
654+
retval=copy_and_convert_field_bindinfo(self,type,value,lf);
655+
656+
mylog("copy_and_convert: retval = %d\n",retval);
657+
658+
switch(retval) {
659+
caseCOPY_OK:
660+
break;/*OK, do next bound column */
661+
662+
caseCOPY_UNSUPPORTED_TYPE:
663+
self->errormsg="Received an unsupported type from Postgres.";
664+
self->errornumber=STMT_RESTRICTED_DATA_TYPE_ERROR;
665+
SC_log_error(func,"",self);
666+
result=SQL_ERROR;
667+
break;
668+
669+
caseCOPY_UNSUPPORTED_CONVERSION:
670+
self->errormsg="Couldn't handle the necessary data type conversion.";
671+
self->errornumber=STMT_RESTRICTED_DATA_TYPE_ERROR;
672+
SC_log_error(func,"",self);
673+
result=SQL_ERROR;
674+
break;
675+
676+
caseCOPY_RESULT_TRUNCATED:
677+
self->errornumber=STMT_TRUNCATED;
678+
self->errormsg="The buffer was too small for the result.";
679+
result=SQL_SUCCESS_WITH_INFO;
680+
break;
681+
682+
caseCOPY_GENERAL_ERROR:/* error msg already filled in */
683+
SC_log_error(func,"",self);
684+
result=SQL_ERROR;
685+
break;
686+
687+
/* This would not be meaningful in SQLFetch. */
688+
caseCOPY_NO_DATA_FOUND:
689+
break;
690+
691+
default:
692+
self->errormsg="Unrecognized return value from copy_and_convert_field.";
693+
self->errornumber=STMT_INTERNAL_ERROR;
694+
SC_log_error(func,"",self);
695+
result=SQL_ERROR;
696+
break;
697+
}
698+
}
699+
}
700+
701+
returnresult;
702+
}
703+
704+
569705
RETCODESC_execute(StatementClass*self)
570706
{
571707
staticchar*func="SC_execute";

‎src/interfaces/odbc/statement.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ char SC_recycle_statement(StatementClass *self);
202202
voidSC_clear_error(StatementClass*self);
203203
charSC_get_error(StatementClass*self,int*number,char**message);
204204
char*SC_create_errormsg(StatementClass*self);
205-
RETCODESC_execute(StatementClass*stmt);
205+
RETCODESC_execute(StatementClass*self);
206+
RETCODESC_fetch(StatementClass*self);
206207
voidSC_free_params(StatementClass*self,charoption);
207208
voidSC_log_error(char*func,char*desc,StatementClass*self);
208209

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp