Warning, /libraries/kdb/TODO is written in an unsupported language. File is not indexed.

0001 KDb TODO
0002 
0003 Legend: [ ] TODO [x] done [p] in progress
0004 
0005 General hints:
0006 *Use explicit ctors where possible
0007 *check other==this in operator=() overloads
0008 *look at http://ebn.kde.org/krazy/reports/playground/libs/kdb/
0009 *Use prepared SQL statements everywhere and cache them instead of constructing SQL strings by hand
0010 *Move members of public classes to d-pointers
0011 *Remove boolean traps everywhere [http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html]
0012 **Connection: databaseNames, databaseExists, useDatabase, tableNames, commitTransaction, rollbackTransaction, querySingleRecord, querySingleString, querySingleNumber, resultExists, createTable, alterTableName, dropTable, drv_databaseExists, updateRecord, insertRecord, deleteRecord, querySingleRecordInternal, storeObjectDataInternal
0013 **replace Connection::dropDatabase() with Connection::dropCurrentDatabase()
0014 **make Connection::drv_useDatabase return tristate instead of using bool *cancelled
0015 **Driver: addLimitTo1
0016 **Cursor: updateRecord, insertRecord, deleteRecord,
0017 **FieldList: 2 ctors
0018 **IndexSchema: attachRelationship
0019 **QueryColumnInfo: ctor
0020 **OrderByColumn: 2 ctors, toSQLString
0021 **OrderByColumnList: appendFields, appendColumn x 2, appendField x 2, toSQLString
0022 **QuerySchema: insertField x 2, addField x 2, addExpression, addAsterisk, field, columnInfo, 
0023 **RecordEditBuffer: ctor, at
0024 **TableSchema: ctor 
0025 **TableOrQuerySchema: ctor
0026 
0027 TODO: add explanation of expressions equality with examples, similar to
0028       bool QDomNode::operator== ( const QDomNode & n ) const
0029 TODO: port KEXI_DEBUG_GUI; merge 3fa9e1a75c5fae1c from calligra/master
0030 TODO: port 'Field list: return bool from removeFiled(), add moveField()' 9ab089d7a1306d45be from calligra/master
0031 TODO: port 'Force lowercase letters for object ids; fix for not-all-lowercase namespace' 5d39c992354a from calligra/master
0032 TODO: port 'Fix possible crash when saving changes to design of table used elsewhere' e410a4f4fc9da from calligra/master
0033 
0034 UNIT TESTS TODO:
0035 *FunctionExpression
0036 *ExpresionData*
0037 *QueryParameterExpression
0038 *VariableExpression
0039 *Pass expression string to parser, parse it and compare with the original string
0040 
0041 Buildsystem:
0042 [ ] find replacement for -DKDE_DEFAULT_DEBUG_AREA=44000
0043 [ ] move drivers/ to the main dir
0044 [ ] move *Validator classes from tools to a separate KDbGui lib
0045 [x] version macros like KDB_VERSION are generated using cmake
0046 
0047 Drivers:
0048 [x] add SQLite driver for 3.6.1+ version (use FindSQLite.cmake);
0049     Compatibility with Kexi 1.x (SQlite 3.2.8) is acheived because we use the 1st
0050     file format of SQLite, which is the default for 3.3.6+.
0051     (see http://www.sqlite.org/formatchng.html)
0052 [ ] TODO: let's add this note:
0053      In June 2006 we have migrated to 3.2.8 from 3.0.7
0054      (http://websvn.kde.org/trunk/koffice/kexi/3rdparty/kexisql3/version?view=log)
0055      Thus, any future use autovacuum will make the db read-only for 3.0.7-based drivers
0056      and ALTER TABLE ADD COLUMN will make it unreadable for 3.0.7-based drivers 
0057      unless VACUUM is executed. We hope it will not be a problem by the time
0058      we decide to use these features in the final, since 3.0.7-based Kexi will be already
0059      3 years old. It will be always possible to perform simple migration using the following command
0060      "sqlite-old old.db .dump | sqlite-new new.db"
0061 [ ] SQLite: (security) Add connection flags to the driver and global setting to control the "secure delete" pragma
0062             for now secure delete is always enabled
0063 [x] MySQL driver builds
0064 [ ] replace the Pqxx driver with a new one using libpq C API
0065 [ ] Port the Sybase driver (untouched for now)
0066 [ ] Port the ODBC driver (untouched for now)
0067 [ ] Add string escpaing to connection, call driver's escpaing by default
0068 [23:12] <jstaniek> piggz: what's the reason for escape in connection?
0069 [23:13] <piggz> jstaniek: short answer, the connection knows the database encoding, and can do the right think
0070 [23:14] <jstaniek> piggz: but this would be just a helper function calling driver anyway, right?
0071 [23:14] <piggz> no, the actual connection to the database is needed to know the encoding
0072 [23:15] <piggz> the driver could have a simple fallback like i have put in today
0073 [23:16] <piggz> jstaniek: difference between pqescapestring and pqescapestringconn here http://books.google.co.uk/books?id=EwSt1gAjRjgC&pg=PA273&lpg=PA273&dq=pqescapestringconn+documentation&source=bl&ots=dVAChqjY5b&sig=mUWYdPqS0Xzz0n30etYg2EjLjpQ&hl=en&ei=8LaCTJqaGIyA4Ab7143UCw&sa=X&oi=book_result&ct=result&resnum=7&ved=0CCwQ6AEwBg#v=onepage&q&f=false
0074 [23:16] <piggz> pqescapestring, the non-connection version is deprecated as a security risk
0075 [23:17] <piggz> becuase, in a multi-byte char set, \ can be part of a character, the postgres guys told me
0076 [23:18] <jstaniek> I see...
0077 [23:18] <jstaniek> so indeed good idea about the fall back
0078 [23:28] <piggz> it may require escapeString and valueToSQl functions in Connection class, as driver::valueToSql calls escapeString
0079 [23:28] <piggz> that was where i traced todays bug
0080 [ ] PostgreSQL driver: define USE_SSL and add support for SSL connections (http://www.postgresql.org/docs/8.4/static/libpq-status.html)
0081 [ ] PostgreSQL driver: Use binary mode with PQexecParams() instead of PQexec(), this will reduce number
0082     of conversions from string.
0083     See http://www.postgresql.org/docs/8.4/interactive/libpq-example.html#LIBPQ-EXAMPLE-3
0084     Passing numeric values requires knowledge of the server storage format, as implemented in
0085     src/backend/utils/adt/numeric.c::numeric_send() and src/backend/utils/adt/numeric.c::numeric_recv().
0086 
0087 Naming, API:
0088 [ ] what to do with kexi__ prefix for db objects (backward compat.)?
0089 [ ] apply rules from http://techbase.kde.org/Policies/Library_Code_Policy
0090 [x] driver's .desktop file format changed:
0091 "X-Kexi-DriverName" -> "Name"
0092 "X-KDE-Library" -> "FileName"
0093 "X-Kexi-DriverType" -> "Type"
0094 "X-Kexi-FileDBDriverMime" -> "MimeTypes"
0095 [ ] change the above in kexidb-qt3 too
0096 [ ] make Driver::Features use Q_FLAGS
0097 [p] remove usage of QObject in Driver, DriverManager, etc.
0098 [p] make classes implicitly shared
0099 [p] replace usage of 'row' term with 'record' in most places, e.g. Cursor::storeCurrentRow -> Cursor::storeCurrentRecord
0100 [p] port debug methods to uniform "QDebug operator<<()"
0101 [p] make certain methods of *Expr classes const if possible
0102 [ ] Add MONEY/DECIMAL data type; for sqlite use INTEGER
0103     (see http://www.mail-archive.com/sqlite-users@sqlite.org/msg26965.html
0104          http://www.mail-archive.com/sqlite-users@sqlite.org/msg27247.html)
0105     Currency in MS Access: Currency values and numeric data used in mathematical calculations involving data
0106                            with one to four decimal places. Accurate to 15 digits on the left side of the
0107                            decimal separator and to 4 digits on the right side.
0108     Decimal Number (NUMERIC?) in MS Access: Decimal Stores numbers from -10^381 through 10^381 (.adp),
0109                                             from -10^281 through 10^281 (.mdb); decimal precision: 28 B,
0110                                             storage size: 12 B
0111 [ ] Add extension-functions.c from http://sqlite.org/contrib: mathematical and string extension functions
0112     for SQL queries using the loadable extensions mechanism
0113 [ ] add Connection::reset(), e.g. for pgsql that would call PQreset():
0114     "This function will close the connection to the server and attempt to reestablish a new connection
0115      to the same server, using all the same parameters previously used. This may be useful for error recovery
0116      if a working connection is lost."
0117 
0118 Other:
0119 [ ] store config in ~/.config/kdb/, e.g. *rc files
0120 [x] load plugins from QT_PLUGINS_DIR and similar locations
0121 [ ] add more Q_INTERFACES than just Driver: add Import, Export (replaces KexiDB migration) so driver plugin can support more or less features
0122 
0123 Optimization & Cleanup
0124 [ ] use QLatin1String where possible
0125 
0126 TODO: port files (Legend: *-compiles, no warnings; **-cleanup and naming notes also applied)
0127   Admin.h
0128   Admin.cpp
0129   Alter.h
0130   Alter.cpp
0131 *  Connection.h
0132 *  Connection_p.h
0133 *  Connection.cpp
0134 ** prepareStatementInternal() has now no arguments and has PreparedStatementInterface* return type
0135 TODO: move to Connection::prepareStatement() and all the drv_*() to ConnectionInterface just like we moved execute() and prepare() to PreparedStatementInterface...
0136 *  ConnectionData.h
0137 *  ConnectionData.cpp
0138 *  Cursor.h
0139 *  Cursor_p.h
0140 *  Cursor.cpp
0141   DbObjectNameValidator.h
0142   DbObjectNameValidator.cpp
0143   DbProperties.h
0144   DbProperties.cpp
0145 *  Driver.h
0146 *  Driver.cpp
0147 ** Driver::Info is implicitly shared class now
0148 ** Driver::fileDBDriverMimeType() moved to Driver::Info::fileDBMimeType()
0149 ** Driver::isFileDriver() renamed to Driver::isFileBased(), also available as Driver::Info::isFileBased()
0150 ** Driver no longer inherits QObject
0151 *  DriverManager.h
0152 *  DriverManager_p.h
0153 *  DriverManager.cpp
0154 ** DriverManager no longer inherits QObject
0155 *  Driver_p.h
0156 *  Driver_p.cpp
0157 *  Expression.h
0158 *  Expression.cpp
0159 ** Expresion classes are now is ExpressionClass enum
0160 TODO: change KexiDBExpr_Unknown to UnknownType, and ints to enums, etc.
0161 *  Error.h
0162 *  Field.h
0163 *  Field.cpp
0164 *  FieldList.h
0165 *  FieldList.cpp
0166 ** added isEmpty()
0167   FieldValidator.h
0168   FieldValidator.cpp
0169 *  Global.h
0170 *  Global.cpp
0171 *  IndexSchema.h
0172 *  IndexSchema.cpp
0173 *  keywords.cpp
0174 TODO: enable generation of this file as custom target using kexi/tools/sql_keywords/sql_keywords.sh and kexi/kexidb/parser/sqlscanner.l and koffice/kexi/tools/sql_keywords/kexi_reserved
0175   LookupFieldSchema.h
0176   LookupFieldSchema.cpp
0177   MessageHandler.h
0178   MessageHandler.cpp
0179 *  Object.h
0180 *  Object.cpp
0181 ** made implicitly shared, used in fewer number of classed than before
0182 *  PreparedStatement.h
0183 *  PreparedStatement.cpp
0184 ** it's implicitly shared class now
0185 ** arguments are no longer provided using operator << but instead in execute(), so PreparedStatement is more generic now. Operator << and clearArguments() is thus removed.
0186 ** StatementType -> Type, added Arguments typedef
0187 ** execute() aborts now if at least one field provided on whereFieldNames list is not found (before it was ignored)
0188 ** internal: the statement is now created using utf8, not latin1 functions
0189 ** PreparedStatement::Arguments renamed to PreparedStatementParameters
0190 ** internal: to implement PreparedStatement in a driver, one has to write these methods:
0191 *** virtual bool executeInternal( const Arguments& args );
0192 *** virtual bool prepare(QByteArray& statement) = 0;
0193 TODO: more changes like these related to WHERE expression
0194 *  QuerySchema.h
0195 *  QuerySchema.cpp
0196 *  QuerySchemaParameter.h
0197 *  QuerySchemaParameter.cpp
0198 *  RecordData.h
0199 *  RecordData.cpp
0200   Relationship.h
0201   Relationship.cpp
0202 *  RowEditBuffer.h
0203 *  RowEditBuffer.cpp
0204 ** renamed to RecordEditBuffer
0205 *  SchemaData.h
0206 *  SchemaData.cpp
0207 *  TableSchema.h
0208 *  TableSchema.cpp
0209   tools/SimpleCommandLineApp.cpp
0210 *  Transaction.h
0211 *  Transaction.cpp
0212   Utils.h
0213   Utils_p.h
0214   Utils.cpp
0215   kdb_export.h
0216   kdb_global.h
0217 
0218 parser:
0219 * parser/extract_tokens.sh
0220 * parser/generate_parser_code.sh
0221   parser/Parser.h
0222   parser/Parser.cpp
0223   parser/Parser_p.h
0224   parser/Parser_p.cpp
0225 * parser/SqlParser.y
0226   parser/SqlTypes.h
0227 * parser/SqlScanner.l
0228   parser/tokens.cpp
0229 
0230 tools:
0231   tools/SimpleCommandLineApp.h
0232 * tools/Tristate.h
0233 
0234 drivers:
0235 *  drivers/mysql/MysqlConnection.h
0236 *  drivers/mysql/MysqlConnection.cpp
0237 *  drivers/mysql/MysqlConnection_p.h
0238 *  drivers/mysql/MysqlConnection_p.cpp
0239 *  drivers/mysql/MysqlCursor.h
0240 *  drivers/mysql/MysqlCursor.cpp
0241 *  drivers/mysql/MysqlDriver.h
0242 *  drivers/mysql/MysqlDriver.cpp
0243 *  drivers/mysql/MysqlKeywords.cpp
0244 *  drivers/mysql/MysqlPreparedStatement.h
0245 *  drivers/mysql/MysqlPreparedStatement.cpp
0246 ** for now it's nonfunctional; port and improve code within KDB_USE_MYSQL_STMT
0247 
0248   drivers/odbc/odbcconnection.h
0249   drivers/odbc/odbcconnection.cpp
0250   drivers/odbc/odbcdriver.h
0251   drivers/odbc/odbcdriver.cpp
0252   
0253   drivers/oracle/oracleconnection.h
0254   drivers/oracle/oracleconnection.cpp
0255   drivers/oracle/oracleconnection_p.h
0256   drivers/oracle/oracleconnection_p.cpp
0257   drivers/oracle/oraclekeywords.cpp
0258   drivers/oracle/oraclecursor.h
0259   drivers/oracle/oraclecursor.cpp
0260   drivers/oracle/oracledriver.h
0261   drivers/oracle/oracledriver.cpp
0262   drivers/oracle/oraclepreparedstatement.h
0263   drivers/oracle/oraclepreparedstatement.cpp
0264   drivers/oracle/oracle_keywords.sh
0265   
0266 *  drivers/pqxx/PqxxConnection.h
0267 *  drivers/pqxx/PqxxConnection.cpp
0268 ** forked to postgresql driver
0269 * drivers/pqxx/PqxxConnection_p.h
0270 * drivers/pqxx/PqxxConnection_p.cpp
0271 ** forked to postgresql driver
0272 * drivers/pqxx/PqxxCursor.h
0273 * drivers/pqxx/PqxxCursor.cpp
0274 ** forked to postgresql driver
0275 * drivers/pqxx/PqxxDriver.h
0276 * drivers/pqxx/PqxxDriver.cpp
0277 ** forked to postgresql driver
0278 * drivers/pqxx/PqxxPreparedStatement.h
0279 * drivers/pqxx/PqxxPreparedStatement.cpp
0280 ** forked to postgresql driver
0281 * drivers/pqxx/PqxxKeywords.cpp
0282 
0283 * drivers/sqlite/driver/sqlite.h
0284 ** removed, system SQLite is used
0285 *  drivers/sqlite/SqliteAdmin.h
0286 *  drivers/sqlite/SqliteAdmin.cpp
0287 *  drivers/sqlite/SqliteConnection.h
0288 *  drivers/sqlite/SqliteConnection_p.h
0289 *  drivers/sqlite/SqliteConnection.cpp
0290 *  drivers/sqlite/SqliteCursor.h
0291 *  drivers/sqlite/SqliteCursor.cpp
0292 *  drivers/sqlite/SqliteDriver.h
0293 *  drivers/sqlite/SqliteDriver.cpp
0294 *  drivers/sqlite/SqlitePreparedStatement.h
0295 *  drivers/sqlite/SqlitePreparedStatement.cpp
0296 ** refactored: internal bindValue() added
0297 *  drivers/sqlite/SqliteVacuum.h
0298 *  drivers/sqlite/SqliteVacuum.cpp
0299 *  drivers/sqlite/SqliteKeywords.cpp
0300 
0301   drivers/sybase/SybaseConnection.h
0302   drivers/sybase/SybaseConnection.cpp
0303   drivers/sybase/SybaseConnection_p.h
0304   drivers/sybase/SybaseConnection_p.cpp
0305   drivers/sybase/SybaseCursor.h
0306   drivers/sybase/SybaseCursor.cpp
0307   drivers/sybase/SybaseDriver.h
0308   drivers/sybase/SybaseDriver.cpp
0309   drivers/sybase/SybasePreparedStatement.h
0310   drivers/sybase/SybasePreparedStatement.cpp
0311   drivers/sybase/SybaseKeywords.cpp
0312 
0313   drivers/xbase/XbaseConnection.h
0314   drivers/xbase/XbaseConnection.cpp
0315   drivers/xbase/XbaseConnection.cpp
0316   drivers/xbase/XbaseConnection_p.h
0317   drivers/xbase/XbaseConnection_p.cpp
0318   drivers/xbase/XbaseCursor.h
0319   drivers/xbase/XbaseCursor.cpp
0320   drivers/xbase/XbaseDriver.h
0321   drivers/xbase/XbaseDriver.cpp
0322   drivers/xbase/XbaseExport.h
0323   drivers/xbase/XbaseExport.cpp
0324   drivers/xbase/XbaseKeywords.cpp
0325 
0326 kexiutils:
0327   debuggui.cpp - port and re-enable KEXI_DEBUG_GUI