[DBIx-Class-Devel] [Perl5/DBIx-Class] Add patch to fix test failures with SQlite 3.37.0 (PR #142)
Kenichi Ishigaki
notifications at github.com
Wed Jan 19 21:36:20 GMT 2022
@ribasushi
If the metadata has some significant role in DBIC, I'll try to tweak DBD::SQLite not to break compat. Otherwise, +1 for this PR, because...
1. the value is directly set by `sqlite3_table_column_metadata` C API. DBD::SQLite (dbdimp.c) only newSVpv() it. https://github.com/DBD-SQLite/DBD-SQLite/blob/8bf916dbd7685dd9de7746015d2048d52a5ca7f8/dbdimp.c#L1955-L1970
2. there seems to have long been a chance to return an upper case value. See the following excerpt from sqlite3.c in SQLite 3.9 (chosen randomly), especially "INTEGER" in the middle.
```
SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
sqlite3 *db, /* Connection handle */
const char *zDbName, /* Database name or NULL */
const char *zTableName, /* Table name */
const char *zColumnName, /* Column name */
char const **pzDataType, /* OUTPUT: Declared data type */
char const **pzCollSeq, /* OUTPUT: Collation sequence name */
int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
int *pPrimaryKey, /* OUTPUT: True if column part of PK */
int *pAutoinc /* OUTPUT: True if column is auto-increment */
){
(snip)
/* The following block stores the meta information that will be returned
** to the caller in local variables zDataType, zCollSeq, notnull, primarykey
** and autoinc. At this point there are two possibilities:
**
** 1. The specified column name was rowid", "oid" or "_rowid_"
** and there is no explicitly declared IPK column.
**
** 2. The table is not a view and the column name identified an
** explicitly declared column. Copy meta information from *pCol.
*/
if( pCol ){
zDataType = pCol->zType;
zCollSeq = pCol->zColl;
notnull = pCol->notNull!=0;
primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0;
autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;
}else{
zDataType = "INTEGER";
primarykey = 1;
}
(snip)
/* Whether the function call succeeded or failed, set the output parameters
** to whatever their local counterparts contain. If an error did occur,
** this has the effect of zeroing all output parameters.
*/
if( pzDataType ) *pzDataType = zDataType;
if( pzCollSeq ) *pzCollSeq = zCollSeq;
if( pNotNull ) *pNotNull = notnull;
if( pPrimaryKey ) *pPrimaryKey = primarykey;
if( pAutoinc ) *pAutoinc = autoinc;
(cut)
```
--
Reply to this email directly or view it on GitHub:
https://github.com/Perl5/DBIx-Class/pull/142#issuecomment-1016889073
You are receiving this because you are subscribed to this thread.
Message ID: <Perl5/DBIx-Class/pull/142/c1016889073 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20220119/665b44d7/attachment.htm>
More information about the DBIx-Class-Devel
mailing list