38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
int argc,
sqlite3_value **argv
){
int rid;
Blob cx;
const char *zName;
assert( argc==1 );
zName = (const char*)sqlite3_value_text(argv[0]);
if( zName==0 ) return;
g.db = sqlite3_context_db_handle(context);
g.repositoryOpen = 1;
rid = name_to_rid(zName);
if( rid==0 ) return;
if( content_get(rid, &cx) ){
sqlite3_result_blob(context, blob_buffer(&cx), blob_size(&cx),
SQLITE_TRANSIENT);
blob_reset(&cx);
}
}
/*
** Implementation of the "compress(X)" SQL function. The input X is
** compressed using zLib and the output is returned.
*/
|
>
>
>
|
|
|
|
|
>
|
<
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
int argc,
sqlite3_value **argv
){
int rid;
Blob cx;
const char *zName;
assert( argc==1 );
if( sqlite3_value_type(argv[0])==SQLITE_INTEGER ){
rid = sqlite3_value_int(argv[0]);
}else{
zName = (const char*)sqlite3_value_text(argv[0]);
if( zName==0 ) return;
g.db = sqlite3_context_db_handle(context);
g.repositoryOpen = 1;
rid = name_to_rid(zName);
}
if( rid==0 ) return;
if( content_get(rid, &cx) ){
sqlite3_result_blob(context, blob_buffer(&cx), blob_size(&cx),
blob_is_malloced(&cx) ? fossil_free : SQLITE_TRANSIENT);
}
}
/*
** Implementation of the "compress(X)" SQL function. The input X is
** compressed using zLib and the output is returned.
*/
|