psqlscan_int.h File Reference
Include dependency graph for psqlscan_int.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Typedef Documentation
◆ PsqlScanStateData
◆ StackElem
◆ YY_BUFFER_STATE
◆ yyscan_t
Function Documentation
◆ psqlscan_emit()
const char *
txt,
int
len
)
Definition at line 1517 of file psqlscan.l.
1518{
1520
1521 if (
state->safe_encoding)
1523 else
1524 {
1525 /* Gotta do it the hard way */
1526 const char *reference =
state->refline;
1528
1529 reference += (txt -
state->curline);
1530
1531 for (
i = 0;
i <
len;
i++)
1532 {
1534
1535 if (ch == (char) 0xFF)
1538 }
1539 }
1540}
void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
References appendBinaryPQExpBuffer(), appendPQExpBufferChar(), i, and len.
Referenced by psqlscan_escape_variable().
◆ psqlscan_escape_variable()
const char *
txt,
int
len,
)
Definition at line 1585 of file psqlscan.l.
1587{
1588 char *varname;
1590
1591 /* Variable lookup. */
1593 if (
state->callbacks->get_variable)
1594 value =
state->callbacks->get_variable(varname, quote,
1595 state->cb_passthrough);
1596 else
1599
1601 {
1602 /* Emit the suitably-escaped value */
1605 }
1606 else
1607 {
1608 /* Emit original token as-is */
1610 }
1611}
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void psqlscan_emit(PsqlScanState state, const char *txt, int len)
char * psqlscan_extract_substring(PsqlScanState state, const char *txt, int len)
References appendPQExpBufferStr(), free, len, psqlscan_emit(), psqlscan_extract_substring(), and value.
◆ psqlscan_extract_substring()
const char *
txt,
int
len
)
Definition at line 1549 of file psqlscan.l.
1550{
1552
1553 if (
state->safe_encoding)
1554 memcpy(result, txt,
len);
1555 else
1556 {
1557 /* Gotta do it the hard way */
1558 const char *reference =
state->refline;
1560
1561 reference += (txt -
state->curline);
1562
1563 for (
i = 0;
i <
len;
i++)
1564 {
1566
1567 if (ch == (char) 0xFF)
1570 }
1571 }
1573 return result;
1574}
void * pg_malloc(size_t size)
References i, len, and pg_malloc().
Referenced by psqlscan_escape_variable(), and psqlscan_test_variable().
◆ psqlscan_pop_buffer_stack()
◆ psqlscan_prepare_buffer()
const char *
txt,
int
len,
char **
txtcopy
)
Definition at line 1476 of file psqlscan.l.
1478{
1479 char *newtxt;
1480
1481 /* Flex wants two 0円 characters after the actual data */
1483 *txtcopy = newtxt;
1484 newtxt[
len] = newtxt[
len + 1] = YY_END_OF_BUFFER_CHAR;
1485
1486 if (
state->safe_encoding)
1487 memcpy(newtxt, txt,
len);
1488 else
1489 {
1490 /* Gotta do it the hard way */
1492
1494 {
1496
1497 /* first byte should always be okay... */
1500 while (--thislen > 0 &&
i <
len)
1501 newtxt[
i++] = (char) 0xFF;
1502 }
1503 }
1504
1505 return yy_scan_buffer(newtxt,
len + 2,
state->scanner);
1506}
int PQmblen(const char *s, int encoding)
References i, len, pg_malloc(), and PQmblen().
Referenced by psql_scan_setup(), and psqlscan_push_new_buffer().
◆ psqlscan_push_new_buffer()
const char *
newstr,
const char *
varname
)
Definition at line 1374 of file psqlscan.l.
1376{
1378
1380
1381 /*
1382 * In current usage, the passed varname points at the current flex input
1383 * buffer; we must copy it before calling psqlscan_prepare_buffer()
1384 * because that will change the buffer state.
1385 */
1387
1391 if (
state->safe_encoding)
1392 {
1395 }
1396 else
1397 {
1400 }
1402 state->buffer_stack = stackelem;
1403}
char * pg_strdup(const char *in)
YY_BUFFER_STATE psqlscan_prepare_buffer(PsqlScanState state, const char *txt, int len, char **txtcopy)
References StackElem::buf, StackElem::bufstring, StackElem::next, StackElem::origstring, pg_malloc(), pg_strdup(), psqlscan_prepare_buffer(), and StackElem::varname.
◆ psqlscan_select_top_buffer()
◆ psqlscan_test_variable()
const char *
txt,
int
len
)
◆ psqlscan_var_is_current_source()