1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Virtual table modules with a null xCreate method act as eponymous-only modules -

they cannot be used in a CREATE VIRTUAL TABLE statement.  Add the series.c
extension that implements a postgres-like generate_series virtual table to
demonstrate this capability.

FossilOrigin-Name: c58426dbd5ea8b8440ebcc1214f79fa63d658216
This commit is contained in:
drh
2015-08-19 13:54:20 +00:00
parent b89c92a615
commit 398f872d1f
9 changed files with 346 additions and 13 deletions

View File

@@ -699,7 +699,7 @@ int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){
** invoke it now. If the module has not been registered, return an
** error. Otherwise, do nothing.
*/
if( !pMod ){
if( pMod==0 || pMod->pModule->xCreate==0 ){
*pzErr = sqlite3MPrintf(db, "no such module: %s", zMod);
rc = SQLITE_ERROR;
}else{
@@ -1109,7 +1109,7 @@ int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){
int rc;
sqlite3 *db = pParse->db;
if( pMod->pEpoTab ) return 1;
if( pModule->xCreate!=pModule->xConnect ) return 0;
if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0;
nName = sqlite3Strlen30(pMod->zName) + 1;
pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName);
if( pTab==0 ) return 0;