office-gobmx/connectivity
Stephan Bergmann e63e769bd3 Introduce a better mechanism to suppress false loplugin warnings
...by annotating occurrences of false warnings with [-loplugin:<name>] comments
in source files and letting individual plugins opt-in to watch out for such
suppression annotations, rather than maintaining lists of excluded source files
in the individual plugins.  (See the new loplugin::Plugin::suppressWarningsAt.)

Instead of making all calls to loplugin::Plugin::report check for suppression
annotations, the intent is that this check will only be added opt-in to those
places in the plugins that are prone to emitting false warnings.  In general it
is better to have plugins that don't produce false warnings in the first place,
or at least let those warnings be addressed with trivial and harmless source
code modifications, avoiding the need for any suppression mechanism.

As a proof of concept, I have removed the exclude list from
loplugin:redundantfcast and instead annotated the relevant source code.  (And
thereby found that three of the six originally excluded files didn't need to be
excluded any more at all?)

For now, this mechanism looks for comments (both //... and /*...*/, even
documentation-style /**...*/) that overlap the current and/or the preceding
line, because at least for code controlled by clang-format it is often easier to
move comments to a line of their own, preceding the commented code.  Looking
also at the current line (and not only at the preceding one) opens the door for
erroneous over-eager annotation, where an annotation that was meant to address a
false warning on the current line would also silence a potentially true warning
on the following line.  This probably doesn't cause much trouble in practice,
but is up for potential change.

Change-Id: I91ce7a0e5248886a60b471b1a153867f16bb5cea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133365
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-25 18:21:24 +02:00
..
com/sun/star/sdbcx/comp/hsqldb
inc
org/hsqldb/lib
qa
registry
source Introduce a better mechanism to suppress false loplugin warnings 2022-04-25 18:21:24 +02:00
workben
AllLangMoTarget_cnr.mk
Configuration_ado.mk
Configuration_calc.mk
Configuration_dbase.mk
Configuration_evoab.mk
Configuration_firebird.mk
Configuration_flat.mk
Configuration_hsqldb.mk
Configuration_jdbc.mk
Configuration_macab.mk
Configuration_mysql.mk
Configuration_mysql_jdbc.mk
Configuration_odbc.mk
Configuration_postgresql.mk
Configuration_writer.mk
CppunitTest_connectivity_ado.mk
CppunitTest_connectivity_commontools.mk
CppunitTest_connectivity_mysql_test.mk
CppunitTest_connectivity_sharedresources.mk
IwyuFilter_connectivity.yaml
Jar_ConnectivityTools.mk
Jar_sdbc_hsqldb.mk
JunitTest_complex.mk
Library_ado.mk
Library_calc.mk
Library_dbase.mk
Library_dbpool2.mk
Library_dbtools.mk
Library_evoab.mk
Library_file.mk
Library_firebird_sdbc.mk
Library_flat.mk
Library_hsqldb.mk
Library_jdbc.mk
Library_macab1.mk
Library_macabdrv1.mk
Library_mozbootstrap.mk
Library_mysql_jdbc.mk
Library_mysqlc.mk
Library_odbc.mk
Library_postgresql-sdbc-impl.mk
Library_postgresql-sdbc.mk
Library_sdbc2.mk
Library_writer.mk
Makefile
Module_connectivity.mk
Package_postgresql-sdbc.mk
Rdb_postgresql-sdbc.mk
README.md

Database Connectivity

Contains database pieces, drivers, etc.

dbaccess builds UI on top of this.

Testing

PostgreSQL

For testing, use:

podman pull postgres:latest
podman run --name=postgres -e POSTGRES_PASSWORD=foobarbaz -p 127.0.0.1:5432:5432 postgres:latest

In Base, Connect to an existing database, select PostgreSQL:

URL: host=127.0.0.1 port=5432 dbname=postgres
User: postgres
Password: foobarbaz

podman stop postgres
podman rm postgres

In order to test SCRAM authentication, create the container like this:

podman run --name=postgres -e POSTGRES_PASSWORD=foobarbaz -e POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 -e POSTGRES_HOST_AUTH_METHOD=scram-sha-256 -p 127.0.0.1:5432:5432 postgres:latest

MySQL

For mysql_test:

  • The CppunitTest_mysql_test unit test can be used to test the mysqlc library with any versions of mysql or mariadb server of your choice.

  • This test does not run automatically. It can be triggered with setting the environment variable "CONNECTIVITY_TEST_MYSQL_DRIVER".

  • The environment variable should contain a URL of the following format: [user]/[passwd]@sdbc:mysql:mysqlc:[host]:[port]/db_name

  • tl;dr:

    podman pull mariadb/server
    podman run --name=mariadb -e MYSQL_ROOT_PASSWORD=foobarbaz -p 127.0.0.1:3306:3306 mariadb/server
    podman exec -it mariadb /bin/bash -c "echo -e CREATE DATABASE test | /usr/bin/mysql -u root"
    (cd connectivity && make -srj8 CppunitTest_connectivity_mysql_test CONNECTIVITY_TEST_MYSQL_DRIVER="root/foobarbaz@sdbc:mysql:mysqlc:127.0.0.1:3306/test")
    podman stop mariadb
    podman rm mariadb