|
1 |
| -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.29 2003/11/29 19:52:08 pgsql Exp $ */ |
| 1 | +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.30 2003/12/03 08:49:17 meskes Exp $ */ |
2 | 2 |
|
3 | 3 | /*
|
4 | 4 | * The aim is to get a simpler inteface to the database routines.
|
@@ -314,16 +314,21 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia
|
314 | 314 | sprintf(array_query,"select typlen from pg_type where oid=%d and typelem<>0",type);
|
315 | 315 | query=PQexec(stmt->connection->connection,array_query);
|
316 | 316 | ECPGfree(array_query);
|
317 |
| -if (PQresultStatus(query)==PGRES_TUPLES_OK) |
| 317 | +if (PQresultStatus(query)==PGRES_TUPLES_OK) |
318 | 318 | {
|
319 |
| -isarray= (atol((char*)PQgetvalue(query,0,0))==-1) ?ECPG_ARRAY_ARRAY :ECPG_ARRAY_VECTOR; |
320 |
| -if (ECPGDynamicType(type)==SQL3_CHARACTER|| |
321 |
| -ECPGDynamicType(type)==SQL3_CHARACTER_VARYING) |
322 |
| -{ |
323 |
| -/* |
324 |
| - * arrays of character strings are not yet implemented |
325 |
| - */ |
| 319 | +if (PQntuples(query)==0 ) |
326 | 320 | isarray=ECPG_ARRAY_NONE;
|
| 321 | +else |
| 322 | +{ |
| 323 | +isarray= (atol((char*)PQgetvalue(query,0,0))==-1) ?ECPG_ARRAY_ARRAY :ECPG_ARRAY_VECTOR; |
| 324 | +if (ECPGDynamicType(type)==SQL3_CHARACTER|| |
| 325 | +ECPGDynamicType(type)==SQL3_CHARACTER_VARYING) |
| 326 | +{ |
| 327 | +/* |
| 328 | + * arrays of character strings are not yet implemented |
| 329 | + */ |
| 330 | +isarray=ECPG_ARRAY_NONE; |
| 331 | +} |
327 | 332 | }
|
328 | 333 | }
|
329 | 334 | PQclear(query);
|
@@ -353,7 +358,7 @@ ECPGstore_result(const PGresult *results, int act_field,
|
353 | 358 | {
|
354 | 359 | ECPGlog("ECPGexecute line %d: Incorrect number of matches: %d don't fit into array of %d\n",
|
355 | 360 | stmt->lineno,ntuples,var->arrsize);
|
356 |
| -ECPGraise(stmt->lineno,ECPG_TOO_MANY_MATCHES,ECPG_SQLSTATE_CARDINALITY_VIOLATION,NULL); |
| 361 | +ECPGraise(stmt->lineno,INFORMIX_MODE(stmt->compat)?ECPG_INFORMIX_SUBSELECT_NOT_ONE:ECPG_TOO_MANY_MATCHES,ECPG_SQLSTATE_CARDINALITY_VIOLATION,NULL); |
357 | 362 | return false;
|
358 | 363 | }
|
359 | 364 | }
|
|