While your solution will eliminate the link errors, I think that my
solution -- replacing && with || in the conditional expression -- is
actually the correct one, for two reasons:

(1) In the source code, every other conditional expression involving
OMIT_VIEW and OMIT_TRIGGER uses not && but ||.

(2) Logically, specifying OMIT_VIEW should be enough to omit sqlite3-
MaterializeView() -- I shouldn't have to additionally specify OMIT_
TRIGGER.

- Richard Klein

Mark Spiegel wrote:
> This was a problem for me too.  I just chalked it up to deleting options 
> and using the amalgamated source.  (Seem to recall reading that this is 
> not recommended.)
> 
> Replace:
> 
> SQLITE_PRIVATE void sqlite3MaterializeView(Parse*, Select*, Expr*, u32, 
> int);
> 
> with:
> 
> #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
> SQLITE_PRIVATE void sqlite3MaterializeView(Parse*, Select*, Expr*, u32, 
> int);
> #else   /* #if !defined(SQLITE_OMIT_VIEW) && 
> !defined(SQLITE_OMIT_TRIGGER) */
> #  define sqlite3MaterializeView(A,B,C,D,E)     0
> #endif  /* #if !defined(SQLITE_OMIT_VIEW) && 
> !defined(SQLITE_OMIT_TRIGGER) */
> 
> or equivalent.  As I recall, this function is called from within an if 
> block whose condition (because of the #defines) will never be true.  For 
> those of us who must live with the MSFT compilers, this is a problem.
> 
> Richard Klein wrote:
>> I fixed my OPTS in the Makefile so that they are in sync
>> with my compilation options.
>>
>> Now all the unresolved references in the parser have dis-
>> appeared, but I'm still left with two unresolved references
>> to the function sqlite3MaterializeView():
>>
>> delete.obj : error LNK2019: unresolved external symbol 
>> _sqlite3MaterializeView referenced in function _sqlite3DeleteFrom
>> update.obj : error LNK2019: unresolved external symbol 
>> _sqlite3MaterializeView referenced in function _sqlite3Update
>>
>> The function sqlite3MaterializeView() is defined in the
>> file delete.c, as follows:
>>
>> ------------------------------------------------------------------------
>> #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
>> /*
>> ** Evaluate a view and store its result in an ephemeral table.  The
>> ** pWhere argument is an optional WHERE clause that restricts the
>> ** set of rows in the view that are to be added to the ephemeral table.
>> */
>> void sqlite3MaterializeView(
>>    ...
>> ){
>>    ...
>> }
>> #endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */
>> ------------------------------------------------------------------------
>>
>> In my application, I've defined SQLITE_OMIT_VIEW, but *not*
>> SQLITE_OMIT_TRIGGER; that is, I want TRIGGERs, but not VIEWs.
>>
>> It would seem that in the conditional compilation expression
>> shown above, the && should be replaced by ||:
>>
>> #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
>>
>> In other words, if VIEW *or* TRIGGER is supported, then define
>> the function sqlite3MaterializeView().
>>
>> Making that change fixes the problem.
>>
>> - Richard

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to