Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e48cfacb
Commit
e48cfacb
authored
Jun 28, 2004
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Arrays can be read as arrays or as character strings now.
parent
04ab0cb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+4
-0
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/ecpglib/data.c
+17
-4
src/interfaces/ecpg/test/test4.pgc
src/interfaces/ecpg/test/test4.pgc
+8
-1
No files found.
src/interfaces/ecpg/ChangeLog
View file @
e48cfacb
...
...
@@ -1821,6 +1821,10 @@ Sun Jun 27 13:50:58 CEST 2004
- Variables that are out of scope, were not removed all the time.
- Make a varchar NULL set everything to 0 when not using indicators.
- Synced parser.
Mon Jun 28 11:08:42 CEST 2004
- Arrays can be read as arrays or as character strings now.
- Set pgtypes library version to 1.2.
- Set ecpg version to 3.2.0.
- Set compat library version to 1.2.
...
...
src/interfaces/ecpg/ecpglib/data.c
View file @
e48cfacb
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.2
4 2004/06/27 12:28:39
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.2
5 2004/06/28 11:47:41
meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
...
...
@@ -152,6 +152,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_INT_FORMAT
,
ECPG_SQLSTATE_DATATYPE_MISMATCH
,
pval
);
return
(
false
);
}
pval
=
scan_length
;
}
else
res
=
0L
;
...
...
@@ -184,6 +185,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_UINT_FORMAT
,
ECPG_SQLSTATE_DATATYPE_MISMATCH
,
pval
);
return
(
false
);
}
pval
=
scan_length
;
}
else
ures
=
0L
;
...
...
@@ -216,6 +218,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_INT_FORMAT
,
ECPG_SQLSTATE_DATATYPE_MISMATCH
,
pval
);
return
(
false
);
}
pval
=
scan_length
;
}
else
*
((
long
long
int
*
)
(
var
+
offset
*
act_tuple
))
=
(
long
long
)
0
;
...
...
@@ -233,6 +236,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_UINT_FORMAT
,
ECPG_SQLSTATE_DATATYPE_MISMATCH
,
pval
);
return
(
false
);
}
pval
=
scan_length
;
}
else
*
((
unsigned
long
long
int
*
)
(
var
+
offset
*
act_tuple
))
=
(
long
long
)
0
;
...
...
@@ -258,6 +262,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGraise
(
lineno
,
ECPG_FLOAT_FORMAT
,
ECPG_SQLSTATE_DATATYPE_MISMATCH
,
pval
);
return
(
false
);
}
pval
=
scan_length
;
}
else
dres
=
0
.
0
;
...
...
@@ -312,8 +317,9 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case
ECPGt_char
:
case
ECPGt_unsigned_char
:
if
(
pval
)
{
if
(
varcharsize
==
0
)
if
(
varcharsize
==
0
||
varcharsize
>
strlen
(
pval
)
)
strncpy
((
char
*
)
((
long
)
var
+
offset
*
act_tuple
),
pval
,
strlen
(
pval
)
+
1
);
else
{
...
...
@@ -348,10 +354,12 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
sqlca
->
sqlwarn
[
0
]
=
sqlca
->
sqlwarn
[
1
]
=
'W'
;
}
}
pval
+=
strlen
(
pval
);
}
break
;
case
ECPGt_varchar
:
if
(
pval
)
{
struct
ECPGgeneric_varchar
*
variable
=
(
struct
ECPGgeneric_varchar
*
)
((
long
)
var
+
offset
*
act_tuple
);
...
...
@@ -394,6 +402,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
variable
->
len
=
varcharsize
;
}
}
pval
+=
strlen
(
pval
);
}
break
;
...
...
@@ -433,6 +442,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
return
(
false
);
}
}
pval
=
scan_length
;
}
else
nres
=
PGTYPESnumeric_from_asc
(
"0.0"
,
&
scan_length
);
...
...
@@ -476,6 +486,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
return
(
false
);
}
}
pval
=
scan_length
;
}
else
ires
=
PGTYPESinterval_from_asc
(
"0 seconds"
,
NULL
);
...
...
@@ -517,6 +528,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
}
*
((
date
*
)
(
var
+
offset
*
act_tuple
))
=
ddres
;
pval
=
scan_length
;
}
break
;
...
...
@@ -555,6 +567,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
}
*
((
timestamp
*
)
(
var
+
offset
*
act_tuple
))
=
tres
;
pval
=
scan_length
;
}
break
;
...
...
@@ -571,7 +584,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
++
act_tuple
;
/* set pval to the next entry */
for
(;
string
||
(
*
pval
!=
','
&&
*
pval
!=
'}'
);
++
pval
)
for
(;
string
||
(
*
pval
!=
','
&&
*
pval
!=
'}'
&&
*
pval
!=
'\0'
);
++
pval
)
if
(
*
pval
==
'"'
)
string
=
string
?
false
:
true
;
...
...
@@ -593,7 +606,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
if
(
*
pval
==
' '
)
++
pval
;
}
}
while
(
(
isarray
==
ECPG_ARRAY_ARRAY
&&
*
pval
!=
'}'
)
||
(
isarray
==
ECPG_ARRAY_VECTOR
&&
*
pval
!=
'\0'
));
}
while
(
*
pval
!=
'\0'
&&
((
isarray
==
ECPG_ARRAY_ARRAY
&&
*
pval
!=
'}'
)
||
isarray
==
ECPG_ARRAY_VECTOR
));
return
(
true
);
}
src/interfaces/ecpg/test/test4.pgc
View file @
e48cfacb
...
...
@@ -13,7 +13,7 @@ EXEC SQL BEGIN DECLARE SECTION;
int i = 1;
int *did = &i;
int a[10] = {9,8,7,6,5,4,3,2,1,0};
char text[
10
] = "klmnopqrst";
char text[
25
] = "klmnopqrst";
char *t = (char *)malloc(10);
double f;
bool b = true;
...
...
@@ -64,6 +64,13 @@ EXEC SQL END DECLARE SECTION;
printf("Found text=%10.10s\n", t);
EXEC SQL SELECT a
INTO :text
FROM test
WHERE f = :f;
printf("Found text=%s\n", text);
EXEC SQL DROP TABLE test;
EXEC SQL COMMIT;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment