Oracle 19c doesnt support "AUTHENTICATION_TYPE" parameter in the SYS_CONTEXT function. What's the alternative now? - oracle19c

Oracle 19c doesn't support AUTHENTICATION_TYPE parameter in the SYS_CONTEXT function. What's the alternative now?
For example:
SELECT SYS_CONTEXT('USERENV', 'AUTHENTICATION_TYPE') FROM DUAL;
This would show result in previous versions like, 12c R2 etc. but, throwing the below error in 19c.
ORA-02003: invalid USERENV parameter

AUTHENTICATION_TYPE was valid in Oracle 10.2 (2005). From Oracle 11g onwards, you can use AUTHENTICATION_METHOD instead. The return values are slightly different, but the functionality is basically the same. Please check the documentation for details.

Related

C++ PostgreSQL Library, describe SQL, without execution

I have asked this question on Github, issue #641, since it seems like a deficiency or an enhancement question.
Most databases (e.g. Oracle, SQL*Server, Sybase, ... ) send back a description of the resultset, even if there are zero rows. I cannot seem to find this in pqxx, nor can I find a way to describe SQL of any kind prior to execution. The only way I have been able to get the SQL metadata is by collection upon the first row retrieved, but this is limited to an actual row being retrieved. If there are zero rows, I have no way to determine the metadata.
Looking at the v15.x code base for libpq (standard C library), I see that psql has a "workaround" for this very problem. In the file src/bin/psql/common.c there is a function called static bool DescribeQuery(const char *query, double *elapsed_msec) (on or about line #1248).
This function has a rather ingenious solution for this very problem. They create an "unnamed" prepared statement, which they do not execute, instead they use the results of that call, which provides the field info, and subsequently query against the pg_catalog for the metadata descriptions (source below).
Unfortunately, the pqxx library doesn't provide enough (that I can tell) to duplicate this functionality. Does anyone have a solution for this problem?
Credit for resolution goes to Jeroen Vermeulen, on the Github issue #641. He suggested that the predicate AND false be added to the query to force a prototype result. By doing this an empty resultset is returned, with the fields available for metadata collection.

C++/MySQL insert syntax issue

I am attempting to build an insert statement within a C++ application to push records to a MariaDB server, but am getting a generic error back from the database citing MySQL syntax errors.
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NSERT INTO test_data (cid,ch1,ch2,ch3,ch4,..' at line1
The code is as follows:
insertString = "INSERT INTO test_data (cid,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11,ch12,ch13,ch14,ch15,ch16,value_type) VALUES ('"+cid;"', '"+di_ch[0];"', '"+di_ch[1];"', '"+di_ch[2];"', '"+di_ch[3];"', '"+di_ch[4];"', '"+di_ch[5];"', '"+di_ch[6];"', '"+di_ch[7];"', '"+di_ch[8];"', '"+di_ch[9];"', '"+di_ch[10];"', '"+di_ch[11];"', '"+di_ch[12];"', '"+di_ch[13];"', '"+di_ch[14];"', '"+di_ch[15];"', '"+value_type;"')";
mysql_query_status=mysql_query(connect,insertString.c_str());
The code wouldn't compile without formatting the values with the "+" and ";" preceding and following the variable reference. It still doesn't quite make sense to me why this is required, but then again, I still need to find a good reference document for using this connector, which would also be appreciated. There is a lot of material on installing, configuring and building the connector and its applications, but not many code examples. Of what I've found, I've read I may need to try using a PreparedStatement next.
Table schema here

How exactly does django 'escape' sql injections with querysets?

After reading a response involving security django provides for sql injections. I am wondering what the docs mean by 'the underlying driver escapes the sql'.
Does this mean, for lack of better word, that the 'database driver' checks the view/wherever the queryset is located for characteristics of the query, and denies 'characteristics' of certain queries?
I understand that this is kind of 'low-level' discussion, but I'm not understanding how underlying mechanisms are preventing this attack, and appreciate any simplified explaination of what is occuring here.
Link to docs
To be precise we are dealing here with parameters escaping.
The django itself does not escape parameters values. It uses the API of the driver that in general looks similar to this (see for example driver for postgres or mysql):
driver.executeQuery(
'select field1 from table_a where field2 = %(field2)s', {'field2': 'some value'}
)
The important thing to note here is that the parameter value (which may be provided by the user and is subject to sql injection) is not embedded into the query itself. The query is passed to the driver with placeholders for parameters values and the list or dict of parameters is passed in addition to that.
Driver then can either construct the SQL query with proper escaped values for parameters or use the API provided by the database itself which is similar in functionality (that is it gets query with placeholders and parameters values).
Django querysets use this approach to generate SQL and that what this piece of documentation is trying to say.

I am migrating my sitecore from sitecore 6.5 to 8.1

I am migrating a website using Sitecore 6.5 to sitecore 8.1
Below is the code written in sitecore 6.5, I need to change to sitecore 8.1 version.
when I used sitecore.analytics 8.1 version, it is showing error.
can some help in getting the issue resolved for the below code
public static int GetPageVisits(ID pageId)
{
return DataAdapterManager.Provider.Sql.ReadOne<int>(CommandText, ReadPageViews, new object[] { "currentItemId", pageId.ToString() });
}
below is the error I am getting...
Error 1 'Sitecore.Analytics.DataAccess.DataAdapterProvider' does not
contain a definition for 'Sql' and no extension method 'Sql' accepting
a first argument of type
'Sitecore.Analytics.DataAccess.DataAdapterProvider' could be found
(are you missing a using directive or an assembly reference?)
Sitecore Analytics API changed in xDB, From your code i can see you are trying to get page visits number, For that you can use the following API
VisitStatistics PageStats = Sitecore.Analytics.Testing.TestManager.GetPageStatistics(Guid, DateTime, DateTime)
Guid parameter is the item ID, the 2 DateTime parameters are for the interval time range you want to get the page statistics for.

Django debug-toolbar wildly inaccurate summary results

I am using django debug-toolbar on django 1.4. The problem is, it gives me incorrect summary results.
For example, on a landing page which produces one query (check to see if the user is logged in). DT says that there are 43 queries taking 17.27ms. However, when I actually click the SQL queries tab, it does show the correct result -- 1 query in 0.47ms.
Is DT incompatible with 1.4 or something, or is there a way to fix this?
It looks like this was a known issue according to github. I recently had exactly the same problem.
https://github.com/django-debug-toolbar/django-debug-toolbar/issues/88
I managed to resolve the issue by simply updating the django-toolbar to the latest version.