pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql.pike:505:
big_query("ROLLBACK"); big_query("RESET ALL"); big_query("CLOSE ALL"); big_query("DISCARD TEMP"); } private void resync_cb() { switch (proxy.backendstatus) { case 'T':case 'E': foreach (proxy.prepareds; ; mapping tp) {
-
m_delete(tp,"datatypeoid");
-
m_delete(tp,"datarowdesc");
-
m_delete(tp,"datarowtypes");
+
m_delete(tp,
"datatypeoid");
+
m_delete(tp,
"datarowdesc");
+
m_delete(tp,
"datarowtypes");
} Thread.Thread(reset_dbsession); // Urgently and deadlockfree } } //! Resyncs the database session; typically used to make sure the session is //! not still in a dangling transaction. //! //! If called while the connection is in idle state, the function is //! lightweight and briefly touches base with the database server to
pike.git/lib/modules/Sql.pmod/pgsql.pike:694:
waitauthready(); return DRIVERNAME"/" + (proxy.runtimeparameter.server_version || "unknown"); } //! @returns //! An array of the databases available on the server. //! //! @param glob //! If specified, list only those databases matching it. /*semi*/final array(string) list_dbs (void|string glob) {
-
array row, ret =
.pgsql_util.emptyarray
;
+
array row, ret =
({})
;
.pgsql_util.Result res=big_query("SELECT d.datname " "FROM pg_database d " "WHERE d.datname ILIKE :glob " "ORDER BY d.datname", ([":glob":glob2reg(glob)])); while(row = res->fetch_row()) ret += ({row[0]}); return ret; } //! @returns //! An array containing the names of all the tables and views in the //! path in the currently selected database. //! //! @param glob //! If specified, list only the tables with matching names. /*semi*/final array(string) list_tables (void|string glob) {
-
array row, ret =
.pgsql_util.emptyarray
;
+
array row, ret =
({})
;
.pgsql_util.Result res = big_query( // due to missing schemasupport // This query might not work on PostgreSQL 7.4 "SELECT CASE WHEN 'public'=n.nspname THEN '' ELSE n.nspname||'.' END " " ||c.relname AS name " "FROM pg_catalog.pg_class c " " LEFT JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace " "WHERE c.relkind IN ('r','v') AND n.nspname<>'pg_catalog' " " AND n.nspname !~ '^pg_toast' AND pg_catalog.pg_table_is_visible(c.oid) " " AND c.relname ILIKE :glob " " ORDER BY 1",
pike.git/lib/modules/Sql.pmod/pgsql.pike:771:
//! If the table has any indices //! @member int "has_primarykey" //! If the table has a primary key //! @endmapping //! //! @param glob //! If specified, list only the tables with matching names. //! Setting it to @expr{*@} will include system columns in the list. /*semi*/final array(mapping(string:mixed)) list_fields(void|string table, void|string glob) {
-
array row, ret =
.pgsql_util.emptyarray
;
+
array row, ret =
({})
;
string schema; sscanf(table||"*", "%s.%s", schema, table); .pgsql_util.Result res = big_typed_query( "SELECT a.attname, a.atttypid, t.typname, a.attlen, " " c.relhasindex, c.relhaspkey, CAST(c.reltuples AS BIGINT) AS reltuples, " " (c.relpages " " +COALESCE( " " (SELECT SUM(tst.relpages) "
pike.git/lib/modules/Sql.pmod/pgsql.pike:1058:
break; default: if (String.width(q) > 8) ERROR("Don't know how to convert %O to %s encoding\n", q, cenc); } array(string|int) paramValues; array from; if (bindings) { if (forcetext) q = .sql_util.emulate_bindings(q, bindings, this),
-
paramValues =
.pgsql_util.emptyarray
;
+
paramValues =
({})
;
else { int pi = 0; paramValues = allocate(sizeof(bindings)); from = allocate(sizeof(bindings)); array(string) litfrom, litto, to = allocate(sizeof(bindings));
-
litfrom = litto =
.pgsql_util.emptyarray
;
+
litfrom =
({});
litto =
({})
;
foreach (bindings; mixed name; mixed value) { if (stringp(name)) { // Throws if mapping key is empty string if (name[0] != ':') name = ":" + name; if (name[1] == '_') { // Special option parameter switch(name) { case ":_cache": forcecache = (int)value; break; case ":_text":
pike.git/lib/modules/Sql.pmod/pgsql.pike:1099:
} else { paramValues[pi] = value; to[pi] = sprintf("$%d", pi + 1); from[pi++] = name; } } if (pi--) { paramValues = paramValues[.. pi]; q = replace(q, litfrom += from = from[.. pi], litto += to = to[.. pi]); } else {
-
paramValues =
.pgsql_util.emptyarray
;
+
paramValues =
({})
;
if (sizeof(litfrom)) q = replace(q, litfrom, litto); } from = ({from, to, paramValues}); } } else
-
paramValues =
.pgsql_util.emptyarray
;
+
paramValues =
({})
;
if (String.width(q) > 8) ERROR("Wide string literals in %O not supported\n", q); if (has_value(q, "\0")) ERROR("Querystring %O contains invalid literal nul-characters\n", q); mapping(string:mixed) tp; /* * FIXME What happens with regards to this detection when presented with * multistatement text-queries? * The primary function of this detection is to ensure a SYNC * right after a COMMIT, and no SYNC after a BEGIN.