view release on metacpan or search on metacpan
lib/Crypt/KeyDerivation.pm view on Meta::CPAN
my $derived_key = argon2_pbkdf($type, $password, $salt);
# $type ... [string] one of 'argon2d', 'argon2i', 'argon2id'
# $password ... [binary string] input keying material (password)
# $salt ... [binary string] salt/nonce (recommended: at least 16 bytes)
# $t_cost ... [integer] optional, time cost (number of iterations), DEFAULT: 3
# $m_factor ... [integer] optional, memory cost in kibibytes (1 KiB = 1024 B), DEFAULT: 65536 (= 64 MiB)
# $parallelism ... [integer] optional, degree of parallelism, DEFAULT: 1
# $len ... [integer] optional, derived key len in bytes, DEFAULT: 32
# $secret ... [binary string] optional, secret value, DEFAULT: ''
# $ad ... [binary string] optional, associated data, DEFAULT: ''
view all matches for this distribution
view release on metacpan or search on metacpan
goto &cvCopyMakeBorder;
}
sub Dilate {
# Dilate(src, dst, [element], [iterations])
my $src = shift;
my $dst = dst(@_) || $src->new;
unshift(@_, $src, $dst);
goto &cvDilate;
}
sub Erode {
# Erode(src, dst, [element], [iterations])
my $src = shift;
my $dst = dst(@_) || $src->new;
unshift(@_, $src, $dst);
goto &cvErode;
}
goto &cvLaplace;
}
sub MorphologyEx {
# MorphologyEx(src, dst, temp, element, operation, [iterations])
my $src = shift;
my $dst = dst(@_) || $src->new;
if (@_) {
my $temp = dst(@_);
unless ($temp) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/60-leaks.t view on Meta::CPAN
BEGIN {
binmode(STDERR, ':utf8');
binmode(STDOUT, ':utf8');
};
my $COUNT_CONNECT = 500; # Number of connect/disconnect iterations
my $COUNT_PREPARE = 10000; # Number of prepare/execute/finish iterations
my $COUNT_EVENTS = 10000;
my $TOTALMEM = 0;
use Test::More;
use DBI;
view all matches for this distribution
view release on metacpan or search on metacpan
t/60leaks.t view on Meta::CPAN
#
BEGIN {
$^W = 1;
$COUNT_CONNECT = 500; # Number of connect/disconnect iterations
$COUNT_PREPARE = 10000; # Number of prepare/execute/finish iterations
$TOTALMEM = 0;
#
# Make -w happy
#
view all matches for this distribution
view release on metacpan or search on metacpan
print "Result: $result\n";
my $info = $sth->fetchall_arrayref();
Without asynchronous queries, the above script would take about 8 seconds to run: five seconds waiting
for the execute to finish, then three for the check_on_the_kids() function to return. With asynchronous
queries, the script takes about 6 seconds to run, and gets in two iterations of check_on_the_kids in
the process.
Here's an example showing the ability to cancel a long-running query. Imagine two slave databases in
different geographic locations over a slow network. You need information as quickly as possible, so
you query both at once. When you get an answer, you tell the other one to stop working on your query,
view all matches for this distribution
view release on metacpan or search on metacpan
t/60leaks.t view on Meta::CPAN
use lib 't', '.';
require 'lib.pl';
use constant SHOW_PROGRESS => ($ENV{SHOW_PROGRESS} ? 1 : 0);
my $COUNT_CONNECT = 4000; # Number of connect/disconnect iterations
my $COUNT_PREPARE = 30000; # Number of prepare/execute/finish iterations
my $COUNT_BIND = 10000; # Number of bind_param iterations
my $have_storable;
BEGIN {
if (!$ENV{EXTENDED_TESTING}) {
view all matches for this distribution
view release on metacpan or search on metacpan
PerlIO_printf(DBILOGFP, " in '%s' [%lu,%lu]: len %2lu, ind %d%s, value=%s\n",
phs->name, ul_t(iter), ul_t(index), ul_t(phs->alen), phs->indp,
(phs->desc_h) ? " via descriptor" : "",neatsvpv(phs->sv,10));
*/
if (!tuples_av && (index > 0 || iter > 0))
croak(" Arrays and multiple iterations not currently supported by DBD::Oracle (in %d/%d)", index,iter);
return OCI_CONTINUE;
}
/*
view all matches for this distribution
view release on metacpan or search on metacpan
print "Result: $result\n";
my $info = $sth->fetchall_arrayref();
Without asynchronous queries, the above script would take about 8 seconds to run: five seconds waiting
for the execute to finish, then three for the check_on_the_kids() function to return. With asynchronous
queries, the script takes about 6 seconds to run, and gets in two iterations of check_on_the_kids in
the process.
Here's an example showing the ability to cancel a long-running query. Imagine two replica databases in
different geographic locations over a slow network. You need information as quickly as possible, so
you query both at once. When you get an answer, you tell the other one to stop working on your query,
view all matches for this distribution
view release on metacpan or search on metacpan
imp_sth->has_binary = DBDPG_FALSE; /* Are any of the params binary? */
imp_sth->has_default = DBDPG_FALSE; /* Are any of the params DEFAULT? */
imp_sth->has_current = DBDPG_FALSE; /* Are any of the params DEFAULT? */
imp_sth->use_inout = DBDPG_FALSE; /* Are any of the placeholders using inout? */
imp_sth->all_bound = DBDPG_FALSE; /* Have all placeholders been bound? */
imp_sth->number_iterations = 0;
/* We inherit some preferences from the database handle */
imp_sth->server_prepare = imp_dbh->server_prepare;
imp_sth->switch_prepared = imp_dbh->switch_prepared;
imp_sth->prepare_now = imp_dbh->prepare_now;
imp_sth->numphs,
imp_sth->has_default,
imp_sth->has_current);
/* Increment our count */
imp_sth->number_iterations++;
/* We use PQexec if:
1. The statement is *not* DML (e.g. is DDL, which cannot be prepared)
2. We have a DEFAULT parameter
3. We have a CURRENT parameter
|| imp_sth->direct
|| !imp_sth->numphs
|| !imp_sth->server_prepare
)
pqtype = PQTYPE_EXEC;
else if (0==imp_sth->switch_prepared || imp_sth->number_iterations < imp_sth->switch_prepared)
pqtype = PQTYPE_PARAMS;
else
pqtype = PQTYPE_PREPARED;
if (TRACE4_slow) TRC(DBILOGFP, "%sWill use %s\n",
view all matches for this distribution
view release on metacpan or search on metacpan
t/60leaks.t view on Meta::CPAN
#
# This is a skeleton test. For writing new tests, take this file
# and modify/extend it.
#
my $COUNT_CONNECT = 4000; # Number of connect/disconnect iterations
my $COUNT_PREPARE = 10000; # Number of prepare/execute/finish iterations
my $haveStorable;
eval { require Proc::ProcessTable; };
view all matches for this distribution
view release on metacpan or search on metacpan
}
}
TimeMe("Testing empty loop speed ...",
"%d iterations in %.1f cpu+sys seconds (%d per sec)",
sub {
},
100000);
view all matches for this distribution
view release on metacpan or search on metacpan
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the T parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop. If the query planner's estimates was accurate,
/* Information used while coding trigger programs. */
Parse *pToplevel; /* Parse structure for main program (or NULL) */
Table *pTriggerTab; /* Table triggers are being coded for */
int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */
int addrSkipPK; /* Address of instruction to skip PRIMARY KEY index */
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
u32 oldmask; /* Mask of old.* columns referenced */
u32 newmask; /* Mask of new.* columns referenced */
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
u8 disableTriggers; /* True to disable triggers */
#ifndef DEFAULT_CIPHER_FLAGS
#define DEFAULT_CIPHER_FLAGS CIPHER_FLAG_HMAC | CIPHER_FLAG_LE_PGNO
#endif
/* by default, sqlcipher will use a reduced number of iterations to generate
the HMAC key / or transform a raw cipher key
*/
#ifndef FAST_PBKDF2_ITER
#define FAST_PBKDF2_ITER 2
#endif
if( sqlite3StrICmp(zLeft, "rekey_cipher")==0 && zRight ){
if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 1); // change write cipher only
}else
if( sqlite3StrICmp(zLeft,"cipher_default_kdf_iter")==0 ){
if( zRight ) {
sqlcipher_set_default_kdf_iter(atoi(zRight)); // change default KDF iterations
} else {
char *kdf_iter = sqlite3_mprintf("%d", sqlcipher_get_default_kdf_iter());
codec_vdbe_return_static_string(pParse, "cipher_default_kdf_iter", kdf_iter);
sqlite3_free(kdf_iter);
}
sqlite3_free(fast_kdf_iter);
}
}
}else
if( sqlite3StrICmp(zLeft, "rekey_kdf_iter")==0 && zRight ){
if(ctx) sqlcipher_codec_ctx_set_kdf_iter(ctx, atoi(zRight), 1); // write iterations only
}else
if( sqlite3StrICmp(zLeft,"cipher_page_size")==0 ){
if(ctx) {
if( zRight ) {
int size = atoi(zRight);
const unsigned char *z = c_ctx->pass + 2; /* adjust lead offset of x' */
CODEC_TRACE(("cipher_ctx_key_derive: using raw key from hex\n"));
cipher_hex2bin(z, (c_ctx->key_sz * 2), c_ctx->key);
cipher_hex2bin(z + (c_ctx->key_sz * 2), (ctx->kdf_salt_sz * 2), ctx->kdf_salt);
} else {
CODEC_TRACE(("cipher_ctx_key_derive: deriving key using full PBKDF2 with %d iterations\n", c_ctx->kdf_iter));
c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->pass, c_ctx->pass_sz,
ctx->kdf_salt, ctx->kdf_salt_sz, c_ctx->kdf_iter,
c_ctx->key_sz, c_ctx->key);
}
memcpy(ctx->hmac_kdf_salt, ctx->kdf_salt, ctx->kdf_salt_sz);
for(i = 0; i < ctx->kdf_salt_sz; i++) {
ctx->hmac_kdf_salt[i] ^= hmac_salt_mask;
}
CODEC_TRACE(("cipher_ctx_key_derive: deriving hmac key from encryption key using PBKDF2 with %d iterations\n",
c_ctx->fast_kdf_iter));
c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->key, c_ctx->key_sz,
ctx->hmac_kdf_salt, ctx->kdf_salt_sz, c_ctx->fast_kdf_iter,
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3CodeOnce(pParse); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
*/
static int whereLoopAddBtreeIndex(
WhereLoopBuilder *pBuilder, /* The WhereLoop factory */
struct SrcList_item *pSrc, /* FROM clause term being analyzed */
Index *pProbe, /* An index on pSrc */
LogEst nInMul /* log(Number of iterations due to IN) */
){
WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
Parse *pParse = pWInfo->pParse; /* Parsing context */
sqlite3 *db = pParse->db; /* Database connection malloc context */
WhereLoop *pNew; /* Template WhereLoop under construction */
assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );
/* Seed the search with a single WherePath containing zero WhereLoops.
**
** TUNING: Do not let the number of iterations go above 25. If the cost
** of computing an automatic index is not paid back within the first 25
** rows, then do not use the automatic index. */
aFrom[0].nRow = MIN(pParse->nQueryLoop, 46); assert( 46==sqlite3LogEst(25) );
nFrom = 1;
assert( aFrom[0].isOrdered==0 );
view all matches for this distribution
view release on metacpan or search on metacpan
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the T parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop. If the query planner's estimates was accurate,
#endif
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
Parse *pToplevel; /* Parse structure for main program (or NULL) */
Table *pTriggerTab; /* Table triggers are being coded for */
int addrCrTab; /* Address of OP_CreateBtree opcode on CREATE TABLE */
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
u32 oldmask; /* Mask of old.* columns referenced */
u32 newmask; /* Mask of new.* columns referenced */
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
u8 disableTriggers; /* True to disable triggers */
** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will always land on a record that equally equals the key, or
** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this
** opcode must be followed by an IdxLE opcode with the same arguments.
** The IdxLE opcode will be skipped if this opcode succeeds, but the
** IdxLE opcode will be used on subsequent loop iterations.
**
** This opcode leaves the cursor configured to move in forward order,
** from the beginning toward the end. In other words, the cursor is
** configured to use Next, not Prev.
**
** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will always land on a record that equally equals the key, or
** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this
** opcode must be followed by an IdxGE opcode with the same arguments.
** The IdxGE opcode will be skipped if this opcode succeeds, but the
** IdxGE opcode will be used on subsequent loop iterations.
**
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
*/
case OP_SeekLT: /* jump, in3, group */
case OP_SeekLE: /* jump, in3, group */
x = pIn1->u.i;
if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
/* If the LIMIT is less than or equal to zero, loop forever. This
** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then
** also loop forever. This is undocumented. In fact, one could argue
** that the loop should terminate. But assuming 1 billion iterations
** per second (far exceeding the capabilities of any current hardware)
** it would take nearly 300 years to actually reach the limit. So
** looping forever is a reasonable approximation. */
pOut->u.i = -1;
}else{
** iLoop==1: Code only expressions that are entirely covered by pIdx.
** iLoop==2: Code remaining expressions that do not contain correlated
** sub-queries.
** iLoop==3: Code all remaining expressions.
**
** An effort is made to skip unnecessary iterations of the loop.
*/
iLoop = (pIdx ? 1 : 2);
do{
int iNext = 0; /* Next value for iLoop */
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
*/
static int whereLoopAddBtreeIndex(
WhereLoopBuilder *pBuilder, /* The WhereLoop factory */
struct SrcList_item *pSrc, /* FROM clause term being analyzed */
Index *pProbe, /* An index on pSrc */
LogEst nInMul /* log(Number of iterations due to IN) */
){
WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
Parse *pParse = pWInfo->pParse; /* Parsing context */
sqlite3 *db = pParse->db; /* Database connection malloc context */
WhereLoop *pNew; /* Template WhereLoop under construction */
assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );
/* Seed the search with a single WherePath containing zero WhereLoops.
**
** TUNING: Do not let the number of iterations go above 28. If the cost
** of computing an automatic index is not paid back within the first 28
** rows, then do not use the automatic index. */
aFrom[0].nRow = MIN(pParse->nQueryLoop, 48); assert( 48==sqlite3LogEst(28) );
nFrom = 1;
assert( aFrom[0].isOrdered==0 );
view all matches for this distribution
view release on metacpan or search on metacpan
** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
** set to the total number of times that the X-th loop has run.</dd>
**
** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be set
** to the total number of rows examined by all iterations of the X-th loop.</dd>
**
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
** <dd>^The "double" variable pointed to by the V parameter will be set to the
** query planner's estimate for the average number of rows output from each
** iteration of the X-th loop. If the query planner's estimate was accurate,
struct Parse {
sqlite3 *db; /* The main database structure */
char *zErrMsg; /* An error message */
Vdbe *pVdbe; /* An engine for executing database bytecode */
int rc; /* Return code from execution */
LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
u8 nested; /* Number of nested calls to the parser/code generator */
u8 nTempReg; /* Number of temporary registers in aTempReg[] */
u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
u8 mayAbort; /* True if statement may throw an ABORT exception */
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will either land on a record that exactly matches the key, or
** else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ,
** this opcode must be followed by an IdxLE opcode with the same arguments.
** The IdxGT opcode will be skipped if this opcode succeeds, but the
** IdxGT opcode will be used on subsequent loop iterations. The
** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this
** is an equality search.
**
** This opcode leaves the cursor configured to move in forward order,
** from the beginning toward the end. In other words, the cursor is
** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
** opcode will either land on a record that exactly matches the key, or
** else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ,
** this opcode must be followed by an IdxLE opcode with the same arguments.
** The IdxGE opcode will be skipped if this opcode succeeds, but the
** IdxGE opcode will be used on subsequent loop iterations. The
** OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this
** is an equality search.
**
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
*/
x = pIn1->u.i;
if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
/* If the LIMIT is less than or equal to zero, loop forever. This
** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then
** also loop forever. This is undocumented. In fact, one could argue
** that the loop should terminate. But assuming 1 billion iterations
** per second (far exceeding the capabilities of any current hardware)
** it would take nearly 300 years to actually reach the limit. So
** looping forever is a reasonable approximation. */
pOut->u.i = -1;
}else{
** iLoop==1: Code only expressions that are entirely covered by pIdx.
** iLoop==2: Code remaining expressions that do not contain correlated
** sub-queries.
** iLoop==3: Code all remaining expressions.
**
** An effort is made to skip unnecessary iterations of the loop.
**
** This optimization of causing simple query restrictions to occur before
** more complex one is call the "push-down" optimization in MySQL. Here
** in SQLite, the name is "MySQL push-down", since there is also another
** totally unrelated optimization called "WHERE-clause push-down".
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
int addrExp = 0; /* Address of OP_Explain */
#endif
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
*/
static int whereLoopAddBtreeIndex(
WhereLoopBuilder *pBuilder, /* The WhereLoop factory */
SrcItem *pSrc, /* FROM clause term being analyzed */
Index *pProbe, /* An index on pSrc */
LogEst nInMul /* log(Number of iterations due to IN) */
){
WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyze context */
Parse *pParse = pWInfo->pParse; /* Parsing context */
sqlite3 *db = pParse->db; /* Database connection malloc context */
WhereLoop *pNew; /* Template WhereLoop under construction */
assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );
assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );
/* Seed the search with a single WherePath containing zero WhereLoops.
**
** TUNING: Do not let the number of iterations go above 28. If the cost
** of computing an automatic index is not paid back within the first 28
** rows, then do not use the automatic index. */
aFrom[0].nRow = MIN(pParse->nQueryLoop, 48); assert( 48==sqlite3LogEst(28) );
nFrom = 1;
assert( aFrom[0].isOrdered==0 );
view all matches for this distribution
view release on metacpan or search on metacpan
/* In the first iteration of this loop, pX points to the red node just
* inserted in the tree. If the parent of pX exists (pX is not the root
* node) and is red, then the properties of the red-black tree are
* violated.
*
* At the start of any subsequent iterations, pX points to a red node
* with a red parent. In all other respects the tree is a legal red-black
* binary tree. */
while( pX != pTree->pHead && !pX->pParent->isBlack ){
BtRbNode *pUncle;
BtRbNode *pGrandparent;
view all matches for this distribution
view release on metacpan or search on metacpan
t/60leaks.t view on Meta::CPAN
use Test::More;
use vars qw($test_dsn $test_user $test_password);
use lib 't', '.';
require 'lib.pl';
my $COUNT_CONNECT = 4000; # Number of connect/disconnect iterations
my $COUNT_PREPARE = 30000; # Number of prepare/execute/finish iterations
my $COUNT_BIND = 10000; # Number of bind_param iterations
my $have_storable;
if (!$ENV{EXTENDED_TESTING}) {
plan skip_all => "Skip \$ENV{EXTENDED_TESTING} is not set\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/BatchChunker/LoopState.pm view on Meta::CPAN
sub _mark_chunk_timer { shift->chunk_timer(time); }
#pod =head2 start
#pod
#pod The real start ID that the loop is currently on. May continue to exist within iterations
#pod if chunk resizing is trying to find a valid range. Otherwise, this value will become
#pod undef when a chunk is finally processed.
#pod
#pod =cut
lib/DBIx/BatchChunker/LoopState.pm view on Meta::CPAN
=for Pod::Coverage timer
=head2 start
The real start ID that the loop is currently on. May continue to exist within iterations
if chunk resizing is trying to find a valid range. Otherwise, this value will become
undef when a chunk is finally processed.
=head2 end
view all matches for this distribution
view release on metacpan or search on metacpan
t/152-sql-consistency.t view on Meta::CPAN
$schema->await($schema->deploy({ add_drop_table => 1 }));
subtest 'SQL consistency with default columns' => sub {
my %seen_sqls;
my $iterations = 10;
for my $i (1..$iterations) {
my $rs = $schema->resultset('User')->search({});
my $query = $rs->as_query;
my $sql = normalise_sql(extract_sql($query));
$seen_sqls{$sql}++;
}
is(scalar keys %seen_sqls, 1,
'Default column query generates consistent SQL across all iterations');
my ($sql) = keys %seen_sqls;
like($sql, qr/SELECT .+ FROM users/,
'SQL contains expected SELECT FROM structure');
t/152-sql-consistency.t view on Meta::CPAN
ok(length($columns) > 0, 'SQL contains column list');
};
subtest 'SQL consistency with explicit columns' => sub {
my %seen_sqls;
my $iterations = 10;
my @explicit_cols = qw/id name email age active settings balance/;
for my $i (1..$iterations) {
my $rs = $schema->resultset('User')->search({}, {
columns => \@explicit_cols
});
my $query = $rs->as_query;
my $sql = normalise_sql(extract_sql($query));
$seen_sqls{$sql}++;
}
is(scalar keys %seen_sqls, 1,
'Explicit column query generates consistent SQL across all iterations');
my ($sql) = keys %seen_sqls;
like($sql, qr/SELECT .+ FROM users/,
'SQL contains expected SELECT FROM structure');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/EncodedColumn/Crypt/PBKDF2.pm view on Meta::CPAN
my %new_args = %$args;
# my %new_args; ## We should probably do some validation of individual args
# $new_args{hash_class} = $args->{hash_class} if exists $args->{hash_class}; ## 'HMACSHA1', 'HMACSHA3'
# $new_args{hash_args} = $args->{hash_args} if exists $args->{hash_args}; ## { sha_size => 512 }
# $new_args{iterations} = $args->{iterations} if exists $args->{iterations}; ## 1000
# $new_args{output_len} = $args->{output_len} if exists $args->{output_len}; ## 20
# $new_args{salt_len} = $args->{salt_len} if exists $args->{salt_len}; ## 4
# $new_args{encoding} = $args->{encoding} if exists $args->{encoding}; ## 'ldap'
# $new_args{length_limit} = $args->{length_limit} if exists $args->{length_limit};
lib/DBIx/Class/EncodedColumn/Crypt/PBKDF2.pm view on Meta::CPAN
data_type => 'text',
encode_column => 1,
encode_class => 'Crypt::PBKDF2',
encode_args => {
hash_class => 'HMACSHA1',
iterations => 1000
},
encode_check_method => 'check_password',
}
)
lib/DBIx/Class/EncodedColumn/Crypt/PBKDF2.pm view on Meta::CPAN
B<Type:> Object (must fulfill role L<Crypt::PBKDF2::Hash>), B<Default:> None.
It is also possible to provide a hash object directly; in this case the
C<hash_class> and C<hash_args> are ignored.
=head2 iterations
B<Type:> Integer, B<Default:> 1000.
The default number of iterations of the hashing function to use for the
C<generate> and C<PBKDF2> methods.
=head2 output_len
B<Type:> Integer.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Migration/Tutorial.pod view on Meta::CPAN
test cases for your database.
=head2 STEP 5: Third Migration
L<DBIx::Class::Migration::Tutorial::ThirdMigration> explores a more complicated
migration and also reviews what to do if you need to run through a few iterations
of a migration before you are ready to set it in stone.
=head2 STEP 6: Migrations for Additional Databases
L<DBIx::Class::Migration::Tutorial::AddMySQL>. So far we've been building
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Sims/Item.pm view on Meta::CPAN
return;
}
}
# Search through all the possible iterations of unique keys.
# * Don't populate $self->{create}
# * If found with all keys, great.
# * Otherwise, keep track of what we find for each combination (if at all)
# * If we have multiple finds, die.
# TODO: Use List::Powerset->powerset_lazy() instead of powerset()
view all matches for this distribution
view release on metacpan or search on metacpan
examples/Benchmarks/benchmark_hashrefinflator.pl view on Meta::CPAN
Class::Unload->unload('DBIx::Class::ResultClass::HashRefInflator');
eval $bch->{code} or die $@;
$INC{'DBIx/Class/ResultClass/HashRefInflator.pm'} = $bch->{title};
for my $t (qw/simple complex/) {
my $label = "Timing $num_iters{$t} $t iterations of $bch->{desc}";
my $bench = Dumbbench->new(
initial_runs => 30,
target_rel_precision => 0.0005,
);
view all matches for this distribution
view release on metacpan or search on metacpan
This method is used for iterating through multiple database entries. See
_prepare_sql for the named parameters used.
You must pass as the first arguement a reference to a scalar to store an
id for the iteration. This allows iterations to be nested without
conflict.
=cut
sub each {
view all matches for this distribution
view release on metacpan or search on metacpan
DataLoader/XMLWriter.pm view on Meta::CPAN
XMLWriter expects to get hash referance to a hash that contains
a hash keyed to table names, with each table key's value is a hash
containing a data hash and keys for (parent, xpath, and node);
The data hash will contain all data for a given segment of xml.
The hash is keyed by numbers that are based on the number of iterations
of data contained in the hash. Each number key points to a array of hash which
contain the actual data, item_node, xpath, and a attribute. Only the attribute node is
optional.
view all matches for this distribution
view release on metacpan or search on metacpan
ddc-query.perl view on Meta::CPAN
'opt-file|opt|O=s' => \$client{optFile},
'mode|m=s' => \$client{mode},
'query-encoding|qencoding|qe=s' => \$qencoding,
##-- Benchmarking and testing
'benchmark-iterations|benchmark-iters|bench-iters|bibenchmark|bench|b|iters|i=i' => \$bench_iters,
'benchmark-seconds|bench-seconds|bs=i' => \$bench_seconds,
'bench-clear-cache|bench-clear|bc!' => \$bench_clear_cache,
'query-file|file|qf!' => \$query_from_file,
'query-sleep|sleep|qs=i' => \$query_sleep,
'query-verbose|qv|verbose|query-trace|qt|trace!' => \$query_verbose,
ddc-query.perl view on Meta::CPAN
-file ##-- arguments are query-list filenames, not queries
-request ##-- alias for -mode=request -raw (for protocol debugging)
-multi ##-- send multiple requests on same connection (default=no)
Benchmarking and Batch Options:
-bench-iters ITERS ##-- benchmark: time ITERS query iterations
-bench-seconds SECONDS ##-- benchmark: abort after SECONDS query-processing time (default=inf)
-[no]bench-clear ##-- do/don't clear server cache between benchmark iterations (default=do)
-query-file ##-- batch-execute queries from command-line argument file(s)
-query-sleep SECONDS ##-- sleep for SECONDS between multiple queries (default=0)
-query-verbose ##-- trace query execution to stderr
Hit Selection Options:
view all matches for this distribution
view release on metacpan or search on metacpan
eval { $pair->[1]->() };
if ($@) { warn " $pair->[0] failed to parse: $@"; $ok = 0 }
}
unless ($ok) { print " (skipped: parse failure)\n\n"; next }
# Auto-tune iteration count: more iterations for faster fixtures.
cmpthese(-2, {
pure => sub { DMS::Parser::parse_document_with_config($src, $pure_cfg) },
xs => sub { DMS::Parser::XS::parse_document_with_config($src, $xs_cfg) },
});
print "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DMS/Parser.pm view on Meta::CPAN
$self->{line_start} = $self->{pos};
}
$self->_skip_trivia;
last if $self->{pos} >= $self->{len};
# Inline _measure_line_indent: hot enough that the call cost
# matters across 50k iterations. For indent==0 (most flat
# tables) we can skip the regex when pos is already at
# line_start with no leading space â by far the common case.
my $li;
if ($indent == 0 && $self->{pos} == $self->{line_start}
&& substr($self->{src}, $self->{pos}, 1) ne ' ') {
view all matches for this distribution
view release on metacpan or search on metacpan
eval { $pair->[1]->() };
if ($@) { warn " $pair->[0] failed to parse: $@"; $ok = 0 }
}
unless ($ok) { print " (skipped: parse failure)\n\n"; next }
# Auto-tune iteration count: more iterations for faster fixtures.
cmpthese(-2, {
pure => sub { DMS::Parser::parse_document_with_config($src, $pure_cfg) },
xs => sub { DMS::XS::Parser::parse_document_with_config($src, $xs_cfg) },
});
print "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DNS/LDNS.pm view on Meta::CPAN
str = pkt_rcode2str(rcode)
error = errorstr_by_id(status)
str = DNS::LDNS::last_error
status = DNS::LDNS::last_status
rr = dnssec_create_nsec(from, to, type)
rr = dnssec_create_nsec3(from, to, algorithm, flags, iterations, salt)
rr = create_nsec(current, next, rrs)
rr = create_nsec3(cur_owner, cur_zone, algorithm, flags,
iterations, salt, empty_nonterminals)
algo = signing_algorithm_by_name(name)
bool = key_algorithm_supported(algorithm)
rr = read_anchor_file(filename)
=head2 Object references and cloning
view all matches for this distribution
view release on metacpan or search on metacpan
rtree/salad/rtree.h view on Meta::CPAN
/** Maximal possible R-tree height */
RTREE_MAX_DIMENSION = 20
};
/**
* Rtree search operations. Used for searching and iterations.
* All operations except SOP_ALL reqires a rectangle to be set,
* and treat it in different ways
*/
enum spatial_search_op
{
view all matches for this distribution