This file is indexed.

/usr/include/Wt/Dbo/backend/MySQL is in libwtdbo-dev 3.3.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 *
 * Contributed by: Paul Harrison
 */
#ifndef WT_DBO_BACKEND_MYSQL_H_
#define WT_DBO_BACKEND_MYSQL_H_

#include <Wt/Dbo/SqlConnection>
#include <Wt/Dbo/SqlStatement>
#include <Wt/Dbo/backend/WDboMySQLDllDefs.h>

namespace Wt {
  namespace Dbo {
    namespace backend {

class MySQL_impl;

/*! \class MySQL Wt/Dbo/backend/MySQL
 *  \brief A MySQL connection
 *
 * This class provides the backend implementation for mariadb databases.
 * It has been tested against MySQL 5.6.
 *
 * In order to work properly with Wt::Dbo, MySQL must be configured with
 * InnoDB (for MySQL) or XtraDB (for mariadb) as the default database
 * engine - so that the transaction based functionality works.
 *
 * \note There is a bug in the implementation of milliseconds in mariadb C
 *       client which affects WTime and posix::time_duration values -- it
 *       goes berserk when fractional part = 0.
 *
 * \ingroup dbo
 */
class WTDBOMYSQL_API MySQL : public SqlConnection
{
public:
  /*! \brief Opens a new MySQL backend connection.
   *
   *  \param db The database name.
   *  \param dbuser The username for the database connection -
   *         defaults to "root".
   *  \param dbpasswd The password for the database conection - defaults to an
   *         empty string.
   *  \param dbhost The hostname of the database - defaults to localhost.
   *  \param fractionalSecondsPart Must be in the range 0 to 6. A value
   *         of -1 indicates that the fractional part is not stored.
   *         Fractional seconds part are supported for MySQL 5.6.4
   *         http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
   */
  MySQL(const std::string &db, const std::string &dbuser="root",
        const std::string &dbpasswd="", const std::string dbhost="localhost",
        unsigned int dbport = 0,
        const std::string &dbsocket ="/var/run/mysqld/mysqld.sock",
        int fractionalSecondsPart = -1);

  /*! \brief Copies a MySQL connection.
   *
   * This creates a new connection with the same settings as another
   * connection.
   *
   * \sa clone()
   */
  MySQL(const MySQL& other);

  /*! \brief Destructor.
   *
   * Closes the connection.
   */
  ~MySQL();

  /*! \brief Returns a copy of the connection.
   */
  virtual MySQL *clone() const;

  /*! \brief Tries to connect.
   *
   * Throws an exception if there was a problem, otherwise true.
   */
  bool connect();

  /*! \brief Returns the underlying connection.
   */
  MySQL_impl *connection() { return impl_; }

  virtual void executeSql(const std::string &sql);

  virtual void startTransaction();
  virtual void commitTransaction();
  virtual void rollbackTransaction();

  virtual SqlStatement *prepareStatement(const std::string& sql);

  /** @name Methods that return dialect information
   */
  //@{
  virtual std::string autoincrementSql() const;
  virtual std::string autoincrementType() const;
  virtual std::string autoincrementInsertSuffix() const;
  virtual std::vector<std::string>
    autoincrementCreateSequenceSql(const std::string &table,
                                   const std::string &id) const;
  virtual std::vector<std::string>
    autoincrementDropSequenceSql(const std::string &table,
                                 const std::string &id) const;

  virtual const char *dateTimeType(SqlDateTimeType type) const;
  virtual const char *blobType() const;
  virtual bool supportAlterTable() const;
  virtual const char *alterTableConstraintString() const;
  /*! \brief Returns the supported fractional seconds part
  *
  * By diffault return -1: fractional part are not stored.
  * Fractional seconds part are supported for MySQL 5.6.4
  * http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
  *
  * \sa setFractionalSecondsPart()
  */
  const int getFractionalSecondsPart() const;

  /*! \brief Set the supported fractional seconds part
  *
  *  \param Must be in the range 0 to 6. By diffault return -1: fractional part
  * are not stored.
  *
  * The fractional seconds part can be also set in the constructor
  * Fractional seconds part are supported for MySQL 5.6.4
  * http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
  *
  * \sa setFractionalSecondsPart()
  */
  void setFractionalSecondsPart(int fractionalSecondsPart);
  //@}

private:
  std::string dbname_;
  std::string dbuser_;
  std::string dbpasswd_;
  std::string dbhost_;
  std::string dbsocket_;
  unsigned int dbport_;

  int fractionalSecondsPart_;
  std::string dateType_, timeType_;

  MySQL_impl* impl_; // MySQL connection handle

  void init();
};

    }
  }
}

#endif // WT_DBO_BACKEND_MYSQL_H_