mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
DBD-SQLite: implemented NULLABLE attribute to resolve RT #40594
This commit is contained in:
parent
0dd41aefb3
commit
d7104b39ff
2 changed files with 14 additions and 0 deletions
|
@ -161,6 +161,7 @@ if ( $sqlite_inc ) {
|
|||
my @CC_DEFINE = (
|
||||
'-DSQLITE_CORE',
|
||||
'-DSQLITE_ENABLE_FTS3',
|
||||
'-DSQLITE_ENABLE_COLUMN_METADATA',
|
||||
'-DNDEBUG=1',
|
||||
"-DSQLITE_PTR_SZ=$Config{ptrsize}"
|
||||
);
|
||||
|
|
13
dbdimp.c
13
dbdimp.c
|
@ -740,6 +740,7 @@ type_to_odbc_type (int type)
|
|||
SV *
|
||||
sqlite_st_FETCH_attrib (SV *sth, imp_sth_t *imp_sth, SV *keysv)
|
||||
{
|
||||
D_imp_dbh_from_sth;
|
||||
char *key = SvPV_nolen(keysv);
|
||||
SV *retsv = NULL;
|
||||
int i,n;
|
||||
|
@ -791,7 +792,19 @@ sqlite_st_FETCH_attrib (SV *sth, imp_sth_t *imp_sth, SV *keysv)
|
|||
}
|
||||
else if (strEQ(key, "NULLABLE")) {
|
||||
AV *av = newAV();
|
||||
av_extend(av, i);
|
||||
retsv = sv_2mortal(newRV(sv_2mortal((SV*)av)));
|
||||
#if defined(SQLITE_ENABLE_COLUMN_METADATA)
|
||||
for (n = 0; n < i; n++) {
|
||||
const char *database = sqlite3_column_database_name(imp_sth->stmt, n);
|
||||
const char *tablename = sqlite3_column_table_name(imp_sth->stmt, n);
|
||||
const char *fieldname = sqlite3_column_name(imp_sth->stmt, n);
|
||||
const char *datatype, *collseq;
|
||||
int notnull, primary, autoinc;
|
||||
sqlite3_table_column_metadata(imp_dbh->db, database, tablename, fieldname, &datatype, &collseq, ¬null, &primary, &autoinc);
|
||||
av_store(av, n, newSViv(!notnull));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (strEQ(key, "SCALE")) {
|
||||
AV *av = newAV();
|
||||
|
|
Loading…
Add table
Reference in a new issue